X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/38685583801c774f1c17a32f02b29e426bdd0a96..380874900ca183ec2fdce91949d841328852d7a8:/lisp/emulation/viper.el diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el index 52d0fefcd2..223cff3dd9 100644 --- a/lisp/emulation/viper.el +++ b/lisp/emulation/viper.el @@ -4,12 +4,12 @@ ;; Viper Is also a Package for Emacs Rebels. ;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -;; 2003, 2004, 2005 Free Software Foundation, Inc. +;; 2003, 2004, 2005, 2006 Free Software Foundation, Inc. ;; Author: Michael Kifer ;; Keywords: emulations -(defconst viper-version "3.11.5 of July 8, 2005" +(defconst viper-version "3.11.5 of November 25, 2005" "The current version of Viper") ;; This file is part of GNU Emacs. @@ -425,10 +425,10 @@ widget." browse-kill-ring-mode recentf-mode + recentf-dialog-mode occur-mode mh-folder-mode - mail-mode gnus-group-mode gnus-summary-mode @@ -439,6 +439,10 @@ widget." Buffer-menu-mode compilation-mode + rcirc-mode + + jde-javadoc-checker-report-mode + view-mode vm-mode vm-summary-mode) @@ -454,6 +458,7 @@ unless it is coming up in a wrong Viper state." '(internal-ange-ftp-mode comint-mode inferior-emacs-lisp-mode + erc-mode eshell-mode shell-mode) "*A list of major modes that should come up in Vi Insert state." @@ -490,6 +495,8 @@ unless it is coming up in a wrong Viper state." (gnus-summary-mode emacs-state viper-gnus-modifier-map) (Info-mode emacs-state viper-slash-and-colon-map) (Buffer-menu-mode emacs-state viper-slash-and-colon-map) + (erc-mode insert-state viper-comint-mode-modifier-map) + (erc-mode vi-state viper-comint-mode-modifier-map) ) "List specifying how to modify the various major modes to enable some Viperisms. The list has the structure: ((mode viper-state keymap) (mode viper-state @@ -604,8 +611,6 @@ This startup message appears whenever you load Viper, unless you type `y' now." )) (viper-set-expert-level 'dont-change-unless))) - (if viper-xemacs-p - (make-variable-buffer-local 'bar-cursor)) (if (eq major-mode 'viper-mode) (setq major-mode 'fundamental-mode)) @@ -626,8 +631,8 @@ This startup message appears whenever you load Viper, unless you type `y' now." ;; This hook designed to enable Vi-style editing in comint-based modes." (defun viper-comint-mode-hook () - (setq require-final-newline nil - viper-ex-style-editing nil + (set (make-local-variable 'require-final-newline) nil) + (setq viper-ex-style-editing nil viper-ex-style-motion nil) (viper-change-state-to-insert)) @@ -766,8 +771,10 @@ It also can't undo some Viper settings." ;; remove all hooks set by viper (mapatoms 'viper-remove-hooks) (remove-hook 'comint-mode-hook 'viper-comint-mode-hook) + (remove-hook 'erc-mode-hook 'viper-comint-mode-hook) (remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel) (remove-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel) + (remove-hook 'post-command-hook 'viper-minibuffer-post-command-hook) ;; unbind Viper mouse bindings (viper-unbind-mouse-search-key) @@ -910,6 +917,7 @@ It also can't undo some Viper settings." ;; Emacs shell, ange-ftp, and comint-based modes (add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint + (add-hook 'erc-mode-hook 'viper-comint-mode-hook) ; ERC (add-hook 'eshell-mode-hook (lambda () (setq viper-auto-indent nil))) @@ -942,55 +950,55 @@ It also can't undo some Viper settings." ;; the advice. (eval-after-load "iso-acc" - (defadvice iso-accents-mode (around viper-iso-accents-advice activate) - "Set viper-automatic-iso-accents to iso-accents-mode." - (let ((arg (ad-get-arg 0))) - ad-do-it - (setq viper-automatic-iso-accents - (if (eq viper-current-state 'vi-state) - (if arg - ;; if iso-accents-mode was called with positive arg, turn - ;; accents on - (> (prefix-numeric-value arg) 0) - ;; else: toggle viper-automatic-iso-accents - (not viper-automatic-iso-accents)) - ;; other states: accept what iso-accents-mode has done - iso-accents-mode)) - ;; turn off ISO accents in vi-state - (if (eq viper-current-state 'vi-state) - (viper-set-iso-accents-mode nil)) - (if (memq viper-current-state '(vi-state insert-state replace-state)) - (message "Viper ISO accents mode: %s" - (if viper-automatic-iso-accents "on" "off"))) - ))) + '(defadvice iso-accents-mode (around viper-iso-accents-advice activate) + "Set viper-automatic-iso-accents to iso-accents-mode." + (let ((arg (ad-get-arg 0))) + ad-do-it + (setq viper-automatic-iso-accents + (if (eq viper-current-state 'vi-state) + (if arg + ;; if iso-accents-mode was called with positive arg, turn + ;; accents on + (> (prefix-numeric-value arg) 0) + ;; else: toggle viper-automatic-iso-accents + (not viper-automatic-iso-accents)) + ;; other states: accept what iso-accents-mode has done + iso-accents-mode)) + ;; turn off ISO accents in vi-state + (if (eq viper-current-state 'vi-state) + (viper-set-iso-accents-mode nil)) + (if (memq viper-current-state '(vi-state insert-state replace-state)) + (message "Viper ISO accents mode: %s" + (if viper-automatic-iso-accents "on" "off"))) + ))) ;; International input methods (if viper-emacs-p (eval-after-load "mule-cmds" - (progn - (defadvice inactivate-input-method (after viper-mule-advice activate) - "Set viper-special-input-method to disable intl. input methods." - (viper-inactivate-input-method-action)) - (defadvice activate-input-method (after viper-mule-advice activate) - "Set viper-special-input-method to enable intl. input methods." - (viper-activate-input-method-action)) - )) + '(progn + (defadvice inactivate-input-method (after viper-mule-advice activate) + "Set viper-special-input-method to disable intl. input methods." + (viper-inactivate-input-method-action)) + (defadvice activate-input-method (after viper-mule-advice activate) + "Set viper-special-input-method to enable intl. input methods." + (viper-activate-input-method-action)) + )) ;; XEmacs Although these hooks exist in Emacs, they don't seem to be always ;; called on input-method activation/deactivation, so we the above advise ;; functions instead. (eval-after-load "mule-cmds" - (progn - (add-hook 'input-method-activate-hook - 'viper-activate-input-method-action t) - (add-hook 'input-method-inactivate-hook - 'viper-inactivate-input-method-action t))) + '(progn + (add-hook 'input-method-activate-hook + 'viper-activate-input-method-action t) + (add-hook 'input-method-inactivate-hook + 'viper-inactivate-input-method-action t))) ) (eval-after-load "mule-cmds" - (defadvice toggle-input-method (around viper-mule-advice activate) - "Adjust input-method toggling in vi-state." - (if (and viper-special-input-method (eq viper-current-state 'vi-state)) - (viper-inactivate-input-method) - ad-do-it))) + '(defadvice toggle-input-method (around viper-mule-advice activate) + "Adjust input-method toggling in vi-state." + (if (and viper-special-input-method (eq viper-current-state 'vi-state)) + (viper-inactivate-input-method) + ad-do-it))) ) ; viper-set-hooks @@ -998,17 +1006,6 @@ It also can't undo some Viper settings." ;; these are primarily advices and Vi-ish variable settings (defun viper-non-hook-settings () - ;; This var is not local in Emacs, so we make it local. It must be local - ;; because although the stack of minor modes can be the same for all buffers, - ;; the associated *keymaps* can be different. In Viper, - ;; 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. - ;; ***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")) @@ -1016,8 +1013,6 @@ It also can't undo some Viper settings." (setq next-line-add-newlines nil require-final-newline t) - (make-variable-buffer-local 'require-final-newline) - ;; don't bark when mark is inactive (if viper-emacs-p (setq mark-even-if-inactive t)) @@ -1025,7 +1020,6 @@ It also can't undo some Viper settings." (setq scroll-step 1) ;; Variable displaying the current Viper state in the mode line. - (viper-deflocalvar viper-mode-string viper-emacs-state-id) (or (memq 'viper-mode-string global-mode-string) (setq global-mode-string (append '("" viper-mode-string) (cdr global-mode-string)))) @@ -1334,9 +1328,9 @@ These two lines must come in the order given. (provide 'viper) -;;; Local Variables: -;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun) -;;; End: +;; Local Variables: +;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun) +;; End: -;;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79 +;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79 ;;; viper.el ends here