GNU bug report logs - #14793
23.4; Cannot bind a function to a sequence of two mouse keys

Previous Next

Package: emacs;

Reported by: Stefano Lodi <regularclockwork <at> gmail.com>

Date: Thu, 4 Jul 2013 18:29:02 UTC

Severity: normal

Tags: confirmed

Found in versions 25.1, 23.4

Full log


View this message in rfc822 format

From: Alex <agrambot <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14793 <at> debbugs.gnu.org, regularclockwork <at> gmail.com, npostavs <at> users.sourceforge.net
Subject: bug#14793: 23.4; Cannot bind a function to a sequence of two mouse keys
Date: Sun, 01 Oct 2017 11:53:16 -0600
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Alex <agrambot <at> gmail.com>
>> Cc: 14793 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net, regularclockwork <at> gmail.com
>> Date: Sat, 30 Sep 2017 21:05:05 -0600
>> 
>> (define-prefix-command 'test)
>> (global-set-key (kbd "C-t") #'test)
>> (global-set-key [mouse-3] #'test)
>> (global-set-key (kbd "C-t <mouse-2>") #'backward-word)
>> (global-set-key [mouse-3 mouse-2] #'backward-word)
>> 
>> Hitting C-t mouse-2 calls `backward-word' as intended, but hitting
>> mouse-3 mouse-2 displays an "Empty menu" error as in the original
>> report.
>> 
>> The error is thrown from Fx_popup_menu and is called from
>> read_char_x_menu_prompt, which is only called in the mouse case. I'm not
>> sure how to proceed from here.
>
> Who said a mouse click could be a prefix key?

Does the manual state that a mouse click can't be a prefix key? "(elisp)
Prefix Keys" states that "A prefix key is a key sequence whose binding
is a keymap", which mouse-3 as above satisfies:

(keymapp (key-binding [mouse-3])) => t

As long as the mouse click isn't in some special area (mode-line,
menu-bar, etc.), then I would hope that it would be treated as a prefix
key.

Also, "(emacs) Mouse Buttons" states that "You can put more than one
mouse button in a key sequence, but it isn’t usual to do so.".

How would one do this if a mouse click can't be a prefix key? The
following also fails:

(define-prefix-command 'test)
(global-set-key (kbd "C-t") #'test)
(global-set-key (kbd "C-t <mouse-3> <mouse-2>") #'backward-word)




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.