]> code.delx.au - gnu-emacs/commitdiff
2005-08-06 Michael Kifer <kifer@cs.stonybrook.edu>
authorMichael Kifer <kifer@cs.stonybrook.edu>
Sat, 6 Aug 2005 16:58:54 +0000 (16:58 +0000)
committerMichael Kifer <kifer@cs.stonybrook.edu>
Sat, 6 Aug 2005 16:58:54 +0000 (16:58 +0000)
* 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\\".

lisp/ChangeLog
lisp/emulation/viper-cmd.el
lisp/emulation/viper-init.el
lisp/emulation/viper-util.el
lisp/emulation/viper.el
man/viper.texi

index 5548b8614c2ecb20631fa1e3e6a18b21e5c44a73..7550d1cd739a90e16fd4430e9815174a5dbe303f 100644 (file)
@@ -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)
index ce8b61fd022a5ed84c291b35461cfac13edd7efd..99a130e7f1d9bcae9eef6fe090e7a75075119740 100644 (file)
@@ -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
index 3c984a3596e250156991290f5faac475a396c7d9..9c1df1b0ad5304d3e2cd63e67ec3be426c238e7f 100644 (file)
@@ -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)
index 5bd67e1735f7dc571a73b4f234a8fe6e73e7674b..cc9f42b98006fdf63e54ef88cf05e69c5fad3e96 100644 (file)
        (setq lis2 (delq elt lis2)))
       (setq temp (cdr temp)))
 
-    (nconc lis1 lis2)))
+    (append lis1 lis2)))
 
 
 \f
index edc1fb1e9de5235112b620a9d74aea446601f239..52d0fefcd203d9ff492b4582a3b0c2a4dd38368b 100644 (file)
@@ -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))
index 0156c4c638745b8344044b6c30f0afd6d3be3484..6d05d365f8b0e4a8d6ca8e6b85bca3622907291b 100644 (file)
@@ -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