mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-03 08:30:09 +00:00
Ignore mouse-movement for describe-key-briefly (Bug#12204)
* lisp/help.el (help-read-key-sequence): Add optional argument ot ignore `mouse-movement' events. (describe-key-briefly): Use it. * doc/emacs/help.texi (Key Help): * etc/NEWS: Mention that mouse movement is ignored.
This commit is contained in:
parent
2bd32ede1c
commit
e620bbe38e
@ -203,9 +203,10 @@ string}, which describes exactly what the command does.
|
||||
describes the command corresponding to @var{key}.
|
||||
|
||||
@kbd{C-h c}, @kbd{C-h k} and @kbd{C-h K} work for any sort of key
|
||||
sequences, including function keys, menus, and mouse events. For
|
||||
instance, after @kbd{C-h k} you can select a menu item from the menu
|
||||
bar, to view the documentation string of the command it runs.
|
||||
sequences, including function keys, menus, and mouse events (except
|
||||
that @kbd{C-h c} ignores mouse movement events). For instance, after
|
||||
@kbd{C-h k} you can select a menu item from the menu bar, to view the
|
||||
documentation string of the command it runs.
|
||||
|
||||
@kindex C-h w
|
||||
@findex where-is
|
||||
|
3
etc/NEWS
3
etc/NEWS
@ -372,6 +372,9 @@ environment variable on a remote machine to emacsclient, and
|
||||
use the local Emacs to edit remote files via Tramp. See the node
|
||||
"emacsclient Options" in the user manual for the details.
|
||||
|
||||
+++
|
||||
** 'describe-key-briefly' now ignores mouse movement events.
|
||||
|
||||
+++
|
||||
** The new variable 'eval-expression-print-maximum-character' prevents
|
||||
large integers from being displayed as characters.
|
||||
|
18
lisp/help.el
18
lisp/help.el
@ -636,7 +636,9 @@ the last key hit are used.
|
||||
If KEY is a menu item or a tool-bar button that is disabled, this command
|
||||
temporarily enables it to allow getting help on disabled items and buttons."
|
||||
(interactive
|
||||
(pcase-let ((`(,key ,_up-event) (help-read-key-sequence)))
|
||||
;; Ignore mouse movement events because it's too easy to miss the
|
||||
;; message while moving the mouse.
|
||||
(pcase-let ((`(,key ,_up-event) (help-read-key-sequence 'no-mouse-movement)))
|
||||
`(,key ,current-prefix-arg 1)))
|
||||
(princ (car (help--analyze-key key untranslated))
|
||||
(if insert (current-buffer) standard-output)))
|
||||
@ -704,11 +706,13 @@ function `key-binding'."
|
||||
(throw 'found x))))
|
||||
nil)))))
|
||||
|
||||
(defun help-read-key-sequence ()
|
||||
(defun help-read-key-sequence (&optional no-mouse-movement)
|
||||
"Reads a key sequence from the user.
|
||||
Returns a list of the form (KEY UP-EVENT), where KEY is the key
|
||||
sequence, and UP-EVENT is the up-event that was discarded by
|
||||
reading KEY, or nil."
|
||||
reading KEY, or nil.
|
||||
If NO-MOUSE-MOVEMENT is non-nil, ignore key sequences starting
|
||||
with `mouse-movement' events."
|
||||
(let ((enable-disabled-menus-and-buttons t)
|
||||
(cursor-in-echo-area t)
|
||||
saved-yank-menu)
|
||||
@ -724,9 +728,11 @@ reading KEY, or nil."
|
||||
Describe the following key, mouse click, or menu item: "))
|
||||
((and (pred vectorp) (let `(,key0 . ,_) (aref key 0))
|
||||
(guard (symbolp key0)) (let keyname (symbol-name key0)))
|
||||
(and (string-match "\\(mouse\\|down\\|click\\|drag\\)"
|
||||
keyname)
|
||||
(not (sit-for (/ double-click-time 1000.0) t))))))
|
||||
(if no-mouse-movement
|
||||
(string-match "mouse-movement" keyname)
|
||||
(and (string-match "\\(mouse\\|down\\|click\\|drag\\)"
|
||||
keyname)
|
||||
(not (sit-for (/ double-click-time 1000.0) t)))))))
|
||||
(list
|
||||
key
|
||||
;; If KEY is a down-event, read and include the
|
||||
|
Loading…
Reference in New Issue
Block a user