]> git.eshelyaron.com Git - emacs.git/commitdiff
Filter obtrusive events in help-read-key-sequence.
authorAlan Mackenzie <acm@muc.de>
Sat, 18 Nov 2017 14:52:39 +0000 (14:52 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 18 Nov 2017 14:52:39 +0000 (14:52 +0000)
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.

lisp/help.el

index fbb9fc8cbe6e8be4c87734709f5f6055fd787b48..212e3679dad49d352e9205e73bc0e4dd50773adf 100644 (file)
@@ -728,11 +728,17 @@ with `mouse-movement' events."
 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)))
-                 (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)))))))
+                 (or
+                  (and no-mouse-movement
+                       (string-match "mouse-movement" keyname))
+                  (and (string-match "\\(mouse\\|down\\|click\\|drag\\)"
+                                     keyname)
+                       (progn
+                         ;; Discard events (e.g. <help-echo>) which might
+                         ;; spuriously trigger the `sit-for'.
+                         (sleep-for 0.01)
+                         (while (read-event nil nil 0.01))
+                         (not (sit-for (/ double-click-time 1000.0) t))))))))
           (list
            key
            ;; If KEY is a down-event, read and include the