From 6fe6b91970a50c5609e81567c4b486b02e4f1a66 Mon Sep 17 00:00:00 2001 From: Philip Kaludercic Date: Wed, 19 Jul 2023 21:14:40 +0200 Subject: [PATCH] ; 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) --- lisp/thingatpt.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 46e700c2091..22a356efa83 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -250,7 +250,8 @@ thing-at-point-bounds-of-string-at-point (goto-char (nth 8 ppss)) (cons (point) (progn (forward-sexp) (point)))) ;; At the beginning of the string - (if (and (char-after) (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)) -- 2.39.2