summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>2006-02-19 03:16:45 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>2006-02-19 03:16:45 +0000
commitb6178721d861731195f48fd80fc12214683eb8c6 (patch)
tree2bc6b0ee53bc59ab56550ca19c337b380d21f289 /lisp/emulation
parent803c30445df398079c245c837354c67528afd605 (diff)
2006-02-19 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-cmd.el (viper-insert-state-post-command-sentinel, viper-change-state-to-vi, viper-change-state-to-emacs): made aware of cursor coloring in the emacs state. (viper-special-read-and-insert-char): use read-char-exclusive. (viper-minibuffer-trim-tail): workaround for fields in minibuffer. * viper-init.el (viper-emacs-state-cursor-color): new variable. * viper-util.el (viper-save-cursor-color, viper-get-saved-cursor-color-in-replace-mode, viper-get-saved-cursor-color-in-insert-mode, viper-restore-cursor-color): make aware of the cursor color in emacs state. (viper-get-saved-cursor-color-in-emacs-mode): new function. * ediff-diff.el (ediff-ignore-case, ediff-ignore-case-option, ediff-ignore-case-option3, ediff-actual-diff-options, ediff-actual-diff3-options): new variables to control case sensitivity. (ediff-make-diff2-buffer, ediff-setup-fine-diff-regions, ediff-setup-diff-regions3): made aware of case-sensitivity. (ediff-toggle-ignore-case): new function. (ediff-extract-diffs, ediff-extract-diffs3): preserve point in buffers. * ediff-help.el (ediff-long-help-message-narrow2, ediff-long-help-message-compare2, ediff-long-help-message-compare3, ediff-long-help-message-word-mode): add ignore-case command. (ediff-help-for-quick-help): add ignore-case command. * ediff-merg.el: move provide to the end. * ediff-ptch.el: move provide to the end. * ediff-wind.el: move provide to the end. * ediff-mult.el: move provide to the end. (ediff-set-meta-overlay): enable follow-link. * ediff.el: move provide to the end. Break recursive load cycle in eval-when-compile. (ediff-patch-buffer): better heuristics. * ediff-util.el: move provide to the end. Break recursive load cycle in eval-when-compile. (ediff-setup-keymap): add binding for #c. Replaced some defsubsts with defuns. (ediff-submit-report): pass the values of ediff-diff3-program, ediff-diff3-options.
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 @@
(viper-save-cursor-color 'before-insert-mode))
;; set insert mode cursor color
(viper-change-cursor-color viper-insert-state-cursor-color)))
+ (if (eq viper-current-state 'emacs-state)
+ (let ((has-saved-cursor-color-in-emacs-mode
+ (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
+ (or has-saved-cursor-color-in-emacs-mode
+ (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
+ ;; save current color, if not already saved
+ (viper-save-cursor-color 'before-emacs-mode))
+ ;; set emacs mode cursor color
+ (viper-change-cursor-color viper-emacs-state-cursor-color)))
(if (and (memq this-command '(dabbrev-expand hippie-expand))
(integerp viper-pre-command-point)
@@ -643,9 +652,12 @@
(indent-to-left-margin))
(viper-add-newline-at-eob-if-necessary)
(viper-adjust-undo)
- (viper-change-state 'vi-state)
- (viper-restore-cursor-color 'after-insert-mode)
+ (if (eq viper-current-state 'emacs-state)
+ (viper-restore-cursor-color 'after-emacs-mode)
+ (viper-restore-cursor-color 'after-insert-mode))
+
+ (viper-change-state 'vi-state)
;; Protect against user errors in hooks
(condition-case conds
@@ -709,9 +721,17 @@
(or (viper-overlay-p viper-replace-overlay)
(viper-set-replace-overlay (point-min) (point-min)))
(viper-hide-replace-overlay)
+
+ (let ((has-saved-cursor-color-in-emacs-mode
+ (stringp (viper-get-saved-cursor-color-in-emacs-mode))))
+ (or has-saved-cursor-color-in-emacs-mode
+ (string= (viper-get-cursor-color) viper-emacs-state-cursor-color)
+ (viper-save-cursor-color 'before-emacs-mode))
+ (viper-change-cursor-color viper-emacs-state-cursor-color))
+
(viper-change-state 'emacs-state)
- ;; Protect agains user errors in hooks
+ ;; Protect against user errors in hooks
(condition-case conds
(run-hooks 'viper-emacs-state-hook)
(error
@@ -820,12 +840,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
;; The next cmd and viper-set-unread-command-events
;; are intended to prevent the input method
;; from swallowing ^M, ^Q and other special characters
- (setq ch (read-char))
+ (setq ch (read-char-exclusive))
;; replace ^M with the newline
(if (eq ch ?\C-m) (setq ch ?\n))
;; Make sure ^V and ^Q work as quotation chars
(if (memq ch '(?\C-v ?\C-q))
- (setq ch (read-char)))
+ (setq ch (read-char-exclusive)))
(viper-set-unread-command-events ch)
(quail-input-method nil)
@@ -842,12 +862,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
;; same as above but for XEmacs, which doesn't have
;; quail-input-method
(let (unread-command-events)
- (setq ch (read-char))
+ (setq ch (read-char-exclusive))
;; replace ^M with the newline
(if (eq ch ?\C-m) (setq ch ?\n))
;; Make sure ^V and ^Q work as quotation chars
(if (memq ch '(?\C-v ?\C-q))
- (setq ch (read-char)))
+ (setq ch (read-char-exclusive)))
(viper-set-unread-command-events ch)
(quail-start-translation nil)
@@ -867,12 +887,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(setq ch (aref (read-key-sequence nil) 0)))
(insert ch))
(t
- (setq ch (read-char))
+ (setq ch (read-char-exclusive))
;; replace ^M with the newline
(if (eq ch ?\C-m) (setq ch ?\n))
;; Make sure ^V and ^Q work as quotation chars
(if (memq ch '(?\C-v ?\C-q))
- (setq ch (read-char)))
+ (setq ch (read-char-exclusive)))
(insert ch))
)
(setq last-command-event
@@ -2131,7 +2151,7 @@ To turn this feature off, set this variable to nil."
Remove this function from `viper-minibuffer-exit-hook', if this causes
problems."
(if (viper-is-in-minibuffer)
- (progn
+ (let ((inhibit-field-text-motion t))
(goto-char (viper-minibuffer-real-start))
(end-of-line)
(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."
(if (fboundp 'make-variable-frame-local)
(make-variable-frame-local 'viper-insert-state-cursor-color))
+(defcustom viper-emacs-state-cursor-color "Magenta"
+ "Cursor color when Viper is in emacs state."
+ :type 'string
+ :group 'viper)
+(if (fboundp 'make-variable-frame-local)
+ (make-variable-frame-local 'viper-emacs-state-cursor-color))
+
;; internal var, used to remember the default cursor color of emacs frames
(defvar viper-vi-state-cursor-color nil)
(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 @@
(selected-frame)
(list
(cons
- (if (eq before-which-mode 'before-replace-mode)
- 'viper-saved-cursor-color-in-replace-mode
- 'viper-saved-cursor-color-in-insert-mode)
+ (cond ((eq before-which-mode 'before-replace-mode)
+ 'viper-saved-cursor-color-in-replace-mode)
+ ((eq before-which-mode 'before-emacs-mode)
+ 'viper-saved-cursor-color-in-emacs-mode)
+ (t
+ 'viper-saved-cursor-color-in-insert-mode))
color)))
))))
@@ -188,7 +191,9 @@
(if viper-emacs-p 'frame-parameter 'frame-property)
(selected-frame)
'viper-saved-cursor-color-in-replace-mode)
- viper-vi-state-cursor-color))
+ (if (eq viper-current-state 'emacs-mode)
+ viper-emacs-state-cursor-color
+ viper-vi-state-cursor-color)))
(defsubst viper-get-saved-cursor-color-in-insert-mode ()
(or
@@ -196,15 +201,27 @@
(if viper-emacs-p 'frame-parameter 'frame-property)
(selected-frame)
'viper-saved-cursor-color-in-insert-mode)
+ (if (eq viper-current-state 'emacs-mode)
+ viper-emacs-state-cursor-color
+ viper-vi-state-cursor-color)))
+
+(defsubst viper-get-saved-cursor-color-in-emacs-mode ()
+ (or
+ (funcall
+ (if viper-emacs-p 'frame-parameter 'frame-property)
+ (selected-frame)
+ 'viper-saved-cursor-color-in-emacs-mode)
viper-vi-state-cursor-color))
;; restore cursor color from replace overlay
(defun viper-restore-cursor-color(after-which-mode)
(if (viper-overlay-p viper-replace-overlay)
(viper-change-cursor-color
- (if (eq after-which-mode 'after-replace-mode)
- (viper-get-saved-cursor-color-in-replace-mode)
- (viper-get-saved-cursor-color-in-insert-mode))
+ (cond ((eq after-which-mode 'after-replace-mode)
+ (viper-get-saved-cursor-color-in-replace-mode))
+ ((eq after-which-mode 'after-emacs-mode)
+ (viper-get-saved-cursor-color-in-emacs-mode))
+ (t (viper-get-saved-cursor-color-in-insert-mode)))
)))
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 @@
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
;; Keywords: emulations
-(defconst viper-version "3.11.5 of November 25, 2005"
+(defconst viper-version "3.12 of February 18, 2006"
"The current version of Viper")
;; This file is part of GNU Emacs.