unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Devlin <spd@toadstyle.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 60080@debbugs.gnu.org
Subject: bug#60080: 28.2; Double-click selection cannot be customized
Date: Thu, 15 Dec 2022 14:19:16 -0500	[thread overview]
Message-ID: <9EEEC308-CA4C-4152-8CB9-825469C82034@toadstyle.org> (raw)
In-Reply-To: <83tu1xktoh.fsf@gnu.org>

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,






  reply	other threads:[~2022-12-15 19:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15  0:40 bug#60080: 28.2; Double-click selection cannot be customized Sean Devlin
2022-12-15  7:33 ` Eli Zaretskii
2022-12-15 19:19   ` Sean Devlin [this message]
2022-12-16 16:28     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9EEEC308-CA4C-4152-8CB9-825469C82034@toadstyle.org \
    --to=spd@toadstyle.org \
    --cc=60080@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).