comparison lisp/emulation/viper.el @ 90201:fbb2bea03df9

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-69 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 474-484) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 88-91) - Merge from emacs--cvs-trunk--0 - Update FSF's address in GPL notices - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 14 Jul 2005 08:02:00 +0000
parents f9a65d7ebd29 a4c59075cac8
children edf295560b5a
comparison
equal deleted inserted replaced
90200:f9a65d7ebd29 90201:fbb2bea03df9
6 ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 2005 Free Software Foundation, Inc. 6 ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 2005 Free Software Foundation, Inc.
7 7
8 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> 8 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
9 ;; Keywords: emulations 9 ;; Keywords: emulations
10 10
11 (defconst viper-version "3.11.4 of February 19, 2005" 11 (defconst viper-version "3.11.5 of July 8, 2005"
12 "The current version of Viper") 12 "The current version of Viper")
13 13
14 ;; This file is part of GNU Emacs. 14 ;; This file is part of GNU Emacs.
15 15
16 ;; GNU Emacs is free software; you can redistribute it and/or modify 16 ;; GNU Emacs is free software; you can redistribute it and/or modify
318 (load "viper-cmd.el" nil nil 'nosuffix)) 318 (load "viper-cmd.el" nil nil 'nosuffix))
319 ))) 319 )))
320 ;; end pacifier 320 ;; end pacifier
321 321
322 (require 'viper-init) 322 (require 'viper-init)
323 (require 'viper-keym)
323 324
324 ;; better be defined before Viper custom group. 325 ;; better be defined before Viper custom group.
325 (defvar viper-custom-file-name (convert-standard-filename "~/.viper") 326 (defvar viper-custom-file-name (convert-standard-filename "~/.viper")
326 "Viper customisation file. 327 "Viper customisation file.
327 If set by the user, this must be done _before_ Viper is loaded in `~/.emacs'.") 328 If set by the user, this must be done _before_ Viper is loaded in `~/.emacs'.")
689 ;; deactivate all advices done by Viper. 690 ;; deactivate all advices done by Viper.
690 (ad-deactivate-regexp "viper-") 691 (ad-deactivate-regexp "viper-")
691 692
692 (setq viper-mode nil) 693 (setq viper-mode nil)
693 694
695 (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
696 (setq emulation-mode-map-alists
697 (delq 'viper--intercept-key-maps
698 (delq 'viper--key-maps emulation-mode-map-alists))
699 ))
700
694 (viper-delocalize-var 'viper-vi-minibuffer-minor-mode) 701 (viper-delocalize-var 'viper-vi-minibuffer-minor-mode)
695 (viper-delocalize-var 'viper-insert-minibuffer-minor-mode) 702 (viper-delocalize-var 'viper-insert-minibuffer-minor-mode)
696 (viper-delocalize-var 'viper-vi-intercept-minor-mode) 703 (viper-delocalize-var 'viper-vi-intercept-minor-mode)
697 (viper-delocalize-var 'viper-insert-intercept-minor-mode) 704 (viper-delocalize-var 'viper-insert-intercept-minor-mode)
698 705
872 "passwd" 879 "passwd"
873 '(defadvice read-passwd-1 (before viper-passwd-ad activate) 880 '(defadvice read-passwd-1 (before viper-passwd-ad activate)
874 "Switch to emacs state while reading password." 881 "Switch to emacs state while reading password."
875 (viper-change-state-to-emacs))) 882 (viper-change-state-to-emacs)))
876 883
884 (defadvice self-insert-command (around viper-self-insert-ad activate)
885 "Ignore all self-inserting keys in the vi-state."
886 (if (and (eq viper-current-state 'vi-state) (interactive-p))
887 (beep 1)
888 ad-do-it
889 ))
890
891 (when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
892 ;; needs to be as early as possible
893 (add-to-ordered-list
894 'emulation-mode-map-alists 'viper--intercept-key-maps 100)
895 ;; needs to be after cua-mode
896 (add-to-ordered-list 'emulation-mode-map-alists 'viper--key-maps 500)
897 )
898
877 ;; Emacs shell, ange-ftp, and comint-based modes 899 ;; Emacs shell, ange-ftp, and comint-based modes
878 (add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint 900 (add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint
901
902 (add-hook 'eshell-mode-hook
903 (lambda () (setq viper-auto-indent nil)))
879 904
880 (viper-set-emacs-state-searchstyle-macros nil 'dired-mode) ; dired 905 (viper-set-emacs-state-searchstyle-macros nil 'dired-mode) ; dired
881 (viper-set-emacs-state-searchstyle-macros nil 'tar-mode) ; tar 906 (viper-set-emacs-state-searchstyle-macros nil 'tar-mode) ; tar
882 (viper-set-emacs-state-searchstyle-macros nil 'mh-folder-mode) ; mhe 907 (viper-set-emacs-state-searchstyle-macros nil 'mh-folder-mode) ; mhe
883 (viper-set-emacs-state-searchstyle-macros nil 'gnus-group-mode) ; gnus 908 (viper-set-emacs-state-searchstyle-macros nil 'gnus-group-mode) ; gnus
1056 This may be needed if the previous `:map' command terminated abnormally." 1081 This may be needed if the previous `:map' command terminated abnormally."
1057 (define-key viper-vi-intercept-map "\C-x)" nil) 1082 (define-key viper-vi-intercept-map "\C-x)" nil)
1058 (define-key viper-insert-intercept-map "\C-x)" nil) 1083 (define-key viper-insert-intercept-map "\C-x)" nil)
1059 (define-key viper-emacs-intercept-map "\C-x)" nil)) 1084 (define-key viper-emacs-intercept-map "\C-x)" nil))
1060 1085
1086 (defadvice add-minor-mode (after
1087 viper-advice-add-minor-mode
1088 (toggle name &optional keymap after toggle-fun)
1089 activate)
1090 "Run viper-normalize-minor-mode-map-alist after adding a minor mode."
1091 (viper-normalize-minor-mode-map-alist)
1092 (setq-default minor-mode-map-alist minor-mode-map-alist))
1093
1061 ;; catch frame switching event 1094 ;; catch frame switching event
1062 (if (viper-window-display-p) 1095 (if (viper-window-display-p)
1063 (if viper-xemacs-p 1096 (if viper-xemacs-p
1064 (add-hook 'mouse-leave-frame-hook 1097 (add-hook 'mouse-leave-frame-hook
1065 'viper-remember-current-frame) 1098 'viper-remember-current-frame)