emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/emulation/viper.el,v


From: Chong Yidong
Subject: [Emacs-diffs] Changes to emacs/lisp/emulation/viper.el,v
Date: Wed, 21 Mar 2007 16:18:25 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      07/03/21 16:18:25

Index: viper.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emulation/viper.el,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -b -r1.100 -r1.101
--- viper.el    27 Jan 2007 23:18:37 -0000      1.100
+++ viper.el    21 Mar 2007 16:18:25 -0000      1.101
@@ -1027,14 +1027,46 @@
 
   (defadvice describe-key (before viper-describe-key-ad protect activate)
     "Force to read key via `viper-read-key-sequence'."
-    (interactive (list (viper-read-key-sequence "Describe key: "))
-                ))
+    (interactive (let (key)
+                  (setq key (viper-read-key-sequence
+                             "Describe key (or click or menu item): "))
+                  (list key
+                        (prefix-numeric-value current-prefix-arg)
+                        ;; If KEY is a down-event, read also the
+                        ;; corresponding up-event.
+                        (and (vectorp key)
+                             (let ((last-idx (1- (length key))))
+                               (and (eventp (aref key last-idx))
+                                    (memq 'down (event-modifiers
+                                                 (aref key last-idx)))))
+                             (or (and (eventp (aref key 0))
+                                      (memq 'down (event-modifiers
+                                                   (aref key 0)))
+                                      ;; For the C-down-mouse-2 popup
+                                      ;; menu, there is no subsequent up-event.
+                                      (= (length key) 1))
+                                 (and (> (length key) 1)
+                                      (eventp (aref key 1))
+                                      (memq 'down (event-modifiers (aref key 
1)))))
+                             (read-event))))))
 
   (defadvice describe-key-briefly
     (before viper-describe-key-briefly-ad protect activate)
     "Force to read key via `viper-read-key-sequence'."
-    (interactive (list (viper-read-key-sequence "Describe key briefly: "))))
-
+    (interactive (let (key)
+                  (setq key (viper-read-key-sequence
+                             "Describe key (or click or menu item): "))
+                  ;; If KEY is a down-event, read and discard the
+                  ;; corresponding up-event.
+                  (and (vectorp key)
+                       (let ((last-idx (1- (length key))))
+                         (and (eventp (aref key last-idx))
+                              (memq 'down (event-modifiers (aref key 
last-idx)))))
+                       (read-event))
+                  (list key
+                        (if current-prefix-arg
+                            (prefix-numeric-value current-prefix-arg))
+                        1))))
 
   (defadvice find-file (before viper-add-suffix-advice activate)
     "Use `read-file-name' for reading arguments."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]