diff options
| author | Noam Postavsky | 2017-06-18 00:39:05 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2017-07-01 09:40:29 -0400 |
| commit | e620bbe38ed5e3e2a77f01eac2814c01dfa41c2d (patch) | |
| tree | 410c3f1fea63b0b88b981674eb35c504d8853f4a | |
| parent | 2bd32ede1ce05b88278bab15f6cc603c97a1fb2f (diff) | |
| download | emacs-e620bbe38ed5e3e2a77f01eac2814c01dfa41c2d.tar.gz emacs-e620bbe38ed5e3e2a77f01eac2814c01dfa41c2d.zip | |
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.
| -rw-r--r-- | doc/emacs/help.texi | 7 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/help.el | 18 |
3 files changed, 19 insertions, 9 deletions
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 548ca6a1b48..fd6df1c7e53 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi | |||
| @@ -203,9 +203,10 @@ string}, which describes exactly what the command does. | |||
| 203 | describes the command corresponding to @var{key}. | 203 | describes the command corresponding to @var{key}. |
| 204 | 204 | ||
| 205 | @kbd{C-h c}, @kbd{C-h k} and @kbd{C-h K} work for any sort of key | 205 | @kbd{C-h c}, @kbd{C-h k} and @kbd{C-h K} work for any sort of key |
| 206 | sequences, including function keys, menus, and mouse events. For | 206 | sequences, including function keys, menus, and mouse events (except |
| 207 | instance, after @kbd{C-h k} you can select a menu item from the menu | 207 | that @kbd{C-h c} ignores mouse movement events). For instance, after |
| 208 | bar, to view the documentation string of the command it runs. | 208 | @kbd{C-h k} you can select a menu item from the menu bar, to view the |
| 209 | documentation string of the command it runs. | ||
| 209 | 210 | ||
| 210 | @kindex C-h w | 211 | @kindex C-h w |
| 211 | @findex where-is | 212 | @findex where-is |
| @@ -373,6 +373,9 @@ use the local Emacs to edit remote files via Tramp. See the node | |||
| 373 | "emacsclient Options" in the user manual for the details. | 373 | "emacsclient Options" in the user manual for the details. |
| 374 | 374 | ||
| 375 | +++ | 375 | +++ |
| 376 | ** 'describe-key-briefly' now ignores mouse movement events. | ||
| 377 | |||
| 378 | +++ | ||
| 376 | ** The new variable 'eval-expression-print-maximum-character' prevents | 379 | ** The new variable 'eval-expression-print-maximum-character' prevents |
| 377 | large integers from being displayed as characters. | 380 | large integers from being displayed as characters. |
| 378 | 381 | ||
diff --git a/lisp/help.el b/lisp/help.el index 78687a9e8a8..0fb1c2dab77 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -636,7 +636,9 @@ the last key hit are used. | |||
| 636 | If KEY is a menu item or a tool-bar button that is disabled, this command | 636 | If KEY is a menu item or a tool-bar button that is disabled, this command |
| 637 | temporarily enables it to allow getting help on disabled items and buttons." | 637 | temporarily enables it to allow getting help on disabled items and buttons." |
| 638 | (interactive | 638 | (interactive |
| 639 | (pcase-let ((`(,key ,_up-event) (help-read-key-sequence))) | 639 | ;; Ignore mouse movement events because it's too easy to miss the |
| 640 | ;; message while moving the mouse. | ||
| 641 | (pcase-let ((`(,key ,_up-event) (help-read-key-sequence 'no-mouse-movement))) | ||
| 640 | `(,key ,current-prefix-arg 1))) | 642 | `(,key ,current-prefix-arg 1))) |
| 641 | (princ (car (help--analyze-key key untranslated)) | 643 | (princ (car (help--analyze-key key untranslated)) |
| 642 | (if insert (current-buffer) standard-output))) | 644 | (if insert (current-buffer) standard-output))) |
| @@ -704,11 +706,13 @@ function `key-binding'." | |||
| 704 | (throw 'found x)))) | 706 | (throw 'found x)))) |
| 705 | nil))))) | 707 | nil))))) |
| 706 | 708 | ||
| 707 | (defun help-read-key-sequence () | 709 | (defun help-read-key-sequence (&optional no-mouse-movement) |
| 708 | "Reads a key sequence from the user. | 710 | "Reads a key sequence from the user. |
| 709 | Returns a list of the form (KEY UP-EVENT), where KEY is the key | 711 | Returns a list of the form (KEY UP-EVENT), where KEY is the key |
| 710 | sequence, and UP-EVENT is the up-event that was discarded by | 712 | sequence, and UP-EVENT is the up-event that was discarded by |
| 711 | reading KEY, or nil." | 713 | reading KEY, or nil. |
| 714 | If NO-MOUSE-MOVEMENT is non-nil, ignore key sequences starting | ||
| 715 | with `mouse-movement' events." | ||
| 712 | (let ((enable-disabled-menus-and-buttons t) | 716 | (let ((enable-disabled-menus-and-buttons t) |
| 713 | (cursor-in-echo-area t) | 717 | (cursor-in-echo-area t) |
| 714 | saved-yank-menu) | 718 | saved-yank-menu) |
| @@ -724,9 +728,11 @@ reading KEY, or nil." | |||
| 724 | Describe the following key, mouse click, or menu item: ")) | 728 | Describe the following key, mouse click, or menu item: ")) |
| 725 | ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0)) | 729 | ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0)) |
| 726 | (guard (symbolp key0)) (let keyname (symbol-name key0))) | 730 | (guard (symbolp key0)) (let keyname (symbol-name key0))) |
| 727 | (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" | 731 | (if no-mouse-movement |
| 728 | keyname) | 732 | (string-match "mouse-movement" keyname) |
| 729 | (not (sit-for (/ double-click-time 1000.0) t)))))) | 733 | (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" |
| 734 | keyname) | ||
| 735 | (not (sit-for (/ double-click-time 1000.0) t))))))) | ||
| 730 | (list | 736 | (list |
| 731 | key | 737 | key |
| 732 | ;; If KEY is a down-event, read and include the | 738 | ;; If KEY is a down-event, read and include the |