aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kifer2007-06-14 18:10:46 +0000
committerMichael Kifer2007-06-14 18:10:46 +0000
commit0ce61b6f9bcbec18f9cf061ebd75965f3b077eed (patch)
treeefc15e000a2fa91b87955bd7f24380a74690e8a5
parent03b85f661aa72c17762857f57bf6d43b96f1a206 (diff)
downloademacs-0ce61b6f9bcbec18f9cf061ebd75965f3b077eed.tar.gz
emacs-0ce61b6f9bcbec18f9cf061ebd75965f3b077eed.zip
2007-06-14 Michael Kifer <kifer@cs.stonybrook.edu>
* viper.el (viper-describe-key-ad, viper-describe-key-briefly-ad): different advices for Emacs and XEmacs. Compile them conditionally. (viper-version): belated version change.
-rw-r--r--etc/ChangeLog6
-rw-r--r--lisp/emulation/viper.el101
2 files changed, 64 insertions, 43 deletions
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 49028bdf691..c5e2a60c53e 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,9 @@
12007-06-14 Michael Kifer <kifer@cs.stonybrook.edu>
2
3 * viper.el (viper-describe-key-ad, viper-describe-key-briefly-ad):
4 different advices for Emacs and XEmacs. Compile them conditionally.
5 (viper-version): belated version change.
6
12007-06-14 Nick Roberts <nickrob@snap.net.nz> 72007-06-14 Nick Roberts <nickrob@snap.net.nz>
2 8
3 * NEWS: Mention mouse highlighting in a GNU/Linux console. 9 * NEWS: Mention mouse highlighting in a GNU/Linux console.
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 3cc8974248c..a42e7f1eb91 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -9,7 +9,7 @@
9;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 9;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
10;; Keywords: emulations 10;; Keywords: emulations
11 11
12(defconst viper-version "3.13.1 of October 23, 2006" 12(defconst viper-version "3.14 of June 14, 2007"
13 "The current version of Viper") 13 "The current version of Viper")
14 14
15;; This file is part of GNU Emacs. 15;; This file is part of GNU Emacs.
@@ -1026,48 +1026,63 @@ It also can't undo some Viper settings."
1026 (setq global-mode-string 1026 (setq global-mode-string
1027 (append '("" viper-mode-string) (cdr global-mode-string)))) 1027 (append '("" viper-mode-string) (cdr global-mode-string))))
1028 1028
1029 (defadvice describe-key (before viper-describe-key-ad protect activate) 1029 (viper-cond-compile-for-xemacs-or-emacs
1030 "Force to read key via `viper-read-key-sequence'." 1030 ;; XEmacs
1031 (interactive (let (key) 1031 (defadvice describe-key (before viper-describe-key-ad protect activate)
1032 (setq key (viper-read-key-sequence 1032 "Force to read key via `viper-read-key-sequence'."
1033 "Describe key (or click or menu item): ")) 1033 (interactive (list (viper-read-key-sequence "Describe key: "))))
1034 (list key 1034 ;; Emacs
1035 (prefix-numeric-value current-prefix-arg) 1035 (defadvice describe-key (before viper-describe-key-ad protect activate)
1036 ;; If KEY is a down-event, read also the 1036 "Force to read key via `viper-read-key-sequence'."
1037 ;; corresponding up-event. 1037 (interactive (let (key)
1038 (and (vectorp key) 1038 (setq key (viper-read-key-sequence
1039 (let ((last-idx (1- (length key)))) 1039 "Describe key (or click or menu item): "))
1040 (and (eventp (aref key last-idx)) 1040 (list key
1041 (memq 'down (event-modifiers 1041 (prefix-numeric-value current-prefix-arg)
1042 (aref key last-idx))))) 1042 ;; If KEY is a down-event, read also the
1043 (or (and (eventp (aref key 0)) 1043 ;; corresponding up-event.
1044 (memq 'down (event-modifiers 1044 (and (vectorp key)
1045 (aref key 0))) 1045 (let ((last-idx (1- (length key))))
1046 ;; For the C-down-mouse-2 popup 1046 (and (eventp (aref key last-idx))
1047 ;; menu, there is no subsequent up-event. 1047 (memq 'down (event-modifiers
1048 (= (length key) 1)) 1048 (aref key last-idx)))))
1049 (and (> (length key) 1) 1049 (or (and (eventp (aref key 0))
1050 (eventp (aref key 1)) 1050 (memq 'down (event-modifiers
1051 (memq 'down (event-modifiers (aref key 1))))) 1051 (aref key 0)))
1052 (read-event)))))) 1052 ;; For the C-down-mouse-2 popup menu,
1053 1053 ;; there is no subsequent up-event
1054 (defadvice describe-key-briefly 1054 (= (length key) 1))
1055 (before viper-describe-key-briefly-ad protect activate) 1055 (and (> (length key) 1)
1056 "Force to read key via `viper-read-key-sequence'." 1056 (eventp (aref key 1))
1057 (interactive (let (key) 1057 (memq 'down (event-modifiers (aref key 1)))))
1058 (setq key (viper-read-key-sequence 1058 (read-event))))))
1059 "Describe key (or click or menu item): ")) 1059 ) ; viper-cond-compile-for-xemacs-or-emacs
1060 ;; If KEY is a down-event, read and discard the 1060
1061 ;; corresponding up-event. 1061 (viper-cond-compile-for-xemacs-or-emacs
1062 (and (vectorp key) 1062 ;; XEmacs
1063 (let ((last-idx (1- (length key)))) 1063 (defadvice describe-key-briefly
1064 (and (eventp (aref key last-idx)) 1064 (before viper-describe-key-briefly-ad protect activate)
1065 (memq 'down (event-modifiers (aref key last-idx))))) 1065 "Force to read key via `viper-read-key-sequence'."
1066 (read-event)) 1066 (interactive (list (viper-read-key-sequence "Describe key briefly: "))))
1067 (list key 1067 ;; Emacs
1068 (if current-prefix-arg 1068 (defadvice describe-key-briefly
1069 (prefix-numeric-value current-prefix-arg)) 1069 (before viper-describe-key-briefly-ad protect activate)
1070 1)))) 1070 "Force to read key via `viper-read-key-sequence'."
1071 (interactive (let (key)
1072 (setq key (viper-read-key-sequence
1073 "Describe key (or click or menu item): "))
1074 ;; If KEY is a down-event, read and discard the
1075 ;; corresponding up-event.
1076 (and (vectorp key)
1077 (let ((last-idx (1- (length key))))
1078 (and (eventp (aref key last-idx))
1079 (memq 'down (event-modifiers (aref key last-idx)))))
1080 (read-event))
1081 (list key
1082 (if current-prefix-arg
1083 (prefix-numeric-value current-prefix-arg))
1084 1))))
1085 ) ;; viper-cond-compile-for-xemacs-or-emacs
1071 1086
1072 (defadvice find-file (before viper-add-suffix-advice activate) 1087 (defadvice find-file (before viper-add-suffix-advice activate)
1073 "Use `read-file-name' for reading arguments." 1088 "Use `read-file-name' for reading arguments."