aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2017-12-23 18:00:10 +0000
committerAlan Mackenzie2017-12-23 18:00:10 +0000
commitde89c0b6411c01e3ed58ac82e68b21cac985b7eb (patch)
treef34ab1cf4d86465490faef59f59eaa08ebd6cc13
parent720ed0b5334c9667b2fdc4d3f5e8975865e9f962 (diff)
downloademacs-de89c0b6411c01e3ed58ac82e68b21cac985b7eb.tar.gz
emacs-de89c0b6411c01e3ed58ac82e68b21cac985b7eb.zip
Make C-h c/k S-mouse-1 display message for mouse-appearance-menu, etc.
Currently, C-h c/k for S-mouse-1 reports that S-mouse-1 is unbound, ignoring that S-down-mouse-1 is bound. We fix this by reporting on the "latest" mouse event of a sequence which is bound. * lisp/help.el (help-read-key-sequence): Save all encountered mouse events in a list. Return the latest one which has a binding.
-rw-r--r--lisp/help.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 212e3679dad..dd1676adb06 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -717,7 +717,7 @@ with `mouse-movement' events."
717 (cursor-in-echo-area t) 717 (cursor-in-echo-area t)
718 saved-yank-menu) 718 saved-yank-menu)
719 (unwind-protect 719 (unwind-protect
720 (let (key down-ev) 720 (let (key keys down-ev discarded-up)
721 ;; If yank-menu is empty, populate it temporarily, so that 721 ;; If yank-menu is empty, populate it temporarily, so that
722 ;; "Select and Paste" menu can generate a complete event. 722 ;; "Select and Paste" menu can generate a complete event.
723 (when (null (cdr yank-menu)) 723 (when (null (cdr yank-menu))
@@ -731,6 +731,7 @@ Describe the following key, mouse click, or menu item: "))
731 (or 731 (or
732 (and no-mouse-movement 732 (and no-mouse-movement
733 (string-match "mouse-movement" keyname)) 733 (string-match "mouse-movement" keyname))
734 (progn (push key keys) nil)
734 (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" 735 (and (string-match "\\(mouse\\|down\\|click\\|drag\\)"
735 keyname) 736 keyname)
736 (progn 737 (progn
@@ -739,13 +740,31 @@ Describe the following key, mouse click, or menu item: "))
739 (sleep-for 0.01) 740 (sleep-for 0.01)
740 (while (read-event nil nil 0.01)) 741 (while (read-event nil nil 0.01))
741 (not (sit-for (/ double-click-time 1000.0) t)))))))) 742 (not (sit-for (/ double-click-time 1000.0) t))))))))
743 ;; When we have a sequence of mouse events, discard the most
744 ;; recent ones till we find one with a binding.
745 (let ((keys-1 keys))
746 (while (and keys-1
747 (not (key-binding (car keys-1))))
748 ;; If we discard the last event, and this was a mouse
749 ;; up, remember this.
750 (if (and (eq keys-1 keys)
751 (vectorp (car keys-1))
752 (let* ((last-idx (1- (length (car keys-1))))
753 (last (aref (car keys-1) last-idx)))
754 (and (eventp last)
755 (memq 'click (event-modifiers last)))))
756 (setq discarded-up t))
757 (setq keys-1 (cdr keys-1)))
758 (if keys-1
759 (setq key (car keys-1))))
742 (list 760 (list
743 key 761 key
744 ;; If KEY is a down-event, read and include the 762 ;; If KEY is a down-event, read and include the
745 ;; corresponding up-event. Note that there are also 763 ;; corresponding up-event. Note that there are also
746 ;; down-events on scroll bars and mode lines: the actual 764 ;; down-events on scroll bars and mode lines: the actual
747 ;; event then is in the second element of the vector. 765 ;; event then is in the second element of the vector.
748 (and (vectorp key) 766 (and (not discarded-up) ; Don't attempt to ignore the up-event twice.
767 (vectorp key)
749 (let ((last-idx (1- (length key)))) 768 (let ((last-idx (1- (length key))))
750 (and (eventp (aref key last-idx)) 769 (and (eventp (aref key last-idx))
751 (memq 'down (event-modifiers (aref key last-idx))))) 770 (memq 'down (event-modifiers (aref key last-idx)))))