Subject: 24.4.50; Modified mouse-click events are not translated to unmodified if unbound

From: Dominic Jänichen <[email-masked]>
Date: Sat, 29 Mar 2014 15:03:53 +0000 (UTC)

A keyboard event that includes modifiers as "S-" is translated to the
unmodified version if there is no binding of the modified
key. (Eg. <S-left> gets translated to <left>)
This should also happen for mouse-click events, but doesn't. (Unbind
<S-mouse-1> and <S-down-mouse-1>. Then, clicking inside a buffer with
Shift held down results in "<S-mouse-1> is undefined" in minibuffer)

(refer also to description in emacs-dev; copied here for completeness)
I am using shift-select-mode and want to activate a region using S-
mouse-1. I have <mouse-1> and <S-mouse-1> bound to "mouse-set-point". I 
either change "mouse-set-point" to contain (interactive "^e") or use cua-
mode and (put 'mouse-set-point 'CUA 'move).
I find that I can then extend existing regions with <S-mouse-1>, but not 
activate one (ie. click on some spot to activate the region between that 
spot and the current mark).

This issue exists since rev 107888 and is documented there: "Don't 
activate the region on shift if the binding is already shifted." That's 
fine for <left> as <S-left> translates to <left>, but <S-mouse-1> does 
not translate to <mouse-1>. The only option is to bind <S-mouse-1>, but 
this does not activate the region as it is already shifted.

On Fri, 28 Mar 2014 16:19:19 -0400, Stefan Monnier wrote:

> S-mouse-1 does translate to mouse-1, tho only if S-mouse-1 is not
> bound.  So instead of binding S-mouse-1 to mouse-set-point, you want to
> unbind S-mouse-1: (global-set-key [S-mouse-1] nil)

Doing that results in S-Mouse-1 being non-functional. ("<S-mouse-1> is 
undefined" in minibuffer.)

In GNU Emacs 24.4.50.5 (x86_64-pc-linux-gnu, GTK+ Version 3.11.8)
 of 2014-03-28 on dominic-gentoo
Repository revision: [email-masked]
Windowing system distributor `The X.Org Foundation', version 11.0.11500000
System Description:	Gentoo Base System release 2.2

Configured using:
 `configure --prefix=/usr --build=x86_64-pc-linux-gnu
 --host=x86_64-pc-linux-gnu --mandir=/usr/share/man
 --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc
 --localstatedir=/var/lib --libdir=/usr/lib64 --disable-silent-rules
 --disable-dependency-tracking --program-suffix=-emacs-24-vcs
 --infodir=/usr/share/info/emacs-24-vcs
 --enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp
 --with-gameuser=games --without-compress-install
 --with-file-notification=gfile --enable-acl --with-dbus --with-gnutls
 --without-gpm --without-hesiod --with-kerberos --with-kerberos5
 --with-xml2 --without-selinux --without-wide-int --with-zlib
 --with-sound=alsa --with-x --without-ns --without-gconf
 --with-gsettings --with-toolkit-scroll-bars --with-gif --with-jpeg
 --with-png --with-rsvg --with-tiff --with-xpm --with-imagemagick
 --with-xft --with-libotf --with-m17n-flt --with-x-toolkit=gtk3
 GENTOO_PACKAGE=app-editors/emacs-vcs-24.4.9999 EBZR_BRANCH=trunk
 EBZR_REVNO= 'CFLAGS=-march=native -mtune=native -frecord-gcc-switches
 -fomit-frame-pointer -fuse-linker-plugin -pipe -Wstrict-aliasing
 -Werror=strict-aliasing -Wformat=2 -Waggressive-loop-optimizations
 -Werror=aggressive-loop-optimizations -fdiagnostics-color -O3 -flto
 -fno-fat-lto-objects -floop-interchange -ftree-loop-distribution -fweb
 -fvariable-expansion-in-unroller -frename-registers -ggdb '
 'LDFLAGS=-Wl,-O1 -Wl,--as-needed -march=native -mtune=native
 -frecord-gcc-switches -fomit-frame-pointer -fuse-linker-plugin -pipe
 -Wstrict-aliasing -Werror=strict-aliasing -Wformat=2
 -Waggressive-loop-optimizations -Werror=aggressive-loop-optimizations
 -fdiagnostics-color -O3 -flto -fno-fat-lto-objects -floop-interchange
 -ftree-loop-distribution -fweb -fvariable-expansion-in-unroller
 -frename-registers -ggdb''

Important settings:
  value of $LC_MONETARY: de_DE.utf8
  value of $LC_NUMERIC: de_DE.utf8
  value of $LC_TIME: de_DE.utf8
  value of $LANG: en_GB.utf8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-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
  transient-mark-mode: t

Recent input:
<menu-bar> <buffer> C-a <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <menu-bar> <edit> <paste> <down-mouse-1> 
<mouse-1> <double-down-mouse-1> <double-mouse-1> n 
i l <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
n i l <right> C-j <down-mouse-1> <mouse-movement> <mouse-1> 
C-h k <S-down-mouse-1> <S-mouse-1> ` <backspace> M-x 
d e s c - k <return> <S-down-mouse-1> <S-mouse-1> M-x 
d e s c - k <return> < <help-echo> <help-echo> <down-mouse-1> 
<mouse-1> <down-mouse-1> <mouse-movement> <mouse-1> 
<down-mouse-1> <mouse-movement> <mouse-1> <backspace> 
<backspace> <backspace> <backspace> u p <end> C-j <down-mouse-1> 
<mouse-1> <backspace> <backspace> <backspace> C-j <backspace> 
<down-mouse-1> <mouse-movement> <mouse-1> <home> <backspace> 
<end> C-j <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> <S-down-mouse-1> 
<S-mouse-1> <S-down-mouse-1> <S-mouse-1> M-x d e s 
c - k <return> <S-down-mouse-1> <S-mouse-1> M-x d e 
c <backspace> s c - k <return> <S-down-mouse-1> <S-drag-mouse-1> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo> 
<help-echo> <help-echo> <help-echo> <menu-bar> <help-menu> 
<send-emacs-bug-report>

Recent messages:
Type C-x 1 to delete the help window, C-M-v to scroll help.
You can run the command `describe-key' with C-h k
Type C-x 1 to delete the help window, C-M-v to scroll help.
Entering debugger...
delete-backward-char: Buffer is read-only: #<buffer *Backtrace*>
<S-mouse-1> is undefined [13 times]
<S-mouse-1> (translated from <S-down-mouse-1> <S-mouse-1>) at that spot 
is undefined
You can run the command `describe-key' with C-h k
<S-mouse-1> (translated from <S-down-mouse-1> <S-mouse-1>) at that spot 
is undefined
<S-drag-mouse-1> (translated from <S-down-mouse-1> <S-drag-mouse-1>) at 
that spot is undefined

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message idna dired format-spec
rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils debug help-fns help-mode easymenu edmacro
kmacro cl-loaddefs cl-lib site-gentoo preview-latex tex-site auto-loads
time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode prog-mode register page menu-bar
rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax
facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind gfilenotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty emacs)

Memory information:
((conses 16 84707 7284)
 (symbols 48 18518 0)
 (miscs 40 120 210)
 (strings 32 12486 4595)
 (string-bytes 1 367649)
 (vectors 16 9832)
 (vector-slots 8 379991 6635)
 (floats 8 67 335)
 (intervals 56 484 0)
 (buffers 960 14)
 (heap 1024 35758 1231))