Subject: Re: bug#60080: 28.2; Double-click selection cannot be customized

From: Eli Zaretskii <[email-masked]>
Date: Thu, 15 Dec 2022 09:33:18 +0200

> From: Sean Devlin <[email-masked]>
> Date: Wed, 14 Dec 2022 19:40:22 -0500
> 
> I'd like to customize Emacs such that when I double-click on a word,
> the entire enclosing symbol is selected. In other words, it should
> behave more like the latter case of double-clicking on a character with
> symbol syntax.

Does the patch below do what you want?

If it does, we could provide this as an optional behavior, conditioned
by some new user option.

diff --git a/lisp/mouse.el b/lisp/mouse.el
index f72ab4f..ced7a92 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1803,7 +1803,11 @@ mouse-skip-word
 If DIR is positive skip forward; if negative, skip backward."
   (let* ((char (following-char))
 	 (syntax (char-to-string (char-syntax char))))
-    (cond ((string= syntax "w")
+    (cond ((bounds-of-thing-at-point 'symbol)
+           (goto-char (if (< dir 0)
+                          (car (bounds-of-thing-at-point 'symbol))
+                        (cdr (bounds-of-thing-at-point 'symbol)))))
+          ((string= syntax "w")
 	   ;; Here, we can't use skip-syntax-forward/backward because
 	   ;; they don't pay attention to word-separating-categories,
 	   ;; and thus they will skip over a true word boundary.  So,