From a6c0a583c1a6f9967b422324b4c6b6cd242b8bf0 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 8 Feb 2025 12:41:36 +0200 Subject: [PATCH] * lisp/mouse.el (mouse-skip-word): Avoid errors at EOB. (Bug#75965) (cherry picked from commit 512187feb046aea6de6d26e45271481a324a928c) --- lisp/mouse.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/mouse.el b/lisp/mouse.el index 514c4988283..cbf206d0d93 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -1874,8 +1874,14 @@ The region will be defined with mark and point." If `mouse-1-double-click-prefer-symbols' is non-nil, skip over symbol. If DIR is positive skip forward; if negative, skip backward." (let* ((char (following-char)) + (syntax-after-pt (syntax-class (syntax-after (point)))) (syntax (char-to-string - (syntax-class-to-char (syntax-class (syntax-after (point)))))) + (if syntax-after-pt + (syntax-class-to-char syntax-after-pt) + ;; Zero is what 'following-char' returns at EOB, so + ;; we feed that to 'char-syntax' when 'syntax-class' + ;; returns nil, which means we are at EOB. + (char-syntax ?\0)))) sym) (cond ((and mouse-1-double-click-prefer-symbols (setq sym (bounds-of-thing-at-point 'symbol))) -- 2.39.5