mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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\\".
This commit is contained in:
parent
c51af44639
commit
3868558380
6 changed files with 82 additions and 29 deletions
|
|
@ -1,3 +1,24 @@
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -942,8 +942,10 @@ Suffixes such as .el or .elc should be stripped."
|
|||
|
||||
;; 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)))
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -1421,7 +1423,8 @@ as a Meta key and any number of multiple escapes is allowed."
|
|||
(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
|
||||
|
|
@ -1447,7 +1450,8 @@ as a Meta key and any number of multiple escapes is allowed."
|
|||
(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)))
|
||||
|
|
@ -1472,7 +1476,8 @@ as a Meta key and any number of multiple escapes is allowed."
|
|||
(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
|
||||
|
|
@ -1496,7 +1501,8 @@ as a Meta key and any number of multiple escapes is allowed."
|
|||
(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))
|
||||
|
||||
|
|
@ -4020,8 +4026,9 @@ Null string will repeat previous search."
|
|||
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
|
||||
|
|
@ -4062,8 +4069,9 @@ Null string will repeat previous search."
|
|||
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
|
||||
|
|
|
|||
|
|
@ -424,13 +424,20 @@ delete the text being replaced, as in standard Vi."
|
|||
"*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)
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@
|
|||
(setq lis2 (delq elt lis2)))
|
||||
(setq temp (cdr temp)))
|
||||
|
||||
(nconc lis1 lis2)))
|
||||
(append lis1 lis2)))
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -372,7 +372,6 @@ widget."
|
|||
(defcustom viper-vi-state-mode-list
|
||||
'(fundamental-mode
|
||||
makefile-mode
|
||||
help-mode
|
||||
|
||||
awk-mode
|
||||
m4-mode
|
||||
|
|
@ -398,7 +397,7 @@ widget."
|
|||
tex-mode latex-mode bibtex-mode
|
||||
ps-mode
|
||||
|
||||
completion-list-mode
|
||||
;; completion-list-mode
|
||||
diff-mode
|
||||
idl-mode
|
||||
|
||||
|
|
@ -433,6 +432,9 @@ widget."
|
|||
gnus-group-mode
|
||||
gnus-summary-mode
|
||||
|
||||
completion-list-mode
|
||||
help-mode
|
||||
|
||||
Info-mode
|
||||
Buffer-menu-mode
|
||||
compilation-mode
|
||||
|
|
@ -523,7 +525,7 @@ If Viper is enabled, turn it off. Otherwise, turn it on."
|
|||
|
||||
;;;###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
|
||||
|
|
@ -656,8 +658,7 @@ This function tries to do as good a job as possible. However, it may undo some
|
|||
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
|
||||
|
|
@ -683,7 +684,9 @@ remains buffer-local."
|
|||
'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))
|
||||
|
||||
|
|
@ -889,6 +892,14 @@ remains buffer-local."
|
|||
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
|
||||
|
|
@ -993,7 +1004,10 @@ remains buffer-local."
|
|||
;; 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"))
|
||||
|
|
@ -1088,9 +1102,11 @@ remains buffer-local."
|
|||
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)
|
||||
|
|
@ -1264,11 +1280,10 @@ These two lines must come in the order given.
|
|||
(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
|
||||
|
|
@ -1296,7 +1311,10 @@ These two lines must come in the order given.
|
|||
(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))
|
||||
|
|
|
|||
|
|
@ -507,9 +507,8 @@ modes designed for editing files, such as cc-mode or latex-mode, use key
|
|||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue