aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2007-03-21 16:18:25 +0000
committerChong Yidong2007-03-21 16:18:25 +0000
commitba5b5659a608c183e63f37707420a8b22bb293a5 (patch)
tree2eaa89ce873d72e9efe3443a406f3a31b31ce9da
parent4bb5f579812bab94d88bc7543b8a24bccc08d652 (diff)
downloademacs-ba5b5659a608c183e63f37707420a8b22bb293a5.tar.gz
emacs-ba5b5659a608c183e63f37707420a8b22bb293a5.zip
(viper-non-hook-settings): Handle mouse clicks in describe-key and
describe-key-briefly advice a little better.
-rw-r--r--lisp/emulation/viper.el40
1 files changed, 36 insertions, 4 deletions
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index ddd37b16cc2..67ec3660c65 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -1027,14 +1027,46 @@ It also can't undo some Viper settings."
1027 1027
1028 (defadvice describe-key (before viper-describe-key-ad protect activate) 1028 (defadvice describe-key (before viper-describe-key-ad protect activate)
1029 "Force to read key via `viper-read-key-sequence'." 1029 "Force to read key via `viper-read-key-sequence'."
1030 (interactive (list (viper-read-key-sequence "Describe key: ")) 1030 (interactive (let (key)
1031 )) 1031 (setq key (viper-read-key-sequence
1032 "Describe key (or click or menu item): "))
1033 (list key
1034 (prefix-numeric-value current-prefix-arg)
1035 ;; If KEY is a down-event, read also the
1036 ;; corresponding up-event.
1037 (and (vectorp key)
1038 (let ((last-idx (1- (length key))))
1039 (and (eventp (aref key last-idx))
1040 (memq 'down (event-modifiers
1041 (aref key last-idx)))))
1042 (or (and (eventp (aref key 0))
1043 (memq 'down (event-modifiers
1044 (aref key 0)))
1045 ;; For the C-down-mouse-2 popup
1046 ;; menu, there is no subsequent up-event.
1047 (= (length key) 1))
1048 (and (> (length key) 1)
1049 (eventp (aref key 1))
1050 (memq 'down (event-modifiers (aref key 1)))))
1051 (read-event))))))
1032 1052
1033 (defadvice describe-key-briefly 1053 (defadvice describe-key-briefly
1034 (before viper-describe-key-briefly-ad protect activate) 1054 (before viper-describe-key-briefly-ad protect activate)
1035 "Force to read key via `viper-read-key-sequence'." 1055 "Force to read key via `viper-read-key-sequence'."
1036 (interactive (list (viper-read-key-sequence "Describe key briefly: ")))) 1056 (interactive (let (key)
1037 1057 (setq key (viper-read-key-sequence
1058 "Describe key (or click or menu item): "))
1059 ;; If KEY is a down-event, read and discard the
1060 ;; corresponding up-event.
1061 (and (vectorp key)
1062 (let ((last-idx (1- (length key))))
1063 (and (eventp (aref key last-idx))
1064 (memq 'down (event-modifiers (aref key last-idx)))))
1065 (read-event))
1066 (list key
1067 (if current-prefix-arg
1068 (prefix-numeric-value current-prefix-arg))
1069 1))))
1038 1070
1039 (defadvice find-file (before viper-add-suffix-advice activate) 1071 (defadvice find-file (before viper-add-suffix-advice activate)
1040 "Use `read-file-name' for reading arguments." 1072 "Use `read-file-name' for reading arguments."