[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60080: 28.2; Double-click selection cannot be customized
From: |
Sean Devlin |
Subject: |
bug#60080: 28.2; Double-click selection cannot be customized |
Date: |
Thu, 15 Dec 2022 14:19:16 -0500 |
Hi Eli,
> On Dec 15, 2022, at 2:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Sean Devlin <spd@toadstyle.org>
>> 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.
Yes, this seems to do the trick.
I agree that a user option would make sense.
Thanks for looking at this so quickly!
>
> 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,