aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMiles Bader2006-02-22 06:54:10 +0000
committerMiles Bader2006-02-22 06:54:10 +0000
commitb434f199dbbc2694a69538ee95e5e583f6357f71 (patch)
treeea87d2540063659d9cfdb24462bb4c0336a6ec47 /lisp/emulation
parent9d826e0eaf8a4e2f1cf5aac74d6b02ccc393af8d (diff)
parenta1b24e137f75b9f5fdbd5526947a70c462c5e5bf (diff)
downloademacs-b434f199dbbc2694a69538ee95e5e583f6357f71.tar.gz
emacs-b434f199dbbc2694a69538ee95e5e583f6357f71.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-21
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 97-112) - Update from CVS - Merge from erc--emacs--0 - Update from CVS: src/regex.c (extend_range_table_work_area): Fix typo. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 37) - Update from CVS
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-cmd.el40
-rw-r--r--lisp/emulation/viper-init.el7
-rw-r--r--lisp/emulation/viper-util.el31
-rw-r--r--lisp/emulation/viper.el2
4 files changed, 62 insertions, 18 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index db82952a6ef..645f4f26eaf 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -196,6 +196,15 @@
196 (viper-save-cursor-color 'before-insert-mode)) 196 (viper-save-cursor-color 'before-insert-mode))
197 ;; set insert mode cursor color 197 ;; set insert mode cursor color
198 (viper-change-cursor-color viper-insert-state-cursor-color))) 198 (viper-change-cursor-color viper-insert-state-cursor-color)))
199 (if (eq viper-current-state 'emacs-state)
200 (let ((has-saved-cursor-color-in-emacs-mode
201 (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
202 (or has-saved-cursor-color-in-emacs-mode
203 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
204 ;; save current color, if not already saved
205 (viper-save-cursor-color 'before-emacs-mode))
206 ;; set emacs mode cursor color
207 (viper-change-cursor-color viper-emacs-state-cursor-color)))
199 208
200 (if (and (memq this-command '(dabbrev-expand hippie-expand)) 209 (if (and (memq this-command '(dabbrev-expand hippie-expand))
201 (integerp viper-pre-command-point) 210 (integerp viper-pre-command-point)
@@ -643,9 +652,12 @@
643 (indent-to-left-margin)) 652 (indent-to-left-margin))
644 (viper-add-newline-at-eob-if-necessary) 653 (viper-add-newline-at-eob-if-necessary)
645 (viper-adjust-undo) 654 (viper-adjust-undo)
646 (viper-change-state 'vi-state)
647 655
648 (viper-restore-cursor-color 'after-insert-mode) 656 (if (eq viper-current-state 'emacs-state)
657 (viper-restore-cursor-color 'after-emacs-mode)
658 (viper-restore-cursor-color 'after-insert-mode))
659
660 (viper-change-state 'vi-state)
649 661
650 ;; Protect against user errors in hooks 662 ;; Protect against user errors in hooks
651 (condition-case conds 663 (condition-case conds
@@ -709,9 +721,17 @@
709 (or (viper-overlay-p viper-replace-overlay) 721 (or (viper-overlay-p viper-replace-overlay)
710 (viper-set-replace-overlay (point-min) (point-min))) 722 (viper-set-replace-overlay (point-min) (point-min)))
711 (viper-hide-replace-overlay) 723 (viper-hide-replace-overlay)
724
725 (let ((has-saved-cursor-color-in-emacs-mode
726 (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
727 (or has-saved-cursor-color-in-emacs-mode
728 (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
729 (viper-save-cursor-color 'before-emacs-mode))
730 (viper-change-cursor-color viper-emacs-state-cursor-color))
731
712 (viper-change-state 'emacs-state) 732 (viper-change-state 'emacs-state)
713 733
714 ;; Protect agains user errors in hooks 734 ;; Protect against user errors in hooks
715 (condition-case conds 735 (condition-case conds
716 (run-hooks 'viper-emacs-state-hook) 736 (run-hooks 'viper-emacs-state-hook)
717 (error 737 (error
@@ -820,12 +840,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
820 ;; The next cmd and viper-set-unread-command-events 840 ;; The next cmd and viper-set-unread-command-events
821 ;; are intended to prevent the input method 841 ;; are intended to prevent the input method
822 ;; from swallowing ^M, ^Q and other special characters 842 ;; from swallowing ^M, ^Q and other special characters
823 (setq ch (read-char)) 843 (setq ch (read-char-exclusive))
824 ;; replace ^M with the newline 844 ;; replace ^M with the newline
825 (if (eq ch ?\C-m) (setq ch ?\n)) 845 (if (eq ch ?\C-m) (setq ch ?\n))
826 ;; Make sure ^V and ^Q work as quotation chars 846 ;; Make sure ^V and ^Q work as quotation chars
827 (if (memq ch '(?\C-v ?\C-q)) 847 (if (memq ch '(?\C-v ?\C-q))
828 (setq ch (read-char))) 848 (setq ch (read-char-exclusive)))
829 (viper-set-unread-command-events ch) 849 (viper-set-unread-command-events ch)
830 (quail-input-method nil) 850 (quail-input-method nil)
831 851
@@ -842,12 +862,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
842 ;; same as above but for XEmacs, which doesn't have 862 ;; same as above but for XEmacs, which doesn't have
843 ;; quail-input-method 863 ;; quail-input-method
844 (let (unread-command-events) 864 (let (unread-command-events)
845 (setq ch (read-char)) 865 (setq ch (read-char-exclusive))
846 ;; replace ^M with the newline 866 ;; replace ^M with the newline
847 (if (eq ch ?\C-m) (setq ch ?\n)) 867 (if (eq ch ?\C-m) (setq ch ?\n))
848 ;; Make sure ^V and ^Q work as quotation chars 868 ;; Make sure ^V and ^Q work as quotation chars
849 (if (memq ch '(?\C-v ?\C-q)) 869 (if (memq ch '(?\C-v ?\C-q))
850 (setq ch (read-char))) 870 (setq ch (read-char-exclusive)))
851 (viper-set-unread-command-events ch) 871 (viper-set-unread-command-events ch)
852 (quail-start-translation nil) 872 (quail-start-translation nil)
853 873
@@ -867,12 +887,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
867 (setq ch (aref (read-key-sequence nil) 0))) 887 (setq ch (aref (read-key-sequence nil) 0)))
868 (insert ch)) 888 (insert ch))
869 (t 889 (t
870 (setq ch (read-char)) 890 (setq ch (read-char-exclusive))
871 ;; replace ^M with the newline 891 ;; replace ^M with the newline
872 (if (eq ch ?\C-m) (setq ch ?\n)) 892 (if (eq ch ?\C-m) (setq ch ?\n))
873 ;; Make sure ^V and ^Q work as quotation chars 893 ;; Make sure ^V and ^Q work as quotation chars
874 (if (memq ch '(?\C-v ?\C-q)) 894 (if (memq ch '(?\C-v ?\C-q))
875 (setq ch (read-char))) 895 (setq ch (read-char-exclusive)))
876 (insert ch)) 896 (insert ch))
877 ) 897 )
878 (setq last-command-event 898 (setq last-command-event
@@ -2131,7 +2151,7 @@ To turn this feature off, set this variable to nil."
2131Remove this function from `viper-minibuffer-exit-hook', if this causes 2151Remove this function from `viper-minibuffer-exit-hook', if this causes
2132problems." 2152problems."
2133 (if (viper-is-in-minibuffer) 2153 (if (viper-is-in-minibuffer)
2134 (progn 2154 (let ((inhibit-field-text-motion t))
2135 (goto-char (viper-minibuffer-real-start)) 2155 (goto-char (viper-minibuffer-real-start))
2136 (end-of-line) 2156 (end-of-line)
2137 (delete-region (point) (point-max))))) 2157 (delete-region (point) (point-max)))))
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 59a78e46dee..661fc6ede7f 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -434,6 +434,13 @@ delete the text being replaced, as in standard Vi."
434(if (fboundp 'make-variable-frame-local) 434(if (fboundp 'make-variable-frame-local)
435 (make-variable-frame-local 'viper-insert-state-cursor-color)) 435 (make-variable-frame-local 'viper-insert-state-cursor-color))
436 436
437(defcustom viper-emacs-state-cursor-color "Magenta"
438 "Cursor color when Viper is in emacs state."
439 :type 'string
440 :group 'viper)
441(if (fboundp 'make-variable-frame-local)
442 (make-variable-frame-local 'viper-emacs-state-cursor-color))
443
437;; internal var, used to remember the default cursor color of emacs frames 444;; internal var, used to remember the default cursor color of emacs frames
438(defvar viper-vi-state-cursor-color nil) 445(defvar viper-vi-state-cursor-color nil)
439(if (fboundp 'make-variable-frame-local) 446(if (fboundp 'make-variable-frame-local)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 8f79c0dab4a..c7fe792b5f2 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -175,9 +175,12 @@
175 (selected-frame) 175 (selected-frame)
176 (list 176 (list
177 (cons 177 (cons
178 (if (eq before-which-mode 'before-replace-mode) 178 (cond ((eq before-which-mode 'before-replace-mode)
179 'viper-saved-cursor-color-in-replace-mode 179 'viper-saved-cursor-color-in-replace-mode)
180 'viper-saved-cursor-color-in-insert-mode) 180 ((eq before-which-mode 'before-emacs-mode)
181 'viper-saved-cursor-color-in-emacs-mode)
182 (t
183 'viper-saved-cursor-color-in-insert-mode))
181 color))) 184 color)))
182 )))) 185 ))))
183 186
@@ -188,7 +191,9 @@
188 (if viper-emacs-p 'frame-parameter 'frame-property) 191 (if viper-emacs-p 'frame-parameter 'frame-property)
189 (selected-frame) 192 (selected-frame)
190 'viper-saved-cursor-color-in-replace-mode) 193 'viper-saved-cursor-color-in-replace-mode)
191 viper-vi-state-cursor-color)) 194 (if (eq viper-current-state 'emacs-mode)
195 viper-emacs-state-cursor-color
196 viper-vi-state-cursor-color)))
192 197
193(defsubst viper-get-saved-cursor-color-in-insert-mode () 198(defsubst viper-get-saved-cursor-color-in-insert-mode ()
194 (or 199 (or
@@ -196,15 +201,27 @@
196 (if viper-emacs-p 'frame-parameter 'frame-property) 201 (if viper-emacs-p 'frame-parameter 'frame-property)
197 (selected-frame) 202 (selected-frame)
198 'viper-saved-cursor-color-in-insert-mode) 203 'viper-saved-cursor-color-in-insert-mode)
204 (if (eq viper-current-state 'emacs-mode)
205 viper-emacs-state-cursor-color
206 viper-vi-state-cursor-color)))
207
208(defsubst viper-get-saved-cursor-color-in-emacs-mode ()
209 (or
210 (funcall
211 (if viper-emacs-p 'frame-parameter 'frame-property)
212 (selected-frame)
213 'viper-saved-cursor-color-in-emacs-mode)
199 viper-vi-state-cursor-color)) 214 viper-vi-state-cursor-color))
200 215
201;; restore cursor color from replace overlay 216;; restore cursor color from replace overlay
202(defun viper-restore-cursor-color(after-which-mode) 217(defun viper-restore-cursor-color(after-which-mode)
203 (if (viper-overlay-p viper-replace-overlay) 218 (if (viper-overlay-p viper-replace-overlay)
204 (viper-change-cursor-color 219 (viper-change-cursor-color
205 (if (eq after-which-mode 'after-replace-mode) 220 (cond ((eq after-which-mode 'after-replace-mode)
206 (viper-get-saved-cursor-color-in-replace-mode) 221 (viper-get-saved-cursor-color-in-replace-mode))
207 (viper-get-saved-cursor-color-in-insert-mode)) 222 ((eq after-which-mode 'after-emacs-mode)
223 (viper-get-saved-cursor-color-in-emacs-mode))
224 (t (viper-get-saved-cursor-color-in-insert-mode)))
208 ))) 225 )))
209 226
210 227
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 223cff3dd99..fc55d291550 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.11.5 of November 25, 2005" 12(defconst viper-version "3.12 of February 18, 2006"
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.