diff options
| author | Alan Mackenzie | 2017-11-18 14:52:39 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2017-11-18 14:52:39 +0000 |
| commit | e9dd580cc8b3134eb82d758efb070a3ab8dd3e9a (patch) | |
| tree | cb626131eee284316025393543072a69557681e4 | |
| parent | 90075e8e1e6d6d7b6b49cb20ecdbb5d3de53d48b (diff) | |
| download | emacs-e9dd580cc8b3134eb82d758efb070a3ab8dd3e9a.tar.gz emacs-e9dd580cc8b3134eb82d758efb070a3ab8dd3e9a.zip | |
Filter obtrusive events in help-read-key-sequence.
This fixes most of bug #29272.
* lisp/help.el (help-read-key-sequence): After a mouse event, pause for 0.01s,
discarding any events (such as <help-echo>) received in this time, before
polling for the double-click (etc.) events which may follow. This fixes the
infinite loop which occurred whwn <help-echo> events triggered a sit-for
whilst handling menu events.
| -rw-r--r-- | lisp/help.el | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lisp/help.el b/lisp/help.el index fbb9fc8cbe6..212e3679dad 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -728,11 +728,17 @@ with `mouse-movement' events." | |||
| 728 | Describe the following key, mouse click, or menu item: ")) | 728 | Describe the following key, mouse click, or menu item: ")) |
| 729 | ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0)) | 729 | ((and (pred vectorp) (let `(,key0 . ,_) (aref key 0)) |
| 730 | (guard (symbolp key0)) (let keyname (symbol-name key0))) | 730 | (guard (symbolp key0)) (let keyname (symbol-name key0))) |
| 731 | (if no-mouse-movement | 731 | (or |
| 732 | (string-match "mouse-movement" keyname) | 732 | (and no-mouse-movement |
| 733 | (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" | 733 | (string-match "mouse-movement" keyname)) |
| 734 | keyname) | 734 | (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" |
| 735 | (not (sit-for (/ double-click-time 1000.0) t))))))) | 735 | keyname) |
| 736 | (progn | ||
| 737 | ;; Discard events (e.g. <help-echo>) which might | ||
| 738 | ;; spuriously trigger the `sit-for'. | ||
| 739 | (sleep-for 0.01) | ||
| 740 | (while (read-event nil nil 0.01)) | ||
| 741 | (not (sit-for (/ double-click-time 1000.0) t)))))))) | ||
| 736 | (list | 742 | (list |
| 737 | key | 743 | key |
| 738 | ;; If KEY is a down-event, read and include the | 744 | ;; If KEY is a down-event, read and include the |