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

From: Sean Devlin <[email-masked]>
Date: Wed, 14 Dec 2022 19:40:22 -0500

Hi folks,

In GUI Emacs, you can double-click to select some region of text. The
rules for double-click selection are documented in (info "(emacs) Word
and Line Mouse"). Here are the relevant bits:

  Select the text around the word or character which you click on.

  Double-clicking on a character with symbol syntax (such as
  underscore, in C mode) selects the symbol surrounding that
  character.

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.

Here is a recipe to show what I am talking about:

1. Open GUI Emacs with -Q flag.
2. In the scratch buffer, type "this-is-a-symbol".
3. With the mouse, double-click on "this".
4. Observe that only "this" is selected in the active region.
5. C-g to deactive the region.
6. Double-click on the "-" following "this".
7. Observe that the entire symbol "this-is-a-symbol" is selected.

I want to select the full symbol "this-is-a-symbol" in both cases.

Note that this is the default behavior in some other editors that I am
aware of.

I understand that I can get the behavior I want by double-clicking the
"-", but "-" is a small target, and selecting the entire symbol is by
far the more common use case for me.

In the short term, I have a workaround where I advise the
mouse-skip-word function.

Thanks!

In GNU Emacs 28.2
System Description:  macOS 13

Configured using:
'configure --with-ns '--enable-locallisppath=/Library/Application
Support/Emacs/${version}/site-lisp:/Library/Application
Support/Emacs/site-lisp' --with-modules'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE NS PDUMPER THREADS
TOOLKIT_SCROLL_BARS ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search seq byte-opt
gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils time-date subr-x cl-loaddefs
cl-lib iso-transl tooltip eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice
button loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue cocoa ns multi-tty
make-network-process emacs)

Memory information:
((conses 16 49949 6483)
(symbols 48 6552 1)
(strings 32 18286 1523)
(string-bytes 1 606914)
(vectors 16 12898)
(vector-slots 8 184857 11573)
(floats 8 21 51)
(intervals 56 198 0)
(buffers 992 10))