GNU bug report logs -
#14793
23.4; Cannot bind a function to a sequence of two mouse keys
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
This bug report will be sent to the Free Software Foundation,
not to your local site managers!
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.
Your report will be posted to the bug-gnu-emacs <at> gnu.org mailing list
and the gnu.emacs.bug news group, and at http://debbugs.gnu.org.
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug. If you can, give
a recipe starting from `emacs -Q':
The manual states at the end of Section 48.3.10 "Rebinding Mouse Buttons"
says "You can put more than one mouse button in a key sequence, but it
isn't usual to do so."
I failed to bind a simple function to a sequence of two mouse keys.
> emacs -Q
inside the *scratch* buffer, evaluate:
(defun go-backwards ()
"Go backward one word."
(interactive)
(backward-word 1))
(global-unset-key [mouse-3])
(global-set-key [mouse-3 mouse-2] 'go-backwards)
Now, pressing the right mouse button gives the message
Empty menu
at the bottom of the Emacs screen.
If I evaluate
(setq debug-on-error t)
and press the right button again I get just
Debugger entered--Lisp error: (error "Empty menu")
However, after evaluating
(global-set-key [mouse-3] 'go-backwards)
pressing the right mouse button does indeed move the point backward one
word; therefore binding a single mouse key works.
Another way to obtain the same result is the following.
Evaluate
(defun go-backwards ()
"Go backward one word."
(interactive)
(backward-word 1))
(global-unset-key [mouse-3])
(defvar my-map (make-sparse-keymap))
(define-key my-map [mouse-2] 'go-backwards)
Now, C-h v my-map gives clearly
my-map's value is (keymap
(mouse-2 . go-backwards))
Then evaluating
(define-key global-map [mouse-3] my-map)
gives
(keymap (mouse-2 . go-backwards))
at the bottom of the Emacs screen. However, again the right button gives
"Empty menu".
[Message part 2 (text/html, inline)]
This bug report was last modified 7 years and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.