unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14793: 23.4; Cannot bind a function to a sequence of two mouse keys
@ 2013-07-04 17:14 Stefano Lodi
  2013-07-04 20:12 ` bug#14793: Further important info Stefano Lodi
       [not found] ` <878twa94c5.fsf@users.sourceforge.net>
  0 siblings, 2 replies; 10+ messages in thread
From: Stefano Lodi @ 2013-07-04 17:14 UTC (permalink / raw)
  To: 14793

[-- Attachment #1: Type: text/plain, Size: 1997 bytes --]

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@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".

[-- Attachment #2: Type: text/html, Size: 2624 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-10-05  7:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-04 17:14 bug#14793: 23.4; Cannot bind a function to a sequence of two mouse keys Stefano Lodi
2013-07-04 20:12 ` bug#14793: Further important info Stefano Lodi
     [not found] ` <878twa94c5.fsf@users.sourceforge.net>
2017-10-01  3:05   ` bug#14793: 23.4; Cannot bind a function to a sequence of two mouse keys Alex
2017-10-01 16:02     ` Eli Zaretskii
2017-10-01 17:53       ` Alex
2017-10-01 18:26         ` Eli Zaretskii
2017-10-03  3:59           ` Alex
2017-10-03 14:33             ` Eli Zaretskii
2017-10-05  3:58               ` Alex
2017-10-05  7:55                 ` Eli Zaretskii

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).