diff options
Diffstat (limited to 'lisp/emulation')
| -rw-r--r-- | lisp/emulation/viper-cmd.el | 23 | ||||
| -rw-r--r-- | lisp/emulation/viper-ex.el | 9 | ||||
| -rw-r--r-- | lisp/emulation/viper-macs.el | 16 | ||||
| -rw-r--r-- | lisp/emulation/viper-mous.el | 6 | ||||
| -rw-r--r-- | lisp/emulation/viper-util.el | 22 | ||||
| -rw-r--r-- | lisp/emulation/viper.el | 121 |
6 files changed, 98 insertions, 99 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el index a56c69e095b..26ae05c24fd 100644 --- a/lisp/emulation/viper-cmd.el +++ b/lisp/emulation/viper-cmd.el | |||
| @@ -1839,13 +1839,13 @@ invokes the command before that, etc." | |||
| 1839 | (concat "`" (viper-array-to-string keys) "'") | 1839 | (concat "`" (viper-array-to-string keys) "'") |
| 1840 | (viper-abbreviate-string | 1840 | (viper-abbreviate-string |
| 1841 | (if (featurep 'xemacs) | 1841 | (if (featurep 'xemacs) |
| 1842 | (replace-in-string ; xemacs | 1842 | (replace-in-string ; xemacs |
| 1843 | (cond ((characterp text) (char-to-string text)) | 1843 | (cond ((characterp text) (char-to-string text)) |
| 1844 | ((stringp text) text) | 1844 | ((stringp text) text) |
| 1845 | (t "")) | 1845 | (t "")) |
| 1846 | "\n" "^J") | 1846 | "\n" "^J") |
| 1847 | text ; emacs | 1847 | text ; emacs |
| 1848 | ) | 1848 | ) |
| 1849 | max-text-len | 1849 | max-text-len |
| 1850 | " inserting `" "'" " .......")) | 1850 | " inserting `" "'" " .......")) |
| 1851 | )) | 1851 | )) |
| @@ -2159,9 +2159,9 @@ To turn this feature off, set this variable to nil." | |||
| 2159 | (key-binding (setq key (read-key-sequence nil)))) | 2159 | (key-binding (setq key (read-key-sequence nil)))) |
| 2160 | (cond ((eq cmd 'self-insert-command) | 2160 | (cond ((eq cmd 'self-insert-command) |
| 2161 | (if (featurep 'xemacs) | 2161 | (if (featurep 'xemacs) |
| 2162 | (insert (events-to-keys key)) ; xemacs | 2162 | (insert (events-to-keys key)) ; xemacs |
| 2163 | (insert key) ; emacs | 2163 | (insert key) ; emacs |
| 2164 | )) | 2164 | )) |
| 2165 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) | 2165 | ((memq cmd '(exit-minibuffer viper-exit-minibuffer)) |
| 2166 | nil) | 2166 | nil) |
| 2167 | (t (command-execute cmd))) | 2167 | (t (command-execute cmd))) |
| @@ -3450,7 +3450,8 @@ controlled by the sign of prefix numeric value." | |||
| 3450 | ;; (which is called from viper-search-forward/backward/next). If the value of | 3450 | ;; (which is called from viper-search-forward/backward/next). If the value of |
| 3451 | ;; viper-search-scroll-threshold is negative - don't scroll. | 3451 | ;; viper-search-scroll-threshold is negative - don't scroll. |
| 3452 | (defun viper-adjust-window () | 3452 | (defun viper-adjust-window () |
| 3453 | (let ((win-height (if (featurep 'xemacs) (window-displayed-height) | 3453 | (let ((win-height (if (featurep 'xemacs) |
| 3454 | (window-displayed-height) | ||
| 3454 | (1- (window-height)))) ; adjust for modeline | 3455 | (1- (window-height)))) ; adjust for modeline |
| 3455 | (pt (point)) | 3456 | (pt (point)) |
| 3456 | at-top-p at-bottom-p | 3457 | at-top-p at-bottom-p |
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el index cd153bdaf91..af5780f0d72 100644 --- a/lisp/emulation/viper-ex.el +++ b/lisp/emulation/viper-ex.el | |||
| @@ -46,10 +46,8 @@ | |||
| 46 | ;; in order to spare non-viperized emacs from being viperized | 46 | ;; in order to spare non-viperized emacs from being viperized |
| 47 | (if noninteractive | 47 | (if noninteractive |
| 48 | (eval-when-compile | 48 | (eval-when-compile |
| 49 | (let ((load-path (cons (expand-file-name ".") load-path))) | 49 | (require 'viper-cmd) |
| 50 | (or (featurep 'viper-cmd) | 50 | )) |
| 51 | (load "viper-cmd.el" nil t 'nosuffix)) | ||
| 52 | ))) | ||
| 53 | ;; end pacifier | 51 | ;; end pacifier |
| 54 | 52 | ||
| 55 | (require 'viper-util) | 53 | (require 'viper-util) |
| @@ -2077,7 +2075,8 @@ Please contact your system administrator. " | |||
| 2077 | ;; create temp buffer for the region | 2075 | ;; create temp buffer for the region |
| 2078 | (setq temp-buf (get-buffer-create " *ex-write*")) | 2076 | (setq temp-buf (get-buffer-create " *ex-write*")) |
| 2079 | (set-buffer temp-buf) | 2077 | (set-buffer temp-buf) |
| 2080 | (if (featurep 'xemacs) (set-visited-file-name ex-file) | 2078 | (if (featurep 'xemacs) |
| 2079 | (set-visited-file-name ex-file) | ||
| 2081 | (set-visited-file-name ex-file 'noquery)) | 2080 | (set-visited-file-name ex-file 'noquery)) |
| 2082 | (erase-buffer) | 2081 | (erase-buffer) |
| 2083 | (if (and file-exists ex-append) | 2082 | (if (and file-exists ex-append) |
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el index a9e24f28e7b..448903da5c9 100644 --- a/lisp/emulation/viper-macs.el +++ b/lisp/emulation/viper-macs.el | |||
| @@ -38,10 +38,8 @@ | |||
| 38 | ;; in order to spare non-viperized emacs from being viperized | 38 | ;; in order to spare non-viperized emacs from being viperized |
| 39 | (if noninteractive | 39 | (if noninteractive |
| 40 | (eval-when-compile | 40 | (eval-when-compile |
| 41 | (let ((load-path (cons (expand-file-name ".") load-path))) | 41 | (require 'viper-cmd) |
| 42 | (or (featurep 'viper-cmd) | 42 | )) |
| 43 | (load "viper-cmd.el" nil t 'nosuffix)) | ||
| 44 | ))) | ||
| 45 | ;; end pacifier | 43 | ;; end pacifier |
| 46 | 44 | ||
| 47 | (require 'viper-util) | 45 | (require 'viper-util) |
| @@ -873,9 +871,13 @@ name from there." | |||
| 873 | (let ((lis (vector event)) | 871 | (let ((lis (vector event)) |
| 874 | next-event) | 872 | next-event) |
| 875 | (while (and (viper-fast-keysequence-p) | 873 | (while (and (viper-fast-keysequence-p) |
| 876 | (viper-keyseq-is-a-possible-macro lis macro-alist)) | 874 | (viper-keyseq-is-a-possible-macro lis macro-alist)) |
| 877 | (setq next-event (viper-read-key)) | 875 | ;; Seems that viper-read-event is more robust here. We need to be able to |
| 878 | ;;(setq next-event (viper-read-event)) | 876 | ;; place these events on unread-command-events list. If we use |
| 877 | ;; viper-read-key then events will be converted to keys, and sometimes | ||
| 878 | ;; (e.g., (control \[)) those keys differ from the corresponding events. | ||
| 879 | ;; So, do not use (setq next-event (viper-read-key)) | ||
| 880 | (setq next-event (viper-read-event)) | ||
| 879 | (or (viper-mouse-event-p next-event) | 881 | (or (viper-mouse-event-p next-event) |
| 880 | (setq lis (vconcat lis (vector next-event))))) | 882 | (setq lis (vconcat lis (vector next-event))))) |
| 881 | lis)) | 883 | lis)) |
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el index 1d60d1eb5ee..e7d2315b52b 100644 --- a/lisp/emulation/viper-mous.el +++ b/lisp/emulation/viper-mous.el | |||
| @@ -41,10 +41,8 @@ | |||
| 41 | ;; in order to spare non-viperized emacs from being viperized | 41 | ;; in order to spare non-viperized emacs from being viperized |
| 42 | (if noninteractive | 42 | (if noninteractive |
| 43 | (eval-when-compile | 43 | (eval-when-compile |
| 44 | (let ((load-path (cons (expand-file-name ".") load-path))) | 44 | (require 'viper-cmd) |
| 45 | (or (featurep 'viper-cmd) | 45 | )) |
| 46 | (load "viper-cmd.el" nil t 'nosuffix)) | ||
| 47 | ))) | ||
| 48 | ;; end pacifier | 46 | ;; end pacifier |
| 49 | 47 | ||
| 50 | (require 'viper-util) | 48 | (require 'viper-util) |
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el index c89823754fa..7410e05f7b4 100644 --- a/lisp/emulation/viper-util.el +++ b/lisp/emulation/viper-util.el | |||
| @@ -209,10 +209,9 @@ Otherwise return the normal value." | |||
| 209 | (if (featurep 'emacs) 'frame-parameter 'frame-property) | 209 | (if (featurep 'emacs) 'frame-parameter 'frame-property) |
| 210 | (selected-frame) | 210 | (selected-frame) |
| 211 | 'viper-saved-cursor-color-in-replace-mode) | 211 | 'viper-saved-cursor-color-in-replace-mode) |
| 212 | (let ((ecolor (viper-frame-value viper-emacs-state-cursor-color))) | 212 | (or (and (eq viper-current-state 'emacs-mode) |
| 213 | (or (and (eq viper-current-state 'emacs-mode) | 213 | (viper-frame-value viper-emacs-state-cursor-color)) |
| 214 | ecolor) | 214 | (viper-frame-value viper-vi-state-cursor-color)))) |
| 215 | (viper-frame-value viper-vi-state-cursor-color))))) | ||
| 216 | 215 | ||
| 217 | (defsubst viper-get-saved-cursor-color-in-insert-mode () | 216 | (defsubst viper-get-saved-cursor-color-in-insert-mode () |
| 218 | (or | 217 | (or |
| @@ -220,10 +219,9 @@ Otherwise return the normal value." | |||
| 220 | (if (featurep 'emacs) 'frame-parameter 'frame-property) | 219 | (if (featurep 'emacs) 'frame-parameter 'frame-property) |
| 221 | (selected-frame) | 220 | (selected-frame) |
| 222 | 'viper-saved-cursor-color-in-insert-mode) | 221 | 'viper-saved-cursor-color-in-insert-mode) |
| 223 | (let ((ecolor (viper-frame-value viper-emacs-state-cursor-color))) | 222 | (or (and (eq viper-current-state 'emacs-mode) |
| 224 | (or (and (eq viper-current-state 'emacs-mode) | 223 | (viper-frame-value viper-emacs-state-cursor-color)) |
| 225 | ecolor) | 224 | (viper-frame-value viper-vi-state-cursor-color)))) |
| 226 | (viper-frame-value viper-vi-state-cursor-color))))) | ||
| 227 | 225 | ||
| 228 | (defsubst viper-get-saved-cursor-color-in-emacs-mode () | 226 | (defsubst viper-get-saved-cursor-color-in-emacs-mode () |
| 229 | (or | 227 | (or |
| @@ -996,7 +994,7 @@ Otherwise return the normal value." | |||
| 996 | ;; This function lets function-key-map convert key sequences into logical | 994 | ;; This function lets function-key-map convert key sequences into logical |
| 997 | ;; keys. This does a better job than viper-read-event when it comes to kbd | 995 | ;; keys. This does a better job than viper-read-event when it comes to kbd |
| 998 | ;; macros, since it enables certain macros to be shared between X and TTY modes | 996 | ;; macros, since it enables certain macros to be shared between X and TTY modes |
| 999 | ;; by correctly mapping key sequences for Left/Right/... (one an ascii | 997 | ;; by correctly mapping key sequences for Left/Right/... (on an ascii |
| 1000 | ;; terminal) into logical keys left, right, etc. | 998 | ;; terminal) into logical keys left, right, etc. |
| 1001 | (defun viper-read-key () | 999 | (defun viper-read-key () |
| 1002 | (let ((overriding-local-map viper-overriding-map) | 1000 | (let ((overriding-local-map viper-overriding-map) |
| @@ -1206,9 +1204,9 @@ Otherwise return the normal value." | |||
| 1206 | 1204 | ||
| 1207 | (defun viper-key-press-events-to-chars (events) | 1205 | (defun viper-key-press-events-to-chars (events) |
| 1208 | (mapconcat (if (featurep 'xemacs) | 1206 | (mapconcat (if (featurep 'xemacs) |
| 1209 | (lambda (elt) (char-to-string (event-to-character elt))) ; xemacs | 1207 | (lambda (elt) (char-to-string (event-to-character elt))) ; xemacs |
| 1210 | 'char-to-string ; emacs | 1208 | 'char-to-string ; emacs |
| 1211 | ) | 1209 | ) |
| 1212 | events | 1210 | events |
| 1213 | "")) | 1211 | "")) |
| 1214 | 1212 | ||
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 0ca83ae6ec0..a3667aa5993 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el | |||
| @@ -597,13 +597,14 @@ This startup message appears whenever you load Viper, unless you type `y' now." | |||
| 597 | )) | 597 | )) |
| 598 | (viper-set-expert-level 'dont-change-unless))) | 598 | (viper-set-expert-level 'dont-change-unless))) |
| 599 | 599 | ||
| 600 | (if (eq major-mode 'viper-mode) | ||
| 601 | (setq major-mode 'fundamental-mode)) | ||
| 602 | |||
| 603 | (or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi | 600 | (or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi |
| 604 | (memq major-mode viper-insert-state-mode-list) ; don't switch | 601 | (memq major-mode viper-insert-state-mode-list) ; don't switch |
| 605 | (viper-change-state-to-vi)) | 602 | (viper-change-state-to-vi)) |
| 606 | ))) | 603 | )) |
| 604 | |||
| 605 | (if (eq major-mode 'viper-mode) | ||
| 606 | (setq major-mode 'fundamental-mode)) | ||
| 607 | ) | ||
| 607 | 608 | ||
| 608 | 609 | ||
| 609 | ;; Apply a little heuristic to invoke vi state on major-modes | 610 | ;; Apply a little heuristic to invoke vi state on major-modes |
| @@ -1023,63 +1024,63 @@ It also can't undo some Viper settings." | |||
| 1023 | (append '("" viper-mode-string) (cdr global-mode-string)))) | 1024 | (append '("" viper-mode-string) (cdr global-mode-string)))) |
| 1024 | 1025 | ||
| 1025 | (if (featurep 'xemacs) | 1026 | (if (featurep 'xemacs) |
| 1026 | ;; XEmacs | 1027 | ;; XEmacs |
| 1027 | (defadvice describe-key (before viper-describe-key-ad protect activate) | 1028 | (defadvice describe-key (before viper-describe-key-ad protect activate) |
| 1028 | "Force to read key via `viper-read-key-sequence'." | 1029 | "Force to read key via `viper-read-key-sequence'." |
| 1029 | (interactive (list (viper-read-key-sequence "Describe key: ")))) | 1030 | (interactive (list (viper-read-key-sequence "Describe key: ")))) |
| 1030 | ;; Emacs | 1031 | ;; Emacs |
| 1031 | (defadvice describe-key (before viper-describe-key-ad protect activate) | 1032 | (defadvice describe-key (before viper-describe-key-ad protect activate) |
| 1032 | "Force to read key via `viper-read-key-sequence'." | 1033 | "Force to read key via `viper-read-key-sequence'." |
| 1033 | (interactive (let (key) | 1034 | (interactive (let (key) |
| 1034 | (setq key (viper-read-key-sequence | 1035 | (setq key (viper-read-key-sequence |
| 1035 | "Describe key (or click or menu item): ")) | 1036 | "Describe key (or click or menu item): ")) |
| 1036 | (list key | 1037 | (list key |
| 1037 | (prefix-numeric-value current-prefix-arg) | 1038 | (prefix-numeric-value current-prefix-arg) |
| 1038 | ;; If KEY is a down-event, read also the | 1039 | ;; If KEY is a down-event, read also the |
| 1039 | ;; corresponding up-event. | 1040 | ;; corresponding up-event. |
| 1040 | (and (vectorp key) | 1041 | (and (vectorp key) |
| 1041 | (let ((last-idx (1- (length key)))) | 1042 | (let ((last-idx (1- (length key)))) |
| 1042 | (and (eventp (aref key last-idx)) | 1043 | (and (eventp (aref key last-idx)) |
| 1043 | (memq 'down (event-modifiers | 1044 | (memq 'down (event-modifiers |
| 1044 | (aref key last-idx))))) | 1045 | (aref key last-idx))))) |
| 1045 | (or (and (eventp (aref key 0)) | 1046 | (or (and (eventp (aref key 0)) |
| 1046 | (memq 'down (event-modifiers | 1047 | (memq 'down (event-modifiers |
| 1047 | (aref key 0))) | 1048 | (aref key 0))) |
| 1048 | ;; For the C-down-mouse-2 popup menu, | 1049 | ;; For the C-down-mouse-2 popup menu, |
| 1049 | ;; there is no subsequent up-event | 1050 | ;; there is no subsequent up-event |
| 1050 | (= (length key) 1)) | 1051 | (= (length key) 1)) |
| 1051 | (and (> (length key) 1) | 1052 | (and (> (length key) 1) |
| 1052 | (eventp (aref key 1)) | 1053 | (eventp (aref key 1)) |
| 1053 | (memq 'down (event-modifiers (aref key 1))))) | 1054 | (memq 'down (event-modifiers (aref key 1))))) |
| 1054 | (read-event)))))) | 1055 | (read-event)))))) |
| 1055 | ) ; (if (featurep 'xemacs) | 1056 | ) ; (if (featurep 'xemacs) |
| 1056 | 1057 | ||
| 1057 | (if (featurep 'xemacs) | 1058 | (if (featurep 'xemacs) |
| 1058 | ;; XEmacs | 1059 | ;; XEmacs |
| 1059 | (defadvice describe-key-briefly | 1060 | (defadvice describe-key-briefly |
| 1060 | (before viper-describe-key-briefly-ad protect activate) | 1061 | (before viper-describe-key-briefly-ad protect activate) |
| 1061 | "Force to read key via `viper-read-key-sequence'." | 1062 | "Force to read key via `viper-read-key-sequence'." |
| 1062 | (interactive (list (viper-read-key-sequence "Describe key briefly: ")))) | 1063 | (interactive (list (viper-read-key-sequence "Describe key briefly: ")))) |
| 1063 | ;; Emacs | 1064 | ;; Emacs |
| 1064 | (defadvice describe-key-briefly | 1065 | (defadvice describe-key-briefly |
| 1065 | (before viper-describe-key-briefly-ad protect activate) | 1066 | (before viper-describe-key-briefly-ad protect activate) |
| 1066 | "Force to read key via `viper-read-key-sequence'." | 1067 | "Force to read key via `viper-read-key-sequence'." |
| 1067 | (interactive (let (key) | 1068 | (interactive (let (key) |
| 1068 | (setq key (viper-read-key-sequence | 1069 | (setq key (viper-read-key-sequence |
| 1069 | "Describe key (or click or menu item): ")) | 1070 | "Describe key (or click or menu item): ")) |
| 1070 | ;; If KEY is a down-event, read and discard the | 1071 | ;; If KEY is a down-event, read and discard the |
| 1071 | ;; corresponding up-event. | 1072 | ;; corresponding up-event. |
| 1072 | (and (vectorp key) | 1073 | (and (vectorp key) |
| 1073 | (let ((last-idx (1- (length key)))) | 1074 | (let ((last-idx (1- (length key)))) |
| 1074 | (and (eventp (aref key last-idx)) | 1075 | (and (eventp (aref key last-idx)) |
| 1075 | (memq 'down (event-modifiers (aref key last-idx))))) | 1076 | (memq 'down (event-modifiers (aref key last-idx))))) |
| 1076 | (read-event)) | 1077 | (read-event)) |
| 1077 | (list key | 1078 | (list key |
| 1078 | (if current-prefix-arg | 1079 | (if current-prefix-arg |
| 1079 | (prefix-numeric-value current-prefix-arg)) | 1080 | (prefix-numeric-value current-prefix-arg)) |
| 1080 | 1)))) | 1081 | 1)))) |
| 1081 | ) ; (if (featurep 'xemacs) | 1082 | ) ; (if (featurep 'xemacs) |
| 1082 | 1083 | ||
| 1083 | (defadvice find-file (before viper-add-suffix-advice activate) | 1084 | (defadvice find-file (before viper-add-suffix-advice activate) |
| 1084 | "Use `read-file-name' for reading arguments." | 1085 | "Use `read-file-name' for reading arguments." |
| 1085 | (interactive (cons (read-file-name "Find file: " nil default-directory) | 1086 | (interactive (cons (read-file-name "Find file: " nil default-directory) |