+2005-08-06 Michael Kifer <kifer@cs.stonybrook.edu>
+
+ * viper-cmd.el (viper-harness-minor-mode,viper-exec-delete,
+ viper-exec-yank,viper-put-back): don't display modification msg if in
+ the minibuffer.
+
+ * viper-init.el (viper-replace-overlay-cursor-color,
+ viper-insert-state-cursor-color,viper-vi-state-cursor-color): make
+ variables frame local.
+
+ * viper-util.el (viper-append-filter-alist): use append instead of
+ nconc.
+
+ * viper.el (viper-vi-state-mode-list,viper-emacs-state-mode-list): move
+ help-mode and completion-list-mode from the first list to the second.
+ (viper-mode): docstring.
+ (viper-go-away,viper-non-hook-settings): don't localize
+ minor-mode-alist in newer emacsen.
+ Add advice to set-cursor-color.
+ Don't bind "\C-c\\".
+
2005-08-06 Emilio C. Lopes <eclig@gmx.net>
* cmuscheme.el (scheme-trace-command, scheme-untrace-command)
;; Change the default for minor-mode-map-alist each time a harnessed minor
;; mode adds its own keymap to the a-list.
- (eval-after-load
- load-file '(setq-default minor-mode-map-alist minor-mode-map-alist))
+ (unless
+ (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
+ (eval-after-load
+ load-file '(setq-default minor-mode-map-alist minor-mode-map-alist)))
)
(if (eq last-command 'd-command) 'kill-region nil))
(setq chars-deleted (abs (- (point) viper-com-point)))
(if (> chars-deleted viper-change-notification-threshold)
- (message "Deleted %d characters" chars-deleted))
+ (unless (viper-is-in-minibuffer)
+ (message "Deleted %d characters" chars-deleted)))
(kill-region viper-com-point (point))
(setq this-command 'd-command)
(if viper-ex-style-motion
(if (eq last-command 'D-command) 'kill-region nil))
(setq lines-deleted (count-lines (point) viper-com-point))
(if (> lines-deleted viper-change-notification-threshold)
- (message "Deleted %d lines" lines-deleted))
+ (unless (viper-is-in-minibuffer)
+ (message "Deleted %d lines" lines-deleted)))
(kill-region (mark t) (point))
(if (eq m-com 'viper-line) (setq this-command 'D-command)))
(back-to-indentation)))
(copy-region-as-kill viper-com-point (point))
(setq chars-saved (abs (- (point) viper-com-point)))
(if (> chars-saved viper-change-notification-threshold)
- (message "Saved %d characters" chars-saved))
+ (unless (viper-is-in-minibuffer)
+ (message "Saved %d characters" chars-saved)))
(goto-char viper-com-point)))
;; save lines
(copy-region-as-kill (mark t) (point))
(setq lines-saved (count-lines (mark t) (point)))
(if (> lines-saved viper-change-notification-threshold)
- (message "Saved %d lines" lines-saved))))
+ (unless (viper-is-in-minibuffer)
+ (message "Saved %d lines" lines-saved)))))
(viper-deactivate-mark)
(goto-char viper-com-point))
lines-inserted (abs (count-lines (point) sv-point)))
(if (or (> chars-inserted viper-change-notification-threshold)
(> lines-inserted viper-change-notification-threshold))
- (message "Inserted %d character(s), %d line(s)"
- chars-inserted lines-inserted)))
+ (unless (viper-is-in-minibuffer)
+ (message "Inserted %d character(s), %d line(s)"
+ chars-inserted lines-inserted))))
;; Vi puts cursor on the last char when the yanked text doesn't contain a
;; newline; it leaves the cursor at the beginning when the text contains
;; a newline
lines-inserted (abs (count-lines (point) sv-point)))
(if (or (> chars-inserted viper-change-notification-threshold)
(> lines-inserted viper-change-notification-threshold))
- (message "Inserted %d character(s), %d line(s)"
- chars-inserted lines-inserted)))
+ (unless (viper-is-in-minibuffer)
+ (message "Inserted %d character(s), %d line(s)"
+ chars-inserted lines-inserted))))
;; Vi puts cursor on the last char when the yanked text doesn't contain a
;; newline; it leaves the cursor at the beginning when the text contains
;; a newline
"*Cursor color when Viper is in Replace state."
:type 'string
:group 'viper)
+(if (fboundp 'make-variable-frame-local)
+ (make-variable-frame-local 'viper-replace-overlay-cursor-color))
+
(defcustom viper-insert-state-cursor-color "Green"
"Cursor color when Viper is in insert state."
:type 'string
:group 'viper)
+(if (fboundp 'make-variable-frame-local)
+ (make-variable-frame-local 'viper-insert-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)
+ (make-variable-frame-local 'viper-vi-state-cursor-color))
(viper-deflocalvar viper-replace-overlay nil "")
(put 'viper-replace-overlay 'permanent-local t)
(setq lis2 (delq elt lis2)))
(setq temp (cdr temp)))
- (nconc lis1 lis2)))
+ (append lis1 lis2)))
\f
(defcustom viper-vi-state-mode-list
'(fundamental-mode
makefile-mode
- help-mode
awk-mode
m4-mode
tex-mode latex-mode bibtex-mode
ps-mode
- completion-list-mode
+ ;; completion-list-mode
diff-mode
idl-mode
gnus-group-mode
gnus-summary-mode
+ completion-list-mode
+ help-mode
+
Info-mode
Buffer-menu-mode
compilation-mode
;;;###autoload
(defun viper-mode ()
- "Turn on Viper emulation of Vi."
+ "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'."
(interactive)
(if (not noninteractive)
(progn
user customization, unrelated to Viper. For instance, if the user advised
`read-file-name', `describe-key', and some others, then this advice will be
undone.
-It also doesn't undo some Viper settings. For instance, `minor-mode-map-alist'
-remains buffer-local."
+It also can't undo some Viper settings."
(interactive)
;; restore non-viper vars
'mark-even-if-inactive viper-saved-non-viper-variables)))
;; Ideally, we would like to be able to de-localize local variables
- (viper-delocalize-var 'minor-mode-map-alist)
+ (unless
+ (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
+ (viper-delocalize-var 'minor-mode-map-alist))
(viper-delocalize-var 'require-final-newline)
(if viper-xemacs-p (viper-delocalize-var 'bar-cursor))
ad-do-it
))
+ (defadvice set-cursor-color (after viper-set-cursor-color-ad activate)
+ "Change cursor color in VI state."
+ ;;(setq viper-vi-state-cursor-color (ad-get-arg 0))
+ (modify-frame-parameters
+ (selected-frame)
+ (list (cons 'viper-vi-state-cursor-color (ad-get-arg 0))))
+ )
+
(when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
;; needs to be as early as possible
(add-to-ordered-list
;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
;; different keymaps for different buffers. Also, the keymaps associated
;; with viper-vi/insert-state-modifier-minor-mode can be different.
- (make-variable-buffer-local 'minor-mode-map-alist)
+ ;; ***This is needed only in case emulation-mode-map-alists is not defined
+ (unless
+ (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
+ (make-variable-buffer-local 'minor-mode-map-alist))
;; Viper changes the default mode-line-buffer-identification
(setq-default mode-line-buffer-identification '(" %b"))
viper-advice-add-minor-mode
(toggle name &optional keymap after toggle-fun)
activate)
- "Run viper-normalize-minor-mode-map-alist after adding a minor mode."
- (viper-normalize-minor-mode-map-alist)
- (setq-default minor-mode-map-alist minor-mode-map-alist))
+ "Run viper-normalize-minor-mode-map-alist after adding a minor mode."
+ (viper-normalize-minor-mode-map-alist)
+ (unless
+ (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
+ (setq-default minor-mode-map-alist minor-mode-map-alist)))
;; catch frame switching event
(if (viper-window-display-p)
(define-key
viper-emacs-intercept-map viper-toggle-key 'viper-change-state-to-vi)
+;;; Removed to avoid bad interaction with cua-mode.
;;; Escape from Emacs and Insert modes to Vi for one command
-(define-key
- viper-emacs-intercept-map "\C-c\\" 'viper-escape-to-vi)
-(define-key
- viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
+;;(define-key viper-emacs-intercept-map "\C-c\\" 'viper-escape-to-vi)
+;;(define-key viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
(if viper-mode
(setq-default viper-emacs-intercept-minor-mode t
(if (and viper-mode (eq viper-current-state 'emacs-state))
(progn
(viper-change-state-to-emacs)
- (setq-default minor-mode-map-alist minor-mode-map-alist)
+ (unless
+ (and (fboundp 'add-to-ordered-list)
+ (boundp 'emulation-mode-map-alists))
+ (setq-default minor-mode-map-alist minor-mode-map-alist))
))
(if (and viper-mode (this-major-mode-requires-vi-state major-mode))
sequences that begin with @kbd{C-x} and @kbd{C-c}.
There is also a key that lets you temporarily escape to Vi command state
-from Emacs or Insert states: typing @kbd{C-c \} will let you execute a
-single Vi command while staying in Viper's Emacs or Insert state.
-In Insert state, the same can also be achieved by typing @kbd{C-z}.
+from the Insert state: typing @kbd{C-z} will let you execute a
+single Vi command while staying in Viper's Insert state.
@node Vi State, Insert State, Emacs State, States in Viper