From: Philip Kaludercic Date: Wed, 19 Jul 2023 19:14:40 +0000 (+0200) Subject: ; Handle string-at-point at end of buffer gracefully X-Git-Tag: archive/raspbian/1%30.1+1-3+rpi1^2~2^2~20^2~4917^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8ef92096c349206794e928f702b56f62bf88a122;p=emacs.git ; Handle string-at-point at end of buffer gracefully * lisp/thingatpt.el (thing-at-point-bounds-of-string-at-point): Check if 'char-after' returns non-nil before passing it to 'char-syntax'. (Bug#64733) --- diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index f3367290dee..408713dda1a 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -250,7 +250,8 @@ Prefer the enclosing string with fallback on sexp at point. (goto-char (nth 8 ppss)) (cons (point) (progn (forward-sexp) (point)))) ;; At the beginning of the string - (if (eq (char-syntax (char-after)) ?\") + (if (let ((ca (char-after))) + (and ca (eq (char-syntax ca) ?\"))) (let ((bound (bounds-of-thing-at-point 'sexp))) (and bound (<= (car bound) (point)) (< (point) (cdr bound))