annotate lisp/emulation/viper.el @ 18279:a9c40a80c9b1

(split-window-save-restore-data): New function that for view mode buffers saves information in view-return-to-alist. (split-window-vertically, split-window-horizontally): Call split-window-save-restore-data.
author Richard M. Stallman <rms@gnu.org>
date Tue, 17 Jun 1997 05:10:06 +0000
parents e145ccc61a22
children 3a43376db2be
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1 ;;; viper.el --- A full-featured Vi emulator for GNU Emacs 19 and XEmacs 19,
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
2 ;; a VI Plan for Emacs Rescue,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
3 ;; and a venomous VI PERil.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
4 ;; Viper Is also a Package for Emacs Rebels.
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
5 ;;
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
6 ;; Keywords: emulations
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
7 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
8
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
9 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
10
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
11 (defconst viper-version "2.94 of June 9, 1997"
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
12 "The current version of Viper")
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14014
diff changeset
13
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
14 ;; This file is part of GNU Emacs.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
15
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is free software; you can redistribute it and/or modify
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
17 ;; it under the terms of the GNU General Public License as published by
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
18 ;; the Free Software Foundation; either version 2, or (at your option)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
19 ;; any later version.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
20
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
21 ;; GNU Emacs is distributed in the hope that it will be useful,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
22 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
23 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
24 ;; GNU General Public License for more details.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
25
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
26 ;; You should have received a copy of the GNU General Public License
15742
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15739
diff changeset
27 ;; along with GNU Emacs; see the file COPYING. If not, write to the
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15739
diff changeset
28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15739
diff changeset
29 ;; Boston, MA 02111-1307, USA.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
30
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
31 ;;; Commentary:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
32
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
33 ;; Viper is a full-featured Vi emulator for Emacs 19. It emulates and
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
34 ;; improves upon the standard features of Vi and, at the same time, allows
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
35 ;; full access to all Emacs facilities. Viper supports multiple undo,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
36 ;; file name completion, command, file, and search history and it extends
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
37 ;; Vi in many other ways. Viper is highly customizable through the various
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
38 ;; hooks, user variables, and keymaps. It is implemented as a collection
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
39 ;; of minor modes and it is designed to provide full access to all Emacs
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
40 ;; major and minor modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
41 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
42 ;;; History
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
43 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
44 ;; Viper is a new name for a package formerly known as VIP-19,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
45 ;; which was a successor of VIP version 3.5 by Masahiko Sato
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
46 ;; <ms@sail.stanford.edu> and VIP version 4.2 by Aamod Sane
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
47 ;; <sane@cs.uiuc.edu>. Some ideas from vip 4.4.2 by Aamod Sane
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
48 ;; were also shamelessly plagiarized.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
49 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
50 ;; Viper maintains some degree of compatibility with these older
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
51 ;; packages. See the documentation for customization.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
52 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
53 ;; The main difference between Viper and these older packages are:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
54 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
55 ;; 1. Viper emulates Vi at several levels, from almost complete conformity
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
56 ;; to a rather loose Vi-compliance.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
57 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
58 ;; 2. Viper provides full access to all major and minor modes of Emacs
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
59 ;; without the need to type extra keys.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
60 ;; The older versions of VIP (and other Vi emulators) do not work with
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
61 ;; some major and minor modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
62 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
63 ;; 3. Viper supports vi-style undo.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
64 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
65 ;; 4. Viper fully emulates (and improves upon) vi's replacement mode.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
66 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
67 ;; 5. Viper has a better interface to ex, including command, variable, and
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
68 ;; file name completion.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
69 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
70 ;; 6. Viper uses native Emacs history and completion features; it doesn't
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
71 ;; rely on other packages (such as gmhist.el and completer.el) to provide
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
72 ;; these features.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
73 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
74 ;; 7. Viper supports Vi-style editing in the minibuffer, by allowing the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
75 ;; user to switch from Insert state to Vi state to Replace state, etc.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
76 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
77 ;; 8. Viper keeps history of recently inserted pieces of text and recently
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
78 ;; executed Vi-style destructive commands, such as `i', `d', etc.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
79 ;; These pieces of text can be inserted in later insertion commands;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
80 ;; the previous destructive commands can be re-executed.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
81 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
82 ;; 9. Viper has Vi-style keyboard macros, which enhances the similar
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
83 ;; facility in the original Vi.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
84 ;; First, one can execute any Emacs command while defining a
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
85 ;; macro, not just the Vi commands. Second, macros are defined in a
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
86 ;; WYSYWYG mode, using an interface to Emacs' WYSIWYG style of defining
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
87 ;; macros. Third, in Viper, one can define macros that are specific to
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
88 ;; a given buffer, a given major mode, or macros defined for all buffers.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
89 ;; The same macro name can have several different definitions:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
90 ;; one global, several definitions for various major modes, and
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
91 ;; definitions for specific buffers.
15739
822cfec0040c (vip-ms-style-os-p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 15480
diff changeset
92 ;; Buffer-specific definitions override mode-specific
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
93 ;; definitions, which, in turn, override global definitions.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
94 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
95 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
96 ;;; Installation:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
97 ;; -------------
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
98 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
99 ;; (require 'viper)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
100 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
101
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
102 ;;; Acknowledgements:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
103 ;; -----------------
15739
822cfec0040c (vip-ms-style-os-p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 15480
diff changeset
104 ;; Bug reports and ideas contributed by many users have helped
822cfec0040c (vip-ms-style-os-p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 15480
diff changeset
105 ;; improve Viper and the various versions of VIP.
12691
7bd050135516 (vip-info-file-name): variable removed.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12203
diff changeset
106 ;; See the on-line manual for a complete list of contributors.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
107 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
108 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
109 ;;; Notes:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
110 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
111 ;; 1. Major modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
112 ;; In most cases, Viper handles major modes correctly, i.e., they come up
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
113 ;; in the right state (either vi-state or emacs-state). For instance, text
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
114 ;; files come up in vi-state, while, say, Dired appears in emacs-state by
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
115 ;; default.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
116 ;; However, some modes do not appear in the right mode in the beginning,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
117 ;; usually because they neglect to follow Emacs conventions (e.g., they don't
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
118 ;; use kill-all-local-variables when they start). Some major modes
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
119 ;; may fail to come up in emacs-state if they call hooks, such as
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
120 ;; text-hook, for no good reason.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
121 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
122 ;; As an immediate solution, you can hit C-z to bring about the right mode.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
123 ;; An interim solution is to add an appropriate hook to the mode like this:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
124 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
125 ;; (add-hook 'your-favorite-mode 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
126 ;; or
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
127 ;; (add-hook 'your-favorite-mode 'vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
128 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
129 ;; whichever applies. The right thing to do, however, is to complain to the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
130 ;; author of the respective package. (Sometimes they also neglect to equip
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
131 ;; their modes with hooks, which is one more reason for complaining.)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
132 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
133 ;; 2. Keymap handling
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
134 ;; Because Emacs 19 has an elegant mechanism for turning minor mode keymaps
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
135 ;; on and off, implementation of Viper has been greatly simplified. Viper
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
136 ;; has several minor modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
137 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
138 ;; Viper's Vi state consists of seven minor modes:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
139 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
140 ;; vip-vi-intercept-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
141 ;; vip-vi-local-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
142 ;; vip-vi-global-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
143 ;; vip-vi-kbd-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
144 ;; vip-vi-state-modifier-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
145 ;; vip-vi-diehard-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
146 ;; vip-vi-basic-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
147 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
148 ;; Bindings done to the keymap of the first mode overshadow those done to
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
149 ;; the second, which, in turn, overshadows those done to the third, etc.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
150 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
151 ;; The last vip-vi-basic-minor-mode contains most of the usual Vi bindings
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
152 ;; in its edit mode. This mode provides access to all Emacs facilities.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
153 ;; Novice users, however, may want to set their vip-expert-level to 1
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
154 ;; in their .vip file. This will enable vip-vi-diehard-minor-mode. This
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
155 ;; minor mode's bindings make Viper simulate the usual Vi very closely.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
156 ;; For instance, C-c will not have its standard Emacs binding
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
157 ;; and so many of the goodies of Emacs are not available.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
158 ;;
15739
822cfec0040c (vip-ms-style-os-p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 15480
diff changeset
159 ;; A skilled user should set vip-expert-level to at least 3. This will
822cfec0040c (vip-ms-style-os-p): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents: 15480
diff changeset
160 ;; enable `C-c' and many Emacs facilities will become available.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
161 ;; In this case, vip-vi-diehard-minor-mode is inactive.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
162 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
163 ;; Viper gurus should have at least
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
164 ;; (setq vip-expert-level 4)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
165 ;; in their ~/.vip files. This will unsuppress all Emacs keys that are not
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
166 ;; essential for VI-style editing.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
167 ;; Pick-and-choose users may want to put
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
168 ;; (setq vip-expert-level 5)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
169 ;; in ~/.vip. Viper will then leave it up to the user to set the variables
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
170 ;; vip-want-* See vip-set-expert-level for details.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
171 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
172 ;; The very first minor mode, vip-vi-intercept-minor-mode, is of no
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
173 ;; concern for the user. It is needed to bind Viper's vital keys, such as
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
174 ;; ESC and C-z.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
175 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
176 ;; The second mode, vip-vi-local-user-minor-mode, usually has an
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
177 ;; empty keymap. However, the user can set bindings in this keymap, which
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
178 ;; will overshadow the corresponding bindings in the other two minor
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
179 ;; modes. This is useful, for example, for setting up ZZ in gnus,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
180 ;; rmail, mh-e, etc., to send message instead of saving it in a file.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
181 ;; Likewise, in Dired mode, you may want to bind ZN and ZP to commands
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
182 ;; that would visit the next or the previous file in the Dired buffer.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
183 ;; Setting local keys is tricky, so don't do it directly. Instead, use
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
184 ;; vip-add-local-keys function (see its doc).
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
185 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
186 ;; The third minor mode, vip-vi-global-user-minor-mode, is also intended
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
187 ;; for the users but, unlike vip-vi-local-user-minor-mode, its key
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
188 ;; bindings are seen in all Viper buffers. This mode keys can be done
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
189 ;; with define-key command.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
190 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
191 ;; The fourth minor mode, vip-vi-kbd-minor-mode, is used by keyboard
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
192 ;; macros. Users are NOT supposed to modify this keymap directly.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
193 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
194 ;; The fifth mode, vip-vi-state-modifier-minor-mode, can be used to set
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
195 ;; key bindings that are visible in some major modes but not in others.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
196 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
197 ;; Users are allowed to modify keymaps that belong to
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
198 ;; vip-vi-local-user-minor-mode, vip-vi-global-user-minor-mode,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
199 ;; and vip-vi-state-modifier-minor-mode only.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
200 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
201 ;; Viper's Insert state also has seven minor modes:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
202 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
203 ;; vip-insert-intercept-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
204 ;; vip-insert-local-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
205 ;; vip-insert-global-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
206 ;; vip-insert-kbd-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
207 ;; vip-insert-state-modifier-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
208 ;; vip-insert-diehard-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
209 ;; vip-insert-basic-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
210 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
211 ;; As with VI's editing modes, the first mode, vip-insert-intercept-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
212 ;; is used to bind vital keys that are not to be changed by the user.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
213 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
214 ;; The next mode, vip-insert-local-user-minor-mode, is used to customize
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
215 ;; bindings in the insert state of Viper. The third mode,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
216 ;; vip-insert-global-user-minor-mode is like
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
217 ;; vip-insert-local-user-minor-mode, except that its bindings are seen in
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
218 ;; all Viper buffers. As with vip-vi-local-user-minor-mode, its bindings
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
219 ;; should be done via the function vip-add-local-keys. Bindings for
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
220 ;; vip-insert-global-user-minor-mode can be set with the define-key command.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
221 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
222 ;; The next minor mode, vip-insert-kbd-minor-mode,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
223 ;; is used for keyboard VI-style macros defined with :map!.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
224 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
225 ;; The fifth minor mode, vip-insert-state-modifier-minor-mode, is like
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
226 ;; vip-vi-state-modifier-minor-mode, except that it is used in the Insert
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
227 ;; state; it can be used to modify keys in a mode-specific fashion.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
228 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
229 ;; The minor mode vip-insert-diehard-minor-mode is in effect when
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
230 ;; the user wants a high degree of Vi compatibility (a bad idea, really!).
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
231 ;; The last minor mode, vip-insert-basic-minor-mode, is always in effect
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
232 ;; when Viper is in insert state. It binds a small number of keys needed for
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
233 ;; Viper's operation.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
234 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
235 ;; Finally, Viper provides minor modes for overriding bindings set by Emacs
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
236 ;; modes when Viper is in Emacs state:
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
237 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
238 ;; vip-emacs-local-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
239 ;; vip-emacs-global-user-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
240 ;; vip-emacs-kbd-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
241 ;; vip-emacs-state-modifier-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
242 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
243 ;; These minor modes are in effect when Viper is in Emacs state. The keymap
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
244 ;; associated with vip-emacs-global-user-minor-mode,
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
245 ;; vip-emacs-global-user-map, overrides the global and local keymaps as
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
246 ;; well as the minor mode keymaps set by other modes. The keymap of
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
247 ;; vip-emacs-local-user-minor-mode, vip-emacs-local-user-map, overrides
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
248 ;; everything, but it is used on a per buffer basis.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
249 ;; The keymap associated with vip-emacs-state-modifier-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
250 ;; overrides keys on a per-major-mode basis. The mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
251 ;; vip-emacs-kbd-minor-mode is used to define Vi-style macros in Emacs
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
252 ;; state.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
253 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
254 ;; 3. There is also one minor mode that is used when Viper is in its
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
255 ;; replace-state (used for commands like cw, C, etc.). This mode is
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
256 ;; called
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
257 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
258 ;; vip-replace-minor-mode
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
259 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
260 ;; and its keymap is vip-replace-map. Replace minor mode is always
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
261 ;; used in conjunction with the minor modes for insert-state, and its
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
262 ;; keymap overshadows the keymaps for insert minor modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
263 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
264 ;; 4. Defining buffer-local bindings in Vi and Insert modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
265 ;; As mentioned before, sometimes, it is convenient to have
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
266 ;; buffer-specific of mode-specific key bindings in Vi and insert modes.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
267 ;; Viper provides a special function, vip-add-local-keys, to do precisely
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
268 ;; this. For instance, is you need to add couple of mode-specific bindings
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
269 ;; to Insert mode, you can put
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
270 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
271 ;; (vip-add-local-keys 'insert-state '((key1 . func1) (key2 .func2)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
272 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
273 ;; somewhere in a hook of this major mode. If you put something like this
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
274 ;; in your own elisp function, this will define bindings specific to the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
275 ;; buffer that was current at the time of the call to vip-add-local-keys.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
276 ;; The only thing to make sure here is that the major mode of this buffer
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
277 ;; is written according to Emacs conventions, which includes a call to
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
278 ;; (kill-all-local-variables). See vip-add-local-keys for more details.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
279 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
280 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
281 ;; TO DO (volunteers?):
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
282 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
283 ;; 1. Some of the code that is inherited from VIP-3.5 is rather
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
284 ;; convoluted. Instead of vip-command-argument, keymaps should bind the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
285 ;; actual commands. E.g., "dw" should be bound to a generic command
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
286 ;; vip-delete that will delete things based on the value of
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
287 ;; last-command-char. This would greatly simplify the logic and the code.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
288 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
289 ;; 2. Somebody should venture to write a customization package a la
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
290 ;; options.el that would allow the user to change values of variables
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
291 ;; that meet certain specs (e.g., match a regexp) and whose doc string
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
292 ;; starts with a '*'. Then, the user should be offered to save
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
293 ;; variables that were changed. This will make user's customization job
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
294 ;; much easier.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
295 ;;
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
296
14909
7ff1df13b124 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14734
diff changeset
297 ;; Code
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
298
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
299 (require 'advice)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
300 (require 'cl)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
301 (require 'ring)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
302
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
303 ;; compiler pacifier
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
304 (defvar mark-even-if-inactive)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
305
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
306 ;; loading happens only in non-interactive compilation
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
307 ;; in order to spare non-viperized emacs from being viperized
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
308 (if noninteractive
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
309 (eval-when-compile
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
310 (let ((load-path (cons (expand-file-name ".") load-path)))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
311 (or (featurep 'viper-cmd)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
312 (load "viper-cmd.el" nil nil 'nosuffix))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
313 )))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
314 ;; end pacifier
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
315
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
316 (require 'viper-cmd)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
317
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
318
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
319 ;; The following is provided for compatibility with older VIP's
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
320
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
321 (defalias 'vip-change-mode-to-vi 'vip-change-state-to-vi)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
322 (defalias 'vip-change-mode-to-insert 'vip-change-state-to-insert)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
323 (defalias 'vip-change-mode-to-emacs 'vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
324
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
325
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
326 ;;; Here we put things that may affect global emacs behavior.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
327 ;;; This file is not loaded during compilation, so this makes
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
328 ;;; interactive compilation of Viper safe for non-viper users.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
329
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
330
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
331 ;; This is not local in Emacs, so we make it local.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
332 ;; This must be local because although the stack of minor modes can be the same
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
333 ;; for all buffers, the associated *keymaps* can be different. In Viper,
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
334 ;; vip-vi-local-user-map, vip-insert-local-user-map, and others can have
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
335 ;; different keymaps for different buffers.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
336 ;; Also, the keymaps associated with vip-vi/insert-state-modifier-minor-mode
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
337 ;; can be different.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
338 (make-variable-buffer-local 'minor-mode-map-alist)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
339
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
340 ;; Viper changes the default mode-line-buffer-identification
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
341 (setq-default mode-line-buffer-identification '(" %b"))
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
342
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
343 ;; setup emacs-supported vi-style feel
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
344 (setq next-line-add-newlines nil
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
345 require-final-newline t)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
346
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
347 (make-variable-buffer-local 'require-final-newline)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
348
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
349 ;; don't bark when mark is inactive
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
350 (setq mark-even-if-inactive t)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
351
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
352 (setq scroll-step 1)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
353
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
354 ;; Variable displaying the current Viper state in the mode line.
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
355 (vip-deflocalvar vip-mode-string vip-emacs-state-id)
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
356 (or (memq 'vip-mode-string global-mode-string)
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
357 (setq global-mode-string
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
358 (append '("" vip-mode-string) (cdr global-mode-string))))
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
359
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
360
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
361
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
362
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
363 ;;; Load set up hooks then load .vip
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
364
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
365 ;; This hook designed to enable Vi-style editing in comint-based modes."
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
366 (defun vip-comint-mode-hook ()
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
367 (setq require-final-newline nil
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
368 vip-ex-style-editing-in-insert nil
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
369 vip-ex-style-motion nil)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
370 (vip-change-state-to-insert))
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
371
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
372
13214
bc4eeb585ff1 (vip-set-hooks): Use view-mode-hook in emacs and view
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12900
diff changeset
373 ;; This sets major mode hooks to make them come up in vi-state.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
374 (defun vip-set-hooks ()
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
375
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
376 ;; It is of course a misnomer to call viper-mode a `major mode'.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
377 ;; However, this has the effect that if the user didn't specify the
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
378 ;; default mode, new buffers that fall back on the default will come up
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
379 ;; in Fundamental Mode and Vi state.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
380 (setq default-major-mode 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
381
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
382 ;; The following major modes should come up in vi-state
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
383 (defadvice fundamental-mode (after vip-fundamental-mode-ad activate)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
384 "Run `vip-change-state-to-vi' on entry."
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
385 (vip-change-state-to-vi))
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
386
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
387 (defvar makefile-mode-hook)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
388 (add-hook 'makefile-mode-hook 'viper-mode)
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
389
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
390 (defvar help-mode-hook)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
391 (add-hook 'help-mode-hook 'viper-mode)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
392 (vip-modify-major-mode 'help-mode 'vi-state vip-help-modifier-map)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
393
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
394 (defvar awk-mode-hook)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
395 (add-hook 'awk-mode-hook 'viper-mode)
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
396
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
397 (defvar html-mode-hook)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
398 (add-hook 'html-mode-hook 'viper-mode)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
399 (defvar html-helper-mode-hook)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
400 (add-hook 'html-helper-mode-hook 'viper-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
401 (defvar java-mode-hook)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
402 (add-hook 'java-mode-hook 'viper-mode)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
403
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
404 (defvar emacs-lisp-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
405 (add-hook 'emacs-lisp-mode-hook 'viper-mode)
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
406
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
407 (defvar lisp-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
408 (add-hook 'lisp-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
409
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
410 (defvar bibtex-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
411 (add-hook 'bibtex-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
412
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
413 (defvar cc-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
414 (add-hook 'cc-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
415
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
416 (defvar c-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
417 (add-hook 'c-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
418
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
419 (defvar c++-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
420 (add-hook 'c++-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
421
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
422 (defvar lisp-interaction-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
423 (add-hook 'lisp-interaction-mode-hook 'viper-mode)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
424
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
425 (defvar fortran-mode-hook)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
426 (add-hook 'fortran-mode-hook 'vip-mode)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
427
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
428 (defvar basic-mode-hook)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
429 (add-hook 'basic-mode-hook 'vip-mode)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
430 (defvar bat-mode-hook)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
431 (add-hook 'bat-mode-hook 'vip-mode)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
432
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
433 (defvar text-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
434 (add-hook 'text-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
435
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
436 (add-hook 'completion-list-mode-hook 'viper-mode)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
437 (add-hook 'compilation-mode-hook 'viper-mode)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
438
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
439 (add-hook 'perl-mode-hook 'viper-mode)
14579
a81dd4e9603a *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14434
diff changeset
440 (add-hook 'tcl-mode-hook 'viper-mode)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
441
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
442 (defvar emerge-startup-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
443 (add-hook 'emerge-startup-hook 'vip-change-state-to-emacs)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
444
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
445 ;; Tell vc-diff to put *vc* in Vi mode
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
446 (if (featurep 'vc)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
447 (defadvice vc-diff (after vip-vc-ad activate)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
448 "Force Vi state in VC diff buffer."
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
449 (vip-change-state-to-vi))
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
450 (vip-eval-after-load
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
451 "vc"
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
452 '(defadvice vc-diff (after vip-vc-ad activate)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
453 "Force Vi state in VC diff buffer."
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
454 (vip-change-state-to-vi))))
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
455
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
456 (vip-eval-after-load
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
457 "emerge"
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
458 '(defadvice emerge-quit (after vip-emerge-advice activate)
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
459 "Run `vip-change-state-to-vi' after quitting emerge."
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
460 (vip-change-state-to-vi)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
461 ;; In case Emerge was loaded before Viper.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
462 (defadvice emerge-quit (after vip-emerge-advice activate)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
463 "Run `vip-change-state-to-vi' after quitting emerge."
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
464 (vip-change-state-to-vi))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
465
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
466 (vip-eval-after-load
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
467 "asm-mode"
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
468 '(defadvice asm-mode (after vip-asm-mode-ad activate)
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
469 "Run `vip-change-state-to-vi' on entry."
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
470 (vip-change-state-to-vi)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
471
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
472 ;; passwd.el sets up its own buffer, which turns up in Vi mode,
12691
7bd050135516 (vip-info-file-name): variable removed.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12203
diff changeset
473 ;; thus overriding the local map. We don't need Vi mode here.
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
474 (vip-eval-after-load
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
475 "passwd"
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
476 '(defadvice read-passwd-1 (before vip-passwd-ad activate)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
477 "Switch to emacs state while reading password."
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
478 (vip-change-state-to-emacs)))
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
479
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
480 (vip-eval-after-load
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
481 "prolog"
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
482 '(defadvice prolog-mode (after vip-prolog-ad activate)
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
483 "Switch to Vi state in Prolog mode."
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
484 (vip-change-state-to-vi)))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
485
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
486 ;; Emacs shell, ange-ftp, and comint-based modes
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
487 (defvar comint-mode-hook)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
488 (vip-modify-major-mode
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
489 'comint-mode 'insert-state vip-comint-mode-modifier-map)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
490 (vip-modify-major-mode
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
491 'comint-mode 'vi-state vip-comint-mode-modifier-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
492 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
493 'shell-mode 'insert-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
494 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
495 'shell-mode 'vi-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
496 ;; ange-ftp in XEmacs
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
497 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
498 'ange-ftp-shell-mode 'insert-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
499 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
500 'ange-ftp-shell-mode 'vi-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
501 ;; ange-ftp in Emacs
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
502 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
503 'internal-ange-ftp-mode 'insert-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
504 (vip-modify-major-mode
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
505 'internal-ange-ftp-mode 'vi-state vip-comint-mode-modifier-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
506 ;; set hook
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
507 (add-hook 'comint-mode-hook 'vip-comint-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
508
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
509 ;; Shell scripts
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
510 (defvar sh-mode-hook)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
511 (add-hook 'sh-mode-hook 'viper-mode)
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
512 (defvar ksh-mode-hook)
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
513 (add-hook 'ksh-mode-hook 'viper-mode)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
514
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
515 ;; Dired
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
516 (vip-modify-major-mode 'dired-mode 'emacs-state vip-dired-modifier-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
517 (vip-set-emacs-search-style-macros nil 'dired-mode)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
518 (add-hook 'dired-mode-hook 'vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
519
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
520 ;; Tar
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
521 (vip-modify-major-mode 'tar-mode 'emacs-state vip-slash-and-colon-map)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
522 (vip-set-emacs-search-style-macros nil 'tar-mode)
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
523
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
524 ;; MH-E
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
525 (vip-modify-major-mode 'mh-folder-mode 'emacs-state vip-slash-and-colon-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
526 (vip-set-emacs-search-style-macros nil 'mh-folder-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
527 ;; changing state to emacs is needed so the preceding will take hold
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
528 (add-hook 'mh-folder-mode-hook 'vip-change-state-to-emacs)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
529 (add-hook 'mh-show-mode-hook 'viper-mode)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
530
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
531 ;; Gnus
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
532 (vip-modify-major-mode 'gnus-group-mode 'emacs-state vip-slash-and-colon-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
533 (vip-set-emacs-search-style-macros nil 'gnus-group-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
534 (vip-modify-major-mode
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
535 'gnus-summary-mode 'emacs-state vip-slash-and-colon-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
536 (vip-set-emacs-search-style-macros nil 'gnus-summary-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
537 ;; changing state to emacs is needed so the preceding will take hold
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
538 (add-hook 'gnus-group-mode-hook 'vip-change-state-to-emacs)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
539 (add-hook 'gnus-summary-mode-hook 'vip-change-state-to-emacs)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
540 (add-hook 'gnus-article-mode-hook 'viper-mode)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
541
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
542 ;; Info
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
543 (vip-modify-major-mode 'Info-mode 'emacs-state vip-slash-and-colon-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
544 (vip-set-emacs-search-style-macros nil 'Info-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
545 ;; Switching to emacs is needed so the above will take hold
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
546 (defadvice Info-mode (after vip-Info-ad activate)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
547 "Switch to emacs mode."
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
548 (vip-change-state-to-emacs))
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
549
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
550 ;; Buffer menu
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
551 (vip-modify-major-mode
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
552 'Buffer-menu-mode 'emacs-state vip-slash-and-colon-map)
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
553 (vip-set-emacs-search-style-macros nil 'Buffer-menu-mode)
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
554 ;; Switching to emacs is needed so the above will take hold
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
555 (defadvice Buffer-menu-mode (after vip-Buffer-menu-ad activate)
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
556 "Switch to emacs mode."
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
557 (vip-change-state-to-emacs))
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
558
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
559 ;; View mode
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
560 (if vip-emacs-p
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
561 (progn
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
562 (defvar view-mode-hook)
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
563 (add-hook 'view-mode-hook 'vip-change-state-to-emacs))
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
564 (defadvice view-minor-mode (after vip-view-ad activate)
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
565 "Switch to Emacs state in View mode."
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
566 (vip-change-state-to-emacs))
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
567 (defvar view-hook)
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
568 (add-hook 'view-hook 'vip-change-state-to-emacs))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
569
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
570 ;; For VM users.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
571 ;; Put summary and other VM buffers in Emacs state.
15480
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
572 (defvar vm-mode-hooks)
43a3308fcf61 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14909
diff changeset
573 (defvar vm-summary-mode-hooks)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
574 (add-hook 'vm-mode-hooks 'vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
575 (add-hook 'vm-summary-mode-hooks 'vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
576
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
577 ;; For RMAIL users.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
578 ;; Put buf in Emacs state after edit.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
579 (vip-eval-after-load
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
580 "rmailedit"
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
581 '(defadvice rmail-cease-edit (after vip-rmail-advice activate)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
582 "Switch to emacs state when done editing message."
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
583 (vip-change-state-to-emacs)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
584 ;; In case RMAIL was loaded before Viper.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
585 (defadvice rmail-cease-edit (after vip-rmail-advice activate)
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
586 "Switch to emacs state when done editing message."
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
587 (vip-change-state-to-emacs))
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
588 ) ; vip-set-hooks
18172
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
589
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
590
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
591 ;; Defadvices
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
592
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
593 (defadvice read-key-sequence (around vip-read-keyseq-ad activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
594 "Harness to work for Viper. This advice is harmless---don't worry!"
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
595 (let (inhibit-quit event keyseq)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
596 (setq keyseq ad-do-it)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
597 (setq event (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
598 (elt keyseq 0) ; XEmacs returns vector of events
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
599 (elt (listify-key-sequence keyseq) 0)))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
600 (if (vip-ESC-event-p event)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
601 (let (unread-command-events)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
602 (vip-set-unread-command-events keyseq)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
603 (if (vip-fast-keysequence-p)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
604 (let ((vip-vi-global-user-minor-mode nil)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
605 (vip-vi-local-user-minor-mode nil)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
606 (vip-replace-minor-mode nil) ; actually unnecessary
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
607 (vip-insert-global-user-minor-mode nil)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
608 (vip-insert-local-user-minor-mode nil))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
609 (setq keyseq ad-do-it))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
610 (setq keyseq ad-do-it))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
611 keyseq))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
612
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
613 (defadvice describe-key (before vip-read-keyseq-ad protect activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
614 "Force to read key via `read-key-sequence'."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
615 (interactive (list (vip-events-to-keys
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
616 (read-key-sequence "Describe key: ")))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
617
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
618 (defadvice describe-key-briefly (before vip-read-keyseq-ad protect activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
619 "Force to read key via `read-key-sequence'."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
620 (interactive (list (vip-events-to-keys
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
621 (read-key-sequence "Describe key briefly: ")))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
622
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
623
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
624 ;; Advice for use in find-file and read-file-name commands.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
625 (defadvice exit-minibuffer (before vip-exit-minibuffer-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
626 "Run `vip-minibuffer-exit-hook' just before exiting the minibuffer."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
627 (run-hooks 'vip-minibuffer-exit-hook))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
628
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
629 (defadvice find-file (before vip-add-suffix-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
630 "Use `read-file-name' for reading arguments."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
631 (interactive (cons (read-file-name "Find file: " nil default-directory)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
632 ;; if Mule and prefix argument, ask for coding system
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
633 (if (or (boundp 'MULE) ; mule integrated Emacs 19
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
634 (featurep 'mule)) ; mule integrated XEmacs 20
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
635 (list
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
636 (and current-prefix-arg
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
637 (read-coding-system "Coding-system: "))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
638 )))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
639
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
640 (defadvice find-file-other-window (before vip-add-suffix-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
641 "Use `read-file-name' for reading arguments."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
642 (interactive (cons (read-file-name "Find file in other window: "
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
643 nil default-directory)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
644 ;; if Mule and prefix argument, ask for coding system
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
645 (if (or (boundp 'MULE) ; mule integrated Emacs 19
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
646 (featurep 'mule)) ; mule integrated XEmacs 20
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
647 (list
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
648 (and current-prefix-arg
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
649 (read-coding-system "Coding-system: "))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
650 )))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
651
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
652 (defadvice find-file-other-frame (before vip-add-suffix-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
653 "Use `read-file-name' for reading arguments."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
654 (interactive (cons (read-file-name "Find file in other frame: "
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
655 nil default-directory)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
656 ;; if Mule and prefix argument, ask for coding system
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
657 (if (or (boundp 'MULE) ; mule integrated Emacs 19
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
658 (featurep 'mule)) ; mule integrated XEmacs 20
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
659 (list
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
660 (and current-prefix-arg
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
661 (read-coding-system "Coding-system: "))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
662 )))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
663
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
664 (defadvice read-file-name (around vip-suffix-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
665 "Tell `exit-minibuffer' to run `vip-file-add-suffix' as a hook."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
666 (let ((vip-minibuffer-exit-hook 'vip-file-add-suffix))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
667 ad-do-it))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
668
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
669 (defadvice start-kbd-macro (after vip-kbd-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
670 "Remove Viper's intercepting bindings for C-x ).
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
671 This may be needed if the previous `:map' command terminated abnormally."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
672 (define-key vip-vi-intercept-map "\C-x)" nil)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
673 (define-key vip-insert-intercept-map "\C-x)" nil)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
674 (define-key vip-emacs-intercept-map "\C-x)" nil))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
675
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
676 (cond ((vip-window-display-p)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
677 (let* ((search-key (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
678 [(meta shift button1up)] [M-S-mouse-1]))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
679 (search-key-catch (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
680 [(meta shift button1)] [M-S-down-mouse-1]))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
681 (insert-key (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
682 [(meta shift button2up)] [M-S-mouse-2]))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
683 (insert-key-catch (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
684 [(meta shift button2)] [M-S-down-mouse-2]))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
685 (search-key-unbound (and (not (key-binding search-key))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
686 (not (key-binding search-key-catch))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
687 (insert-key-unbound (and (not (key-binding insert-key))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
688 (not (key-binding insert-key-catch))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
689 )
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
690
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
691 (if search-key-unbound
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
692 (global-set-key search-key 'vip-mouse-click-search-word))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
693 (if insert-key-unbound
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
694 (global-set-key insert-key 'vip-mouse-click-insert-word))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
695
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
696 ;; The following would be needed if you want to use the above two
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
697 ;; while clicking in another frame. If you only want to use them
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
698 ;; by clicking in another window, not frame, the bindings below
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
699 ;; aren't necessary.
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
700
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
701 ;; These must be bound to mouse-down event for the same mouse
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
702 ;; buttons as 'vip-mouse-click-search-word and
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
703 ;; 'vip-mouse-click-insert-word
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
704 (if search-key-unbound
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
705 (global-set-key search-key-catch 'vip-mouse-catch-frame-switch))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
706 (if insert-key-unbound
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
707 (global-set-key insert-key-catch 'vip-mouse-catch-frame-switch))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
708
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
709 (if vip-xemacs-p
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
710 (add-hook 'mouse-leave-frame-hook
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
711 'vip-remember-current-frame)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
712 (defadvice handle-switch-frame (before vip-frame-advice activate)
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
713 "Remember the selected frame before the switch-frame event."
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
714 (vip-remember-current-frame (selected-frame))))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
715 )))
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
716
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
717
e145ccc61a22 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18129
diff changeset
718
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
719
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
720 ;; Set some useful macros
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
721 ;; These must be before we load .vip, so the user could unrecord them.
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
722
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
723 ;; repeat the 2nd previous command without rotating the command history
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
724 (vip-record-kbd-macro
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
725 (vector vip-repeat-from-history-key '\1) 'vi-state
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
726 [(meta x) v i p - r e p e a t - f r o m - h i s t o r y return] 't)
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
727 ;; repeat the 3d previous command without rotating the command history
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
728 (vip-record-kbd-macro
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
729 (vector vip-repeat-from-history-key '\2) 'vi-state
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
730 [(meta x) v i p - r e p e a t - f r o m - h i s t o r y return] 't)
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
731
16766
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
732 ;; set the toggle case sensitivity and regexp search macros
beb94a5271e2 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16248
diff changeset
733 (vip-set-vi-search-style-macros nil)
18047
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
734
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
735 ;; Make %%% toggle parsing comments for matching parentheses
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
736 (vip-record-kbd-macro
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
737 "%%%" 'vi-state
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
738 [(meta x) v i p - t o g g l e - p a r s e - s e x p - i g n o r e - c o m m e n t s return]
1b06411ccc04 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16766
diff changeset
739 't)
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
740
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
741
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
742 ;; ~/.vip is loaded if it exists
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
743 (if (and (file-exists-p vip-custom-file-name)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
744 (not noninteractive))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
745 (load vip-custom-file-name))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
746
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
747 ;; VIP compatibility: merge whatever the user has in vip-mode-map into
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
748 ;; Viper's basic map.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
749 (vip-add-keymap vip-mode-map vip-vi-global-user-map)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
750
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
751
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
752 ;; Applying Viper customization -- runs after (load .vip)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
753
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
754 ;; Save user settings or Viper defaults for vars controled by vip-expert-level
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
755 (setq vip-saved-user-settings
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
756 (list (cons 'vip-want-ctl-h-help vip-want-ctl-h-help)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
757 (cons 'vip-always vip-always)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
758 (cons 'vip-no-multiple-ESC vip-no-multiple-ESC)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
759 (cons 'vip-ex-style-motion vip-ex-style-motion)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
760 (cons 'vip-ex-style-editing-in-insert
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
761 vip-ex-style-editing-in-insert)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
762 (cons 'vip-want-emacs-keys-in-vi vip-want-emacs-keys-in-vi)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
763 (cons 'vip-want-emacs-keys-in-insert vip-want-emacs-keys-in-insert)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
764 (cons 'vip-re-search vip-re-search)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
765
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
766
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
767 (vip-set-minibuffer-style)
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
768 (if vip-buffer-search-char
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
769 (vip-buffer-search-enable))
13214
bc4eeb585ff1 (vip-set-hooks): Use view-mode-hook in emacs and view
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12900
diff changeset
770 (vip-update-alphanumeric-class)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
771
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
772
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
773 ;;; Familiarize Viper with some minor modes that have their own keymaps
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
774 (vip-harness-minor-mode "compile")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
775 (vip-harness-minor-mode "outline")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
776 (vip-harness-minor-mode "allout")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
777 (vip-harness-minor-mode "xref")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
778 (vip-harness-minor-mode "lmenu")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
779 (vip-harness-minor-mode "vc")
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
780 (vip-harness-minor-mode "ltx-math") ; LaTeX-math-mode in AUC-TeX
12137
e6af973190dc (vip-envelop-ESC-key): if an ESC-sequence translates
Karl Heuer <kwzh@gnu.org>
parents: 11255
diff changeset
781 (vip-harness-minor-mode "latex") ; which is in one of these two files
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
782 (vip-harness-minor-mode "cyrillic")
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
783 (vip-harness-minor-mode "russian")
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
784 (vip-harness-minor-mode "view-less")
14232
aa84e18af631 Sat Jan 20 01:41:56 1996 Michael Kifer <kifer@sbkifer>
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
785 (vip-harness-minor-mode "view")
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
786
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
787
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
788 ;; Intercept maps could go in viper-keym.el
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
789 ;; We keep them here in case someone redefines them in ~/.vip
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
790
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
791 (define-key vip-vi-intercept-map vip-ESC-key 'vip-intercept-ESC-key)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
792 (define-key vip-insert-intercept-map vip-ESC-key 'vip-intercept-ESC-key)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
793
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
794 ;; This is taken care of by vip-insert-global-user-map.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
795 ;;(define-key vip-replace-map vip-ESC-key 'vip-intercept-ESC-key)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
796
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
797
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
798 ;; The default vip-toggle-key is \C-z; for the novice, it suspends or
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
799 ;; iconifies Emacs
16135
102e7d27c135 *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 16038
diff changeset
800 (define-key vip-vi-intercept-map vip-toggle-key 'vip-toggle-key-action)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
801 (define-key vip-emacs-intercept-map vip-toggle-key 'vip-change-state-to-vi)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
802
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
803
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
804 (if (or vip-always
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
805 (and (< vip-expert-level 5) (> vip-expert-level 0)))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
806 (vip-set-hooks))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
807
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
808 ;; Let all minor modes take effect after loading
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
809 ;; this may not be enough, so we also set default minor-mode-alist.
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
810 ;; Without setting the default, new buffers that come up in emacs mode have
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
811 ;; minor-mode-map-alist = nil, unless we call vip-change-state-*
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
812 (if (eq vip-current-state 'emacs-state)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
813 (progn
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
814 (vip-change-state-to-emacs)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
815 (setq-default minor-mode-map-alist minor-mode-map-alist)
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
816 ))
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
817
12900
7a7b8d42bdec * viper.el (vip-set-hooks): Use view-mode-hook in emacs and view hook in xemacs.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12855
diff changeset
818
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
819
13214
bc4eeb585ff1 (vip-set-hooks): Use view-mode-hook in emacs and view
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12900
diff changeset
820 (run-hooks 'vip-load-hook) ; the last chance to change something
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
821
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
822 (provide 'vip)
18129
e92598964ee6 new version
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 18047
diff changeset
823 (provide 'viper)
10789
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
824
af7c0bb1059f Initial revision
Karl Heuer <kwzh@gnu.org>
parents:
diff changeset
825 ;;; viper.el ends here