* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;;; viper.el --- A full-featured Vi emulator for GNU Emacs and XEmacs,
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; a VI Plan for Emacs Rescue,
|
|
|
|
|
;; and a venomous VI PERil.
|
|
|
|
|
;; Viper Is also a Package for Emacs Rebels.
|
|
|
|
|
|
2005-08-01 15:47:19 +00:00
|
|
|
|
;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
|
|
|
|
;; 2003, 2004, 2005 Free Software Foundation, Inc.
|
1996-01-20 03:10:57 +00:00
|
|
|
|
|
2002-01-07 Michael Kifer <kifer@cs.stonybrook.edu>
* viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
new macro that replaces viper-emacs-p and viper-xemacs-p in many
cases. Used to reduce the number of warnings.
* viper-cmd.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-standard-value): moved here from viper.el.
(viper-set-unread-command-events): moved to viper-util.el
(viper-check-minibuffer-overlay): make sure
viper-minibuffer-overlay is moved to cover the entire input field.
* viper-util.el: use viper-cond-compile-for-xemacs-or-emacs.
(viper-read-key-sequence, viper-set-unread-command-events,
viper-char-symbol-sequence-p, viper-char-array-p): moved here.
* viper-ex.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-keym.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-mous.el: use viper-cond-compile-for-xemacs-or-emacs.
* viper-macs.el (viper-char-array-p, viper-char-symbol-sequence-p,
viper-event-vector-p): moved to viper-util.el
* viper.el (viper-standard-value): moved to viper-cmd.el.
Use viper-cond-compile-for-xemacs-or-emacs.
* ediff-help.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-hook.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-init.el (ediff-cond-compile-for-xemacs-or-emacs): new
macro designed to be used in many places where ediff-emacs-p or
ediff-xemacs-p was previously used. Reduces the number of
warnings.
Use ediff-cond-compile-for-xemacs-or-emacs in many places in lieue
of ediff-xemacs-p.
(ediff-make-current-diff-overlay, ediff-highlight-diff-in-one-buffer,
ediff-convert-fine-diffs-to-overlays, ediff-empty-diff-region-p,
ediff-whitespace-diff-region-p, ediff-get-region-contents):
moved to ediff-util.el.
(ediff-event-key): moved here.
* ediff-merge.el: got rid of unreferenced variables.
* ediff-mult.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff-util.el: use ediff-cond-compile-for-xemacs-or-emacs.
(ediff-cleanup-mess): improved the way windows are set up after
quitting ediff.
(ediff-janitor): use ediff-dispose-of-variant-according-to-user.
(ediff-dispose-of-variant-according-to-user): new function
designed to be smarter and also understands indirect buffers.
(ediff-highlight-diff-in-one-buffer,
ediff-unhighlight-diff-in-one-buffer,
ediff-unhighlight-diffs-totally-in-one-buffer,
ediff-highlight-diff, ediff-highlight-diff,
ediff-unhighlight-diff, ediff-unhighlight-diffs-totally,
ediff-empty-diff-region-p, ediff-whitespace-diff-region-p,
ediff-get-region-contents, ediff-make-current-diff-overlay):
moved here.
(ediff-format-bindings-of): new function by Hannu Koivisto
<azure@iki.fi>.
(ediff-setup): make sure the merge buffer is always widened and
modifiable.
(ediff-write-merge-buffer-and-maybe-kill): refuse to write the
result of a merge into a file visited by another buffer.
(ediff-arrange-autosave-in-merge-jobs): check if the merge file
is visited by another buffer and ask to save/delete that buffer.
(ediff-verify-file-merge-buffer): new function to do the above.
* ediff-vers.el: load ediff-init.el at compile time.
* ediff-wind.el: use ediff-cond-compile-for-xemacs-or-emacs.
* ediff.el (ediff-windows, ediff-regions-wordwise,
ediff-regions-linewise): use indirect buffers to improve
robustness and make it possible to compare regions of the same
buffer (even overlapping regions).
(ediff-clone-buffer-for-region-comparison,
ediff-clone-buffer-for-window-comparison): new functions.
(ediff-files-internal): refuse to compare identical files.
(ediff-regions-internal): get rid of the warning about comparing
regions of the same buffer.
* ediff-diff.el (ediff-convert-fine-diffs-to-overlays): moved here.
Plus the following fixes courtesy of Dave Love:
Doc fixes.
(ediff-word-1): Use word class and move - to the
front per regexp documentation.
(ediff-wordify): Bind forward-word-function outside loop.
(ediff-copy-to-buffer): Use insert-buffer-substring rather than
consing buffer contents.
(ediff-goto-word): Move syntax table setting outside loop.
2002-01-08 04:36:01 +00:00
|
|
|
|
;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
|
2001-09-09 22:33:38 +00:00
|
|
|
|
;; Keywords: emulations
|
|
|
|
|
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(defconst viper-version "3.11.5 of September 19, 2005"
|
1996-03-29 01:02:28 +00:00
|
|
|
|
"The current version of Viper")
|
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
;; any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
1996-07-20 18:10:35 +00:00
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
2005-07-04 17:55:18 +00:00
|
|
|
|
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
|
;; Boston, MA 02110-1301, USA.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Viper is a full-featured Vi emulator for Emacs and XEmacs. It emulates and
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; improves upon the standard features of Vi and, at the same time, allows
|
|
|
|
|
;; full access to all Emacs facilities. Viper supports multiple undo,
|
|
|
|
|
;; file name completion, command, file, and search history and it extends
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Vi in many other ways. Viper is highly customizable through the various
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; hooks, user variables, and keymaps. It is implemented as a collection
|
|
|
|
|
;; of minor modes and it is designed to provide full access to all Emacs
|
|
|
|
|
;; major and minor modes.
|
|
|
|
|
;;
|
2001-07-16 07:46:48 +00:00
|
|
|
|
;;; History:
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Viper is a new name for a package formerly known as VIP-19,
|
|
|
|
|
;; which was a successor of VIP version 3.5 by Masahiko Sato
|
|
|
|
|
;; <ms@sail.stanford.edu> and VIP version 4.2 by Aamod Sane
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; <sane@cs.uiuc.edu>. Some ideas from vip 4.4.2 by Aamod Sane
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; were also shamelessly plagiarized.
|
|
|
|
|
;;
|
|
|
|
|
;; Viper maintains some degree of compatibility with these older
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; packages. See the documentation for customization.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; The main difference between Viper and these older packages are:
|
|
|
|
|
;;
|
|
|
|
|
;; 1. Viper emulates Vi at several levels, from almost complete conformity
|
|
|
|
|
;; to a rather loose Vi-compliance.
|
|
|
|
|
;;
|
|
|
|
|
;; 2. Viper provides full access to all major and minor modes of Emacs
|
|
|
|
|
;; without the need to type extra keys.
|
|
|
|
|
;; The older versions of VIP (and other Vi emulators) do not work with
|
|
|
|
|
;; some major and minor modes.
|
|
|
|
|
;;
|
|
|
|
|
;; 3. Viper supports vi-style undo.
|
|
|
|
|
;;
|
|
|
|
|
;; 4. Viper fully emulates (and improves upon) vi's replacement mode.
|
|
|
|
|
;;
|
|
|
|
|
;; 5. Viper has a better interface to ex, including command, variable, and
|
|
|
|
|
;; file name completion.
|
|
|
|
|
;;
|
|
|
|
|
;; 6. Viper uses native Emacs history and completion features; it doesn't
|
|
|
|
|
;; rely on other packages (such as gmhist.el and completer.el) to provide
|
|
|
|
|
;; these features.
|
|
|
|
|
;;
|
|
|
|
|
;; 7. Viper supports Vi-style editing in the minibuffer, by allowing the
|
|
|
|
|
;; user to switch from Insert state to Vi state to Replace state, etc.
|
|
|
|
|
;;
|
|
|
|
|
;; 8. Viper keeps history of recently inserted pieces of text and recently
|
|
|
|
|
;; executed Vi-style destructive commands, such as `i', `d', etc.
|
|
|
|
|
;; These pieces of text can be inserted in later insertion commands;
|
|
|
|
|
;; the previous destructive commands can be re-executed.
|
|
|
|
|
;;
|
|
|
|
|
;; 9. Viper has Vi-style keyboard macros, which enhances the similar
|
|
|
|
|
;; facility in the original Vi.
|
|
|
|
|
;; First, one can execute any Emacs command while defining a
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; macro, not just the Vi commands. Second, macros are defined in a
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; WYSYWYG mode, using an interface to Emacs' WYSIWYG style of defining
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; macros. Third, in Viper, one can define macros that are specific to
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; a given buffer, a given major mode, or macros defined for all buffers.
|
|
|
|
|
;; The same macro name can have several different definitions:
|
|
|
|
|
;; one global, several definitions for various major modes, and
|
|
|
|
|
;; definitions for specific buffers.
|
1996-07-20 17:20:16 +00:00
|
|
|
|
;; Buffer-specific definitions override mode-specific
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; definitions, which, in turn, override global definitions.
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;;; Installation:
|
|
|
|
|
;; -------------
|
|
|
|
|
;;
|
|
|
|
|
;; (require 'viper)
|
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
|
;;; Acknowledgements:
|
|
|
|
|
;; -----------------
|
1996-07-20 17:20:16 +00:00
|
|
|
|
;; Bug reports and ideas contributed by many users have helped
|
|
|
|
|
;; improve Viper and the various versions of VIP.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; See the on-line manual for a complete list of contributors.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;;; Notes:
|
|
|
|
|
;;
|
|
|
|
|
;; 1. Major modes.
|
|
|
|
|
;; In most cases, Viper handles major modes correctly, i.e., they come up
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; in the right state (either vi-state or emacs-state). For instance, text
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; files come up in vi-state, while, say, Dired appears in emacs-state by
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; default.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; However, some modes do not appear in the right mode in the beginning,
|
|
|
|
|
;; usually because they neglect to follow Emacs conventions (e.g., they don't
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; use kill-all-local-variables when they start). Some major modes
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; may fail to come up in emacs-state if they call hooks, such as
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; text-hook, for no good reason.
|
|
|
|
|
;;
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; As an immediate solution, you can hit C-z to bring about the right mode.
|
|
|
|
|
;; An interim solution is to add an appropriate hook to the mode like this:
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;;
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; (add-hook 'your-favorite-mode 'viper-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; or
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; (add-hook 'your-favorite-mode 'viper-change-state-to-emacs)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;;
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; whichever applies. The right thing to do, however, is to complain to the
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; author of the respective package. (Sometimes they also neglect to equip
|
|
|
|
|
;; their modes with hooks, which is one more reason for complaining.)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;;
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; 2. Keymap handling
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; Each Viper state (insert, vi, replace) is implemented as a collection of
|
|
|
|
|
;; several minor modes, each with its own keymap.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Viper's Vi state consists of seven minor modes:
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-vi-intercept-minor-mode
|
|
|
|
|
;; viper-vi-local-user-minor-mode
|
|
|
|
|
;; viper-vi-global-user-minor-mode
|
|
|
|
|
;; viper-vi-kbd-minor-mode
|
|
|
|
|
;; viper-vi-state-modifier-minor-mode
|
|
|
|
|
;; viper-vi-diehard-minor-mode
|
|
|
|
|
;; viper-vi-basic-minor-mode
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Bindings done to the keymap of the first mode overshadow those done to
|
|
|
|
|
;; the second, which, in turn, overshadows those done to the third, etc.
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The last viper-vi-basic-minor-mode contains most of the usual Vi bindings
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; in its edit mode. This mode provides access to all Emacs facilities.
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; Novice users, however, may want to set their viper-expert-level to 1
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; in their .viper file. This will enable viper-vi-diehard-minor-mode. This
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; minor mode's bindings make Viper simulate the usual Vi very closely.
|
|
|
|
|
;; For instance, C-c will not have its standard Emacs binding
|
|
|
|
|
;; and so many of the goodies of Emacs are not available.
|
|
|
|
|
;;
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; A skilled user should set viper-expert-level to at least 3. This will
|
1996-07-20 17:20:16 +00:00
|
|
|
|
;; enable `C-c' and many Emacs facilities will become available.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; In this case, viper-vi-diehard-minor-mode is inactive.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Viper gurus should have at least
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; (setq viper-expert-level 4)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; in their ~/.viper files. This will unsuppress all Emacs keys that are not
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; essential for VI-style editing.
|
|
|
|
|
;; Pick-and-choose users may want to put
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; (setq viper-expert-level 5)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; in ~/.viper. Viper will then leave it up to the user to set the variables
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-want-* See viper-set-expert-level for details.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The very first minor mode, viper-vi-intercept-minor-mode, is of no
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; concern for the user. It is needed to bind Viper's vital keys, such as
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; ESC and C-z.
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The second mode, viper-vi-local-user-minor-mode, usually has an
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; empty keymap. However, the user can set bindings in this keymap, which
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; will overshadow the corresponding bindings in the other two minor
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; modes. This is useful, for example, for setting up ZZ in gnus,
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; rmail, mh-e, etc., to send message instead of saving it in a file.
|
|
|
|
|
;; Likewise, in Dired mode, you may want to bind ZN and ZP to commands
|
|
|
|
|
;; that would visit the next or the previous file in the Dired buffer.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; Setting local keys is tricky, so don't do it directly. Instead, use
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-add-local-keys function (see its doc).
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The third minor mode, viper-vi-global-user-minor-mode, is also intended
|
|
|
|
|
;; for the users but, unlike viper-vi-local-user-minor-mode, its key
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; bindings are seen in all Viper buffers. This mode keys can be done
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; with define-key command.
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The fourth minor mode, viper-vi-kbd-minor-mode, is used by keyboard
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; macros. Users are NOT supposed to modify this keymap directly.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The fifth mode, viper-vi-state-modifier-minor-mode, can be used to set
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; key bindings that are visible in some major modes but not in others.
|
|
|
|
|
;;
|
|
|
|
|
;; Users are allowed to modify keymaps that belong to
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-vi-local-user-minor-mode, viper-vi-global-user-minor-mode,
|
|
|
|
|
;; and viper-vi-state-modifier-minor-mode only.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Viper's Insert state also has seven minor modes:
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-insert-intercept-minor-mode
|
|
|
|
|
;; viper-insert-local-user-minor-mode
|
|
|
|
|
;; viper-insert-global-user-minor-mode
|
|
|
|
|
;; viper-insert-kbd-minor-mode
|
|
|
|
|
;; viper-insert-state-modifier-minor-mode
|
|
|
|
|
;; viper-insert-diehard-minor-mode
|
|
|
|
|
;; viper-insert-basic-minor-mode
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; As with VI's editing modes, the first mode,
|
|
|
|
|
;; viper-insert-intercept-minor-mode is used to bind vital keys that are not
|
|
|
|
|
;; to be changed by the user.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The next mode, viper-insert-local-user-minor-mode, is used to customize
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; bindings in the insert state of Viper. The third mode,
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-insert-global-user-minor-mode is like
|
|
|
|
|
;; viper-insert-local-user-minor-mode, except that its bindings are seen in
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; all Viper buffers. As with viper-vi-local-user-minor-mode, its bindings
|
|
|
|
|
;; should be done via the function viper-add-local-keys. Bindings for
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-insert-global-user-minor-mode can be set with the define-key command.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The next minor mode, viper-insert-kbd-minor-mode,
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; is used for keyboard VI-style macros defined with :map!.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The fifth minor mode, viper-insert-state-modifier-minor-mode, is like
|
|
|
|
|
;; viper-vi-state-modifier-minor-mode, except that it is used in the Insert
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; state; it can be used to modify keys in a mode-specific fashion.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The minor mode viper-insert-diehard-minor-mode is in effect when
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; the user wants a high degree of Vi compatibility (a bad idea, really!).
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The last minor mode, viper-insert-basic-minor-mode, is always in effect
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; when Viper is in insert state. It binds a small number of keys needed for
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; Viper's operation.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Finally, Viper provides minor modes for overriding bindings set by Emacs
|
|
|
|
|
;; modes when Viper is in Emacs state:
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-emacs-local-user-minor-mode
|
|
|
|
|
;; viper-emacs-global-user-minor-mode
|
|
|
|
|
;; viper-emacs-kbd-minor-mode
|
|
|
|
|
;; viper-emacs-state-modifier-minor-mode
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; These minor modes are in effect when Viper is in Emacs state. The keymap
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; associated with viper-emacs-global-user-minor-mode,
|
|
|
|
|
;; viper-emacs-global-user-map, overrides the global and local keymaps as
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; well as the minor mode keymaps set by other modes. The keymap of
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-emacs-local-user-minor-mode, viper-emacs-local-user-map, overrides
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; everything, but it is used on a per buffer basis.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The keymap associated with viper-emacs-state-modifier-minor-mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; overrides keys on a per-major-mode basis. The mode
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-emacs-kbd-minor-mode is used to define Vi-style macros in Emacs
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; state.
|
|
|
|
|
;;
|
|
|
|
|
;; 3. There is also one minor mode that is used when Viper is in its
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; replace-state (used for commands like cw, C, etc.). This mode is
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; called
|
|
|
|
|
;;
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-replace-minor-mode
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; and its keymap is viper-replace-map. Replace minor mode is always
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; used in conjunction with the minor modes for insert-state, and its
|
|
|
|
|
;; keymap overshadows the keymaps for insert minor modes.
|
|
|
|
|
;;
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; 4. Defining buffer-local bindings in Vi and Insert modes.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; As mentioned before, sometimes, it is convenient to have
|
|
|
|
|
;; buffer-specific of mode-specific key bindings in Vi and insert modes.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; Viper provides a special function, viper-add-local-keys, to do precisely
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; this. For instance, is you need to add couple of mode-specific bindings
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; to Insert mode, you can put
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; (viper-add-local-keys 'insert-state '((key1 . func1) (key2 .func2)))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; somewhere in a hook of this major mode. If you put something like this
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; in your own elisp function, this will define bindings specific to the
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; buffer that was current at the time of the call to viper-add-local-keys.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; The only thing to make sure here is that the major mode of this buffer
|
|
|
|
|
;; is written according to Emacs conventions, which includes a call to
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; (kill-all-local-variables). See viper-add-local-keys for more details.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; TO DO (volunteers?):
|
|
|
|
|
;;
|
|
|
|
|
;; 1. Some of the code that is inherited from VIP-3.5 is rather
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; convoluted. Instead of viper-command-argument, keymaps should bind the
|
|
|
|
|
;; actual commands. E.g., "dw" should be bound to a generic command
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-delete that will delete things based on the value of
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; last-command-char. This would greatly simplify the logic and the code.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;
|
|
|
|
|
;; 2. Somebody should venture to write a customization package a la
|
|
|
|
|
;; options.el that would allow the user to change values of variables
|
|
|
|
|
;; that meet certain specs (e.g., match a regexp) and whose doc string
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; starts with a '*'. Then, the user should be offered to save
|
|
|
|
|
;; variables that were changed. This will make user's customization job
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; much easier.
|
|
|
|
|
;;
|
|
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; Code:
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
(require 'advice)
|
|
|
|
|
(require 'cl)
|
|
|
|
|
(require 'ring)
|
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
;; compiler pacifier
|
|
|
|
|
(defvar mark-even-if-inactive)
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(defvar quail-mode)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(defvar viper-expert-level)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(defvar viper-mode-string)
|
|
|
|
|
(defvar viper-major-mode-modifier-list)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
;; loading happens only in non-interactive compilation
|
|
|
|
|
;; in order to spare non-viperized emacs from being viperized
|
|
|
|
|
(if noninteractive
|
|
|
|
|
(eval-when-compile
|
|
|
|
|
(let ((load-path (cons (expand-file-name ".") load-path)))
|
1997-07-22 16:35:49 +00:00
|
|
|
|
(or (featurep 'viper-init)
|
|
|
|
|
(load "viper-init.el" nil nil 'nosuffix))
|
1997-06-09 04:00:50 +00:00
|
|
|
|
(or (featurep 'viper-cmd)
|
|
|
|
|
(load "viper-cmd.el" nil nil 'nosuffix))
|
|
|
|
|
)))
|
|
|
|
|
;; end pacifier
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-07-21 18:24:06 +00:00
|
|
|
|
(require 'viper-init)
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(require 'viper-keym)
|
1997-07-21 18:24:06 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; better be defined before Viper custom group.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defvar viper-custom-file-name (convert-standard-filename "~/.viper")
|
1997-07-17 19:37:07 +00:00
|
|
|
|
"Viper customisation file.
|
|
|
|
|
If set by the user, this must be done _before_ Viper is loaded in `~/.emacs'.")
|
|
|
|
|
|
|
|
|
|
(defgroup viper nil
|
|
|
|
|
"Vi emulation within Emacs.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
NOTE: Viper customization should be saved in `viper-custom-file-name', which
|
1997-07-17 19:37:07 +00:00
|
|
|
|
defaults to `~/.viper'."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
:prefix "viper-"
|
1997-07-17 19:37:07 +00:00
|
|
|
|
:group 'emulations)
|
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
(require 'viper-cmd)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-09-30 01:13:53 +00:00
|
|
|
|
(defgroup viper-misc nil
|
|
|
|
|
"Miscellaneous Viper customization."
|
|
|
|
|
:prefix "viper-"
|
|
|
|
|
:group 'viper)
|
|
|
|
|
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defcustom viper-always t
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Non-nil means, arrange for vi-state to be a default when appropriate.
|
|
|
|
|
This is different from `viper-mode' variable in that `viper-mode' determines
|
|
|
|
|
whether to use Viper in the first place, while `viper-always', if nil, lets
|
1997-07-17 19:37:07 +00:00
|
|
|
|
user decide when to invoke Viper in a major mode."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:tag "Always Invoke Viper"
|
1997-09-30 01:13:53 +00:00
|
|
|
|
:group 'viper-misc)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
;; Non-viper variables that need to be saved in case the user decides to
|
|
|
|
|
;; de-viperize emacs.
|
|
|
|
|
(defvar viper-saved-non-viper-variables nil)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(defcustom viper-mode (cond (noninteractive nil)
|
|
|
|
|
(t 'ask))
|
|
|
|
|
"To Viperize or not to Viperize.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
If t, viperize emacs. If nil -- don't. If `ask', ask the user.
|
1997-06-18 01:26:55 +00:00
|
|
|
|
This variable is used primatily when Viper is being loaded.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
Must be set in `~/.emacs' before Viper is loaded.
|
1997-09-30 01:13:53 +00:00
|
|
|
|
DO NOT set this variable interactively, unless you are using the customization
|
|
|
|
|
widget."
|
1997-07-17 19:37:07 +00:00
|
|
|
|
:type '(choice (const nil) (const t) (const ask))
|
|
|
|
|
:tag "Set Viper Mode on Loading"
|
1997-09-30 01:13:53 +00:00
|
|
|
|
:group 'viper-misc)
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(defcustom viper-vi-state-mode-list
|
|
|
|
|
'(fundamental-mode
|
|
|
|
|
makefile-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
awk-mode
|
|
|
|
|
m4-mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
xrdb-mode
|
|
|
|
|
winmgr-mode
|
|
|
|
|
autoconf-mode
|
|
|
|
|
cvs-edit-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
html-mode html-helper-mode
|
|
|
|
|
emacs-lisp-mode lisp-mode lisp-interaction-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
|
|
|
|
jde-mode java-mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
cc-mode c-mode c++-mode objc-mode
|
1998-05-04 22:42:59 +00:00
|
|
|
|
fortran-mode f90-mode
|
|
|
|
|
basic-mode
|
|
|
|
|
bat-mode
|
|
|
|
|
asm-mode
|
|
|
|
|
prolog-mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
flora-mode
|
2000-02-28 06:16:44 +00:00
|
|
|
|
sql-mode
|
1998-05-04 22:42:59 +00:00
|
|
|
|
|
|
|
|
|
text-mode indented-text-mode
|
|
|
|
|
tex-mode latex-mode bibtex-mode
|
2000-02-28 06:16:44 +00:00
|
|
|
|
ps-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2005-08-06 16:58:54 +00:00
|
|
|
|
;; completion-list-mode
|
2000-06-05 00:07:02 +00:00
|
|
|
|
diff-mode
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
idl-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-03-17 Michael Kifer <kifer@cs.sunysb.edu>
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
* viper-util.el: Spaces, indentation.
* viper.el: Changed version, modification time.
2001-03-17 18:59:39 +00:00
|
|
|
|
perl-mode
|
|
|
|
|
cperl-mode
|
1998-05-04 22:42:59 +00:00
|
|
|
|
javascript-mode
|
|
|
|
|
tcl-mode
|
|
|
|
|
python-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
sh-mode ksh-mode csh-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
gnus-article-mode
|
|
|
|
|
mh-show-mode
|
|
|
|
|
)
|
|
|
|
|
"Major modes that require Vi command state."
|
1997-09-13 06:16:55 +00:00
|
|
|
|
:type '(repeat symbol)
|
1997-09-30 01:13:53 +00:00
|
|
|
|
:group 'viper-misc)
|
1997-07-25 01:42:53 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(defcustom viper-emacs-state-mode-list
|
|
|
|
|
'(custom-mode
|
|
|
|
|
|
|
|
|
|
dired-mode
|
|
|
|
|
efs-mode
|
|
|
|
|
tar-mode
|
|
|
|
|
|
2002-09-18 04:23:27 +00:00
|
|
|
|
browse-kill-ring-mode
|
|
|
|
|
recentf-mode
|
2005-08-06 20:29:11 +00:00
|
|
|
|
recentf-dialog-mode
|
2002-09-18 04:23:27 +00:00
|
|
|
|
occur-mode
|
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
mh-folder-mode
|
2001-12-24 05:50:31 +00:00
|
|
|
|
mail-mode
|
1998-05-04 22:42:59 +00:00
|
|
|
|
gnus-group-mode
|
|
|
|
|
gnus-summary-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2005-08-06 16:58:54 +00:00
|
|
|
|
completion-list-mode
|
|
|
|
|
help-mode
|
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
Info-mode
|
|
|
|
|
Buffer-menu-mode
|
1999-11-01 07:16:15 +00:00
|
|
|
|
compilation-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
view-mode
|
|
|
|
|
vm-mode
|
|
|
|
|
vm-summary-mode)
|
|
|
|
|
"*A list of major modes that should come up in Emacs state.
|
|
|
|
|
Normally, Viper would bring buffers up in Emacs state, unless the corresponding
|
|
|
|
|
major mode has been placed on `viper-vi-state-mode-list' or
|
1999-11-01 07:16:15 +00:00
|
|
|
|
`viper-insert-state-mode-list'. So, don't place a new mode on this list,
|
|
|
|
|
unless it is coming up in a wrong Viper state."
|
1998-05-04 22:42:59 +00:00
|
|
|
|
:type '(repeat symbol)
|
|
|
|
|
:group 'viper-misc)
|
|
|
|
|
|
|
|
|
|
(defcustom viper-insert-state-mode-list
|
2000-10-29 04:56:45 +00:00
|
|
|
|
'(internal-ange-ftp-mode
|
|
|
|
|
comint-mode
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
inferior-emacs-lisp-mode
|
2000-10-29 04:56:45 +00:00
|
|
|
|
eshell-mode
|
|
|
|
|
shell-mode)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
"*A list of major modes that should come up in Vi Insert state."
|
|
|
|
|
:type '(repeat symbol)
|
|
|
|
|
:group 'viper-misc)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; used to set viper-major-mode-modifier-list in defcustom
|
|
|
|
|
(defun viper-apply-major-mode-modifiers (&optional symbol value)
|
|
|
|
|
(if symbol
|
|
|
|
|
(set symbol value))
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(mapcar (lambda (triple)
|
|
|
|
|
(viper-modify-major-mode
|
|
|
|
|
(nth 0 triple) (nth 1 triple) (eval (nth 2 triple))))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
viper-major-mode-modifier-list))
|
|
|
|
|
|
2005-02-19 19:32:47 +00:00
|
|
|
|
;; We change standard bindings in some major modes, making them slightly
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; different than in "normal" vi/insert/emacs states
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(defcustom viper-major-mode-modifier-list
|
|
|
|
|
'((help-mode emacs-state viper-slash-and-colon-map)
|
|
|
|
|
(comint-mode insert-state viper-comint-mode-modifier-map)
|
|
|
|
|
(comint-mode vi-state viper-comint-mode-modifier-map)
|
|
|
|
|
(shell-mode insert-state viper-comint-mode-modifier-map)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(inferior-emacs-lisp-mode insert-state viper-comint-mode-modifier-map)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(shell-mode vi-state viper-comint-mode-modifier-map)
|
|
|
|
|
(ange-ftp-shell-mode insert-state viper-comint-mode-modifier-map)
|
|
|
|
|
(ange-ftp-shell-mode vi-state viper-comint-mode-modifier-map)
|
|
|
|
|
(internal-ange-ftp-mode insert-state viper-comint-mode-modifier-map)
|
|
|
|
|
(internal-ange-ftp-mode vi-state viper-comint-mode-modifier-map)
|
|
|
|
|
(dired-mode emacs-state viper-dired-modifier-map)
|
|
|
|
|
(tar-mode emacs-state viper-slash-and-colon-map)
|
|
|
|
|
(mh-folder-mode emacs-state viper-slash-and-colon-map)
|
2005-02-19 19:32:47 +00:00
|
|
|
|
(gnus-group-mode emacs-state viper-gnus-modifier-map)
|
|
|
|
|
(gnus-summary-mode emacs-state viper-gnus-modifier-map)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(Info-mode emacs-state viper-slash-and-colon-map)
|
|
|
|
|
(Buffer-menu-mode emacs-state viper-slash-and-colon-map)
|
|
|
|
|
)
|
|
|
|
|
"List specifying how to modify the various major modes to enable some Viperisms.
|
|
|
|
|
The list has the structure: ((mode viper-state keymap) (mode viper-state
|
1999-11-01 07:16:15 +00:00
|
|
|
|
keymap) ...). If `mode' is on the list, the `kemap' will be made active (on
|
|
|
|
|
the minor-mode-map-alist) in the specified viper state.
|
1998-05-04 22:42:59 +00:00
|
|
|
|
If you change this list, have to restart emacs for the change to take effect.
|
|
|
|
|
However, if you did the change through the customization widget, then emacs
|
|
|
|
|
needs to be restarted only if you deleted a triple mode-state-keymap from the
|
1999-11-01 07:16:15 +00:00
|
|
|
|
list. No need to restart emacs in case of insertion or modification of an
|
1998-05-04 22:42:59 +00:00
|
|
|
|
existing triple."
|
|
|
|
|
:type '(repeat
|
|
|
|
|
(list symbol
|
|
|
|
|
(choice (const emacs-state)
|
|
|
|
|
(const vi-state)
|
|
|
|
|
(const insert-state))
|
|
|
|
|
symbol))
|
|
|
|
|
:set 'viper-apply-major-mode-modifiers
|
|
|
|
|
:group 'viper-misc)
|
|
|
|
|
|
|
|
|
|
|
1997-07-25 01:42:53 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;;;###autoload
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun toggle-viper-mode ()
|
1997-11-01 01:46:51 +00:00
|
|
|
|
"Toggle Viper on/off.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
If Viper is enabled, turn it off. Otherwise, turn it on."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (eq viper-mode t)
|
|
|
|
|
(viper-go-away)
|
|
|
|
|
(setq viper-mode nil)
|
|
|
|
|
(viper-mode)))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun viper-mode ()
|
2005-08-06 16:58:54 +00:00
|
|
|
|
"Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'."
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (not noninteractive)
|
|
|
|
|
(progn
|
|
|
|
|
;; if the user requested viper-mode explicitly
|
|
|
|
|
(if viper-mode
|
|
|
|
|
()
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-mode t)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(load-library "viper"))
|
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(if viper-first-time ; Important check. Prevents mix-up of startup
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(progn ; and expert-level msgs when viper-mode recurses
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-first-time nil)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(setq viper-vi-state-cursor-color
|
|
|
|
|
(viper-get-cursor-color))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if (not viper-inhibit-startup-message)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(save-window-excursion
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq viper-inhibit-startup-message t)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(delete-other-windows)
|
|
|
|
|
(switch-to-buffer "Viper Startup Message")
|
|
|
|
|
(erase-buffer)
|
|
|
|
|
(insert
|
|
|
|
|
(substitute-command-keys
|
1997-07-17 19:37:07 +00:00
|
|
|
|
"Viper Is a Package for Emacs Rebels,
|
|
|
|
|
a VI Plan for Emacs Rescue, and a venomous VI PERil.
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
Incidentally, Viper emulates Vi under GNU Emacs 20 and XEmacs 20.
|
|
|
|
|
It supports all of what is good in Vi and Ex, while extending
|
1997-06-18 01:26:55 +00:00
|
|
|
|
and improving upon much of it.
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
1. Viper supports Vi at several levels. Level 1 is the closest to Vi,
|
1997-06-18 01:26:55 +00:00
|
|
|
|
level 5 provides the most flexibility to depart from many Vi conventions.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
You will be asked to specify your user level in a following screen.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
If you select user level 1 then the keys ^X, ^C, ^Z, and ^G will behave
|
1999-11-01 07:16:15 +00:00
|
|
|
|
as in VI, to smooth transition to Viper for the beginners. However, to
|
2003-02-04 13:24:35 +00:00
|
|
|
|
use Emacs productively, you are advised to reach user level 3 or higher.
|
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
At user level 2 or higher, ^X and ^C have Emacs, not Vi, bindings;
|
|
|
|
|
^Z toggles Vi/Emacs states; ^G is Emacs' keyboard-quit (like ^C in Vi).
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
2. Vi exit functions (e.g., :wq, ZZ) work on INDIVIDUAL files -- they
|
1997-07-17 19:37:07 +00:00
|
|
|
|
do not cause Emacs to quit, except at user level 1 (for a novice).
|
1997-06-18 01:26:55 +00:00
|
|
|
|
3. ^X^C EXITS EMACS.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
4. Viper supports multiple undo: `u' will undo. Typing `.' will repeat
|
|
|
|
|
undo. Another `u' changes direction.
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
6. Emacs Meta key is `C-\\' (in all modes) or `\\ ESC' (in Vi command mode).
|
|
|
|
|
On a window system, the best way is to use the Meta-key on your keyboard.
|
1997-06-18 01:26:55 +00:00
|
|
|
|
7. Try \\[keyboard-quit] and \\[abort-recursive-edit] repeatedly,if
|
2003-02-04 13:24:35 +00:00
|
|
|
|
something funny happens. This would abort the current editing command.
|
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
For more information on Viper:
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
a. Type `:help' in Vi command mode
|
|
|
|
|
b. Print Viper manual, found in ./etc/viper.dvi
|
|
|
|
|
c. Print the Quick Reference, found in ./etc/viperCard.dvi
|
|
|
|
|
|
|
|
|
|
To submit a bug report or to contact the author, type :submitReport in Vi
|
1999-11-01 07:16:15 +00:00
|
|
|
|
command mode. To shoo Viper away and return to pure Emacs (horror!), type:
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
M-x viper-go-away
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
This startup message appears whenever you load Viper, unless you type `y' now."
|
|
|
|
|
))
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (y-or-n-p "Inhibit Viper startup message? ")
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-save-setting
|
|
|
|
|
'viper-inhibit-startup-message
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Viper startup message inhibited"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-custom-file-name t))
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;;(kill-buffer (current-buffer))
|
|
|
|
|
(message
|
|
|
|
|
"The last message is in buffer `Viper Startup Message'")
|
|
|
|
|
(sit-for 4)
|
|
|
|
|
))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(viper-set-expert-level 'dont-change-unless)))
|
1997-07-25 01:42:53 +00:00
|
|
|
|
|
2000-11-24 08:15:11 +00:00
|
|
|
|
(if viper-xemacs-p
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(viper-make-variable-buffer-local 'bar-cursor))
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (eq major-mode 'viper-mode)
|
|
|
|
|
(setq major-mode 'fundamental-mode))
|
2000-11-24 08:15:11 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
|
|
|
|
|
(memq major-mode viper-insert-state-mode-list) ; don't switch
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-vi)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
|
|
|
|
|
;; Apply a little heuristic to invoke vi state on major-modes
|
|
|
|
|
;; that are not listed in viper-vi-state-mode-list
|
|
|
|
|
(defun this-major-mode-requires-vi-state (mode)
|
|
|
|
|
(cond ((memq mode viper-vi-state-mode-list) t)
|
|
|
|
|
((memq mode viper-emacs-state-mode-list) nil)
|
|
|
|
|
((memq mode viper-insert-state-mode-list) nil)
|
|
|
|
|
(t (and (eq (key-binding "a") 'self-insert-command)
|
|
|
|
|
(eq (key-binding " ") 'self-insert-command)))))
|
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
;; This hook designed to enable Vi-style editing in comint-based modes."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-comint-mode-hook ()
|
1996-09-06 01:17:30 +00:00
|
|
|
|
(setq require-final-newline nil
|
1997-08-22 03:15:57 +00:00
|
|
|
|
viper-ex-style-editing nil
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-ex-style-motion nil)
|
|
|
|
|
(viper-change-state-to-insert))
|
1996-09-06 01:17:30 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; remove viper hooks from SYMBOL
|
|
|
|
|
(defun viper-remove-hooks (symbol)
|
|
|
|
|
(cond ((not (boundp symbol)) nil)
|
|
|
|
|
((not (listp (eval symbol))) nil)
|
|
|
|
|
((string-match "-hook" (symbol-name symbol))
|
|
|
|
|
(remove-hook symbol 'viper-mode)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(remove-hook symbol 'viper-change-state-to-emacs)
|
|
|
|
|
(remove-hook symbol 'viper-change-state-to-insert)
|
|
|
|
|
(remove-hook symbol 'viper-change-state-to-vi)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
;; Remove local value in all existing buffers
|
|
|
|
|
;; This doesn't delocalize vars (which would have been desirable)
|
|
|
|
|
(defun viper-delocalize-var (symbol)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(mapcar (lambda (buf) (save-excursion
|
|
|
|
|
(set-buffer buf)
|
|
|
|
|
(kill-local-variable symbol)))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(buffer-list)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun viper-go-away ()
|
|
|
|
|
"De-Viperize Emacs.
|
1999-11-01 07:16:15 +00:00
|
|
|
|
This function tries to do as good a job as possible. However, it may undo some
|
|
|
|
|
user customization, unrelated to Viper. For instance, if the user advised
|
1997-07-17 19:37:07 +00:00
|
|
|
|
`read-file-name', `describe-key', and some others, then this advice will be
|
|
|
|
|
undone.
|
2005-08-06 16:58:54 +00:00
|
|
|
|
It also can't undo some Viper settings."
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
|
|
|
|
|
;; restore non-viper vars
|
|
|
|
|
(setq-default
|
|
|
|
|
next-line-add-newlines
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(viper-standard-value
|
|
|
|
|
'next-line-add-newlines viper-saved-non-viper-variables)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
require-final-newline
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(viper-standard-value
|
|
|
|
|
'require-final-newline viper-saved-non-viper-variables)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
scroll-step
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(viper-standard-value 'scroll-step viper-saved-non-viper-variables)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
mode-line-buffer-identification
|
|
|
|
|
(viper-standard-value
|
1997-07-18 18:55:36 +00:00
|
|
|
|
'mode-line-buffer-identification viper-saved-non-viper-variables)
|
|
|
|
|
global-mode-string
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(delq 'viper-mode-string global-mode-string))
|
1997-07-18 18:55:36 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if viper-emacs-p
|
1997-07-18 18:55:36 +00:00
|
|
|
|
(setq-default
|
|
|
|
|
mark-even-if-inactive
|
|
|
|
|
(viper-standard-value
|
|
|
|
|
'mark-even-if-inactive viper-saved-non-viper-variables)))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; Ideally, we would like to be able to de-localize local variables
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
|
|
|
|
(viper-delocalize-var 'minor-mode-map-alist))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(viper-delocalize-var 'require-final-newline)
|
2000-11-24 08:15:11 +00:00
|
|
|
|
(if viper-xemacs-p (viper-delocalize-var 'bar-cursor))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; deactivate all advices done by Viper.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(ad-deactivate-regexp "viper-")
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
(setq viper-mode nil)
|
|
|
|
|
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
|
|
|
|
(setq emulation-mode-map-alists
|
|
|
|
|
(delq 'viper--intercept-key-maps
|
|
|
|
|
(delq 'viper--key-maps emulation-mode-map-alists))
|
|
|
|
|
))
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-delocalize-var 'viper-vi-minibuffer-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-minibuffer-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-intercept-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-intercept-minor-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-delocalize-var 'viper-vi-local-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-kbd-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-global-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-state-modifier-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-diehard-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-vi-basic-minor-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-delocalize-var 'viper-replace-minor-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-delocalize-var 'viper-insert-local-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-kbd-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-global-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-state-modifier-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-diehard-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-insert-basic-minor-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-delocalize-var 'viper-emacs-intercept-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-emacs-local-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-emacs-kbd-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-emacs-global-user-minor-mode)
|
|
|
|
|
(viper-delocalize-var 'viper-emacs-state-modifier-minor-mode)
|
|
|
|
|
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(viper-delocalize-var 'viper-current-state)
|
|
|
|
|
(viper-delocalize-var 'viper-mode-string)
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(setq-default viper-vi-minibuffer-minor-mode nil
|
|
|
|
|
viper-insert-minibuffer-minor-mode nil
|
|
|
|
|
viper-vi-intercept-minor-mode nil
|
|
|
|
|
viper-insert-intercept-minor-mode nil
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-vi-local-user-minor-mode nil
|
|
|
|
|
viper-vi-kbd-minor-mode nil
|
|
|
|
|
viper-vi-global-user-minor-mode nil
|
|
|
|
|
viper-vi-state-modifier-minor-mode nil
|
|
|
|
|
viper-vi-diehard-minor-mode nil
|
|
|
|
|
viper-vi-basic-minor-mode nil
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-replace-minor-mode nil
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
viper-insert-local-user-minor-mode nil
|
|
|
|
|
viper-insert-kbd-minor-mode nil
|
|
|
|
|
viper-insert-global-user-minor-mode nil
|
|
|
|
|
viper-insert-state-modifier-minor-mode nil
|
|
|
|
|
viper-insert-diehard-minor-mode nil
|
|
|
|
|
viper-insert-basic-minor-mode nil
|
|
|
|
|
|
|
|
|
|
viper-emacs-intercept-minor-mode nil
|
|
|
|
|
viper-emacs-local-user-minor-mode nil
|
|
|
|
|
viper-emacs-kbd-minor-mode nil
|
|
|
|
|
viper-emacs-global-user-minor-mode nil
|
|
|
|
|
viper-emacs-state-modifier-minor-mode nil
|
1997-11-25 02:10:08 +00:00
|
|
|
|
|
|
|
|
|
viper-current-state 'emacs-state
|
|
|
|
|
viper-mode-string viper-emacs-state-id
|
1997-07-17 19:37:07 +00:00
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; remove all hooks set by viper
|
|
|
|
|
(mapatoms 'viper-remove-hooks)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(remove-hook 'comint-mode-hook 'viper-comint-mode-hook)
|
|
|
|
|
(remove-hook 'minibuffer-setup-hook 'viper-minibuffer-setup-sentinel)
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(remove-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(remove-hook 'post-command-hook 'viper-minibuffer-post-command-hook)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
;; unbind Viper mouse bindings
|
|
|
|
|
(viper-unbind-mouse-search-key)
|
|
|
|
|
(viper-unbind-mouse-insert-key)
|
1997-08-07 04:48:48 +00:00
|
|
|
|
;; In emacs, we have to advice handle-switch-frame
|
|
|
|
|
;; This advice is undone earlier, when all advices matchine "viper-" are
|
|
|
|
|
;; deactivated.
|
|
|
|
|
(if viper-xemacs-p
|
|
|
|
|
(remove-hook 'mouse-leave-frame-hook 'viper-remember-current-frame))
|
|
|
|
|
) ; end viper-go-away
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; list of buffers that just changed their major mode
|
|
|
|
|
;; used in a hack that triggers vi command mode whenever needed
|
|
|
|
|
(defvar viper-new-major-mode-buffer-list nil)
|
|
|
|
|
|
|
|
|
|
;; set appropriate Viper state in buffers that changed major mode
|
|
|
|
|
(defun set-viper-state-in-major-mode ()
|
|
|
|
|
(mapcar
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(lambda (buf)
|
|
|
|
|
(if (viper-buffer-live-p buf)
|
|
|
|
|
(with-current-buffer buf
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(cond ((and (this-major-mode-requires-vi-state major-mode)
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(eq viper-current-state 'emacs-state))
|
|
|
|
|
(viper-mode))
|
|
|
|
|
((memq major-mode viper-emacs-state-mode-list)
|
|
|
|
|
;; not checking (eq viper-current-state 'emacs-state)
|
|
|
|
|
;; because viper-current-state could have gotten it by
|
|
|
|
|
;; default. We need viper-change-state-to-emacs here to have
|
|
|
|
|
;; the keymaps take effect.
|
|
|
|
|
(viper-change-state-to-emacs))
|
|
|
|
|
((and (memq major-mode viper-insert-state-mode-list)
|
|
|
|
|
(not (eq viper-current-state 'insert-state)))
|
|
|
|
|
(viper-change-state-to-insert))
|
|
|
|
|
)) ; with-current-buffer
|
|
|
|
|
)) ; function
|
1998-05-04 22:42:59 +00:00
|
|
|
|
viper-new-major-mode-buffer-list)
|
|
|
|
|
;; clear the list of bufs that changed major mode
|
|
|
|
|
(setq viper-new-major-mode-buffer-list nil)
|
|
|
|
|
;; change the global value of hook
|
|
|
|
|
(remove-hook 'viper-post-command-hooks 'set-viper-state-in-major-mode))
|
|
|
|
|
|
|
|
|
|
;; sets up post-command-hook to turn viper-mode, if the current mode is
|
|
|
|
|
;; fundamental
|
|
|
|
|
(defun viper-major-mode-change-sentinel ()
|
|
|
|
|
(save-match-data
|
|
|
|
|
(or (string-match "\*Minibuf-" (buffer-name))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(setq viper-new-major-mode-buffer-list
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(cons (current-buffer) viper-new-major-mode-buffer-list))))
|
|
|
|
|
;; change the global value of hook
|
|
|
|
|
(add-hook 'viper-post-command-hooks 'set-viper-state-in-major-mode t))
|
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
|
1995-10-14 02:32:56 +00:00
|
|
|
|
;; This sets major mode hooks to make them come up in vi-state.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-set-hooks ()
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; It is of course a misnomer to call viper-mode a `major mode'.
|
|
|
|
|
;; However, this has the effect that if the user didn't specify the
|
|
|
|
|
;; default mode, new buffers that fall back on the default will come up
|
|
|
|
|
;; in Fundamental Mode and Vi state.
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
;; When viper-mode is executed in such a case, it will set the major mode
|
|
|
|
|
;; back to fundamental-mode.
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(if (eq default-major-mode 'fundamental-mode)
|
|
|
|
|
(setq default-major-mode 'viper-mode))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(add-hook 'change-major-mode-hook 'viper-major-mode-change-sentinel)
|
|
|
|
|
(add-hook 'find-file-hooks 'set-viper-state-in-major-mode)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; keep this because many modes we don't know about use this hook
|
1996-06-22 01:54:34 +00:00
|
|
|
|
(defvar text-mode-hook)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(add-hook 'text-mode-hook 'viper-mode)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1996-06-22 01:54:34 +00:00
|
|
|
|
(defvar emerge-startup-hook)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(add-hook 'emerge-startup-hook 'viper-change-state-to-emacs)
|
1996-09-06 01:17:30 +00:00
|
|
|
|
|
2002-01-09 17:33:15 +00:00
|
|
|
|
;; Zap bad bindings in flyspell-mouse-map, which prevent ESC from working
|
|
|
|
|
;; over misspelled words (due to the overlay keymaps)
|
|
|
|
|
(defvar flyspell-mode-hook)
|
|
|
|
|
(add-hook 'flyspell-mode-hook
|
|
|
|
|
'(lambda ()
|
|
|
|
|
(define-key flyspell-mouse-map viper-ESC-key nil)))
|
2002-04-16 05:49:11 +00:00
|
|
|
|
;; if viper is started from .emacs, it might be impossible to get certain
|
|
|
|
|
;; info about the display and windows until emacs initialization is complete
|
|
|
|
|
;; So do it via the window-setup-hook
|
|
|
|
|
(add-hook 'window-setup-hook
|
|
|
|
|
'(lambda ()
|
|
|
|
|
(setq viper-vi-state-cursor-color (viper-get-cursor-color))))
|
2002-01-09 17:33:15 +00:00
|
|
|
|
|
1996-09-06 01:17:30 +00:00
|
|
|
|
;; Tell vc-diff to put *vc* in Vi mode
|
|
|
|
|
(if (featurep 'vc)
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice vc-diff (after viper-vc-ad activate)
|
1996-09-06 01:17:30 +00:00
|
|
|
|
"Force Vi state in VC diff buffer."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-vi))
|
|
|
|
|
(eval-after-load
|
1996-09-06 01:17:30 +00:00
|
|
|
|
"vc"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
'(defadvice vc-diff (after viper-vc-ad activate)
|
1996-09-06 01:17:30 +00:00
|
|
|
|
"Force Vi state in VC diff buffer."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-vi))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(eval-after-load
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
"emerge"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
'(defadvice emerge-quit (after viper-emerge-advice activate)
|
|
|
|
|
"Run `viper-change-state-to-vi' after quitting emerge."
|
|
|
|
|
(viper-change-state-to-vi)))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; In case Emerge was loaded before Viper.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice emerge-quit (after viper-emerge-advice activate)
|
|
|
|
|
"Run `viper-change-state-to-vi' after quitting emerge."
|
|
|
|
|
(viper-change-state-to-vi))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; passwd.el sets up its own buffer, which turns up in Vi mode,
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; thus overriding the local map. We don't need Vi mode here.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(eval-after-load
|
1995-02-20 23:15:10 +00:00
|
|
|
|
"passwd"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
'(defadvice read-passwd-1 (before viper-passwd-ad activate)
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
"Switch to emacs state while reading password."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-emacs)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(defadvice self-insert-command (around viper-self-insert-ad activate)
|
|
|
|
|
"Ignore all self-inserting keys in the vi-state."
|
|
|
|
|
(if (and (eq viper-current-state 'vi-state) (interactive-p))
|
|
|
|
|
(beep 1)
|
|
|
|
|
ad-do-it
|
|
|
|
|
))
|
|
|
|
|
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(defadvice set-cursor-color (after viper-set-cursor-color-ad activate)
|
|
|
|
|
"Change cursor color in VI state."
|
|
|
|
|
;;(setq viper-vi-state-cursor-color (ad-get-arg 0))
|
|
|
|
|
(modify-frame-parameters
|
|
|
|
|
(selected-frame)
|
|
|
|
|
(list (cons 'viper-vi-state-cursor-color (ad-get-arg 0))))
|
|
|
|
|
)
|
|
|
|
|
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(when (and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
|
|
|
|
;; needs to be as early as possible
|
|
|
|
|
(add-to-ordered-list
|
|
|
|
|
'emulation-mode-map-alists 'viper--intercept-key-maps 100)
|
|
|
|
|
;; needs to be after cua-mode
|
|
|
|
|
(add-to-ordered-list 'emulation-mode-map-alists 'viper--key-maps 500)
|
|
|
|
|
)
|
|
|
|
|
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
;; Emacs shell, ange-ftp, and comint-based modes
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(add-hook 'comint-mode-hook 'viper-comint-mode-hook) ; comint
|
1996-09-06 01:17:30 +00:00
|
|
|
|
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(add-hook 'eshell-mode-hook
|
|
|
|
|
(lambda () (setq viper-auto-indent nil)))
|
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'dired-mode) ; dired
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'tar-mode) ; tar
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'mh-folder-mode) ; mhe
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'gnus-group-mode) ; gnus
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'gnus-summary-mode)
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'Info-mode) ; info
|
|
|
|
|
(viper-set-emacs-state-searchstyle-macros nil 'Buffer-menu-mode) ;buffer-menu
|
1996-09-06 01:17:30 +00:00
|
|
|
|
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; Modify major modes according to viper-major-mode-modifier-list
|
|
|
|
|
(viper-apply-major-mode-modifiers)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; For RMAIL users.
|
|
|
|
|
;; Put buf in Emacs state after edit.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(eval-after-load
|
1995-02-20 23:15:10 +00:00
|
|
|
|
"rmailedit"
|
1997-08-02 07:40:22 +00:00
|
|
|
|
'(defadvice rmail-cease-edit (after viper-rmail-advice activate)
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
"Switch to emacs state when done editing message."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-emacs)))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; In case RMAIL was loaded before Viper.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice rmail-cease-edit (after viper-rmail-advice activate)
|
(vip-envelop-ESC-key): if an ESC-sequence translates
into a function key, pretend that this key was the last command event.
(vip-put-back,vip-Put-back): now emulate Vi's behavior
more closely.
(vip-line): no longer not bombs out.
(vip-exec-shift) now preserves the point.
Fixed the behavior of the Vi commands M, L, G, yw, dg, etc.
Changed vip-*-frame-* to *-frame-*, incorporated overlay strings,
unread-command-events, removed support for emacs versions 19.28 and
xemacs 19.11 and earlier.
1995-06-09 00:09:26 +00:00
|
|
|
|
"Switch to emacs state when done editing message."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-emacs))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
|
|
|
|
|
;; ISO accents
|
|
|
|
|
;; Need to do it after loading iso-acc, or else this loading will wipe out
|
|
|
|
|
;; the advice.
|
|
|
|
|
(eval-after-load
|
|
|
|
|
"iso-acc"
|
|
|
|
|
(defadvice iso-accents-mode (around viper-iso-accents-advice activate)
|
|
|
|
|
"Set viper-automatic-iso-accents to iso-accents-mode."
|
|
|
|
|
(let ((arg (ad-get-arg 0)))
|
|
|
|
|
ad-do-it
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(setq viper-automatic-iso-accents
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(if (eq viper-current-state 'vi-state)
|
|
|
|
|
(if arg
|
|
|
|
|
;; if iso-accents-mode was called with positive arg, turn
|
|
|
|
|
;; accents on
|
|
|
|
|
(> (prefix-numeric-value arg) 0)
|
|
|
|
|
;; else: toggle viper-automatic-iso-accents
|
|
|
|
|
(not viper-automatic-iso-accents))
|
|
|
|
|
;; other states: accept what iso-accents-mode has done
|
|
|
|
|
iso-accents-mode))
|
|
|
|
|
;; turn off ISO accents in vi-state
|
|
|
|
|
(if (eq viper-current-state 'vi-state)
|
|
|
|
|
(viper-set-iso-accents-mode nil))
|
|
|
|
|
(if (memq viper-current-state '(vi-state insert-state replace-state))
|
|
|
|
|
(message "Viper ISO accents mode: %s"
|
|
|
|
|
(if viper-automatic-iso-accents "on" "off")))
|
|
|
|
|
)))
|
|
|
|
|
|
|
|
|
|
;; International input methods
|
|
|
|
|
(if viper-emacs-p
|
|
|
|
|
(eval-after-load "mule-cmds"
|
|
|
|
|
(progn
|
|
|
|
|
(defadvice inactivate-input-method (after viper-mule-advice activate)
|
|
|
|
|
"Set viper-special-input-method to disable intl. input methods."
|
|
|
|
|
(viper-inactivate-input-method-action))
|
|
|
|
|
(defadvice activate-input-method (after viper-mule-advice activate)
|
|
|
|
|
"Set viper-special-input-method to enable intl. input methods."
|
|
|
|
|
(viper-activate-input-method-action))
|
|
|
|
|
))
|
|
|
|
|
;; XEmacs Although these hooks exist in Emacs, they don't seem to be always
|
|
|
|
|
;; called on input-method activation/deactivation, so we the above advise
|
|
|
|
|
;; functions instead.
|
|
|
|
|
(eval-after-load "mule-cmds"
|
|
|
|
|
(progn
|
|
|
|
|
(add-hook 'input-method-activate-hook
|
|
|
|
|
'viper-activate-input-method-action t)
|
|
|
|
|
(add-hook 'input-method-inactivate-hook
|
|
|
|
|
'viper-inactivate-input-method-action t)))
|
|
|
|
|
)
|
|
|
|
|
(eval-after-load "mule-cmds"
|
|
|
|
|
(defadvice toggle-input-method (around viper-mule-advice activate)
|
|
|
|
|
"Adjust input-method toggling in vi-state."
|
|
|
|
|
(if (and viper-special-input-method (eq viper-current-state 'vi-state))
|
|
|
|
|
(viper-inactivate-input-method)
|
|
|
|
|
ad-do-it)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
) ; viper-set-hooks
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
|
|
|
|
;; these are primarily advices and Vi-ish variable settings
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defun viper-non-hook-settings ()
|
|
|
|
|
|
|
|
|
|
;; This var is not local in Emacs, so we make it local. It must be local
|
|
|
|
|
;; because although the stack of minor modes can be the same for all buffers,
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; the associated *keymaps* can be different. In Viper,
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; viper-vi-local-user-map, viper-insert-local-user-map, and others can have
|
|
|
|
|
;; different keymaps for different buffers. Also, the keymaps associated
|
|
|
|
|
;; with viper-vi/insert-state-modifier-minor-mode can be different.
|
2005-08-06 16:58:54 +00:00
|
|
|
|
;; ***This is needed only in case emulation-mode-map-alists is not defined
|
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(viper-make-variable-buffer-local 'minor-mode-map-alist))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; Viper changes the default mode-line-buffer-identification
|
|
|
|
|
(setq-default mode-line-buffer-identification '(" %b"))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; setup emacs-supported vi-style feel
|
|
|
|
|
(setq next-line-add-newlines nil
|
|
|
|
|
require-final-newline t)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2005-09-20 17:47:28 +00:00
|
|
|
|
(viper-make-variable-buffer-local 'require-final-newline)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; don't bark when mark is inactive
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if viper-emacs-p
|
1997-07-18 18:55:36 +00:00
|
|
|
|
(setq mark-even-if-inactive t))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(setq scroll-step 1)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; Variable displaying the current Viper state in the mode line.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-deflocalvar viper-mode-string viper-emacs-state-id)
|
|
|
|
|
(or (memq 'viper-mode-string global-mode-string)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(setq global-mode-string
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(append '("" viper-mode-string) (cdr global-mode-string))))
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
2005-06-03 08:04:04 +00:00
|
|
|
|
(defadvice describe-key (before viper-describe-key-ad protect activate)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
"Force to read key via `viper-read-key-sequence'."
|
2005-06-03 08:04:04 +00:00
|
|
|
|
(interactive (list (viper-read-key-sequence "Describe key: "))
|
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice describe-key-briefly
|
2005-06-03 08:04:04 +00:00
|
|
|
|
(before viper-describe-key-briefly-ad protect activate)
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
"Force to read key via `viper-read-key-sequence'."
|
2002-02-10 06:46:12 +00:00
|
|
|
|
(interactive (list (viper-read-key-sequence "Describe key briefly: "))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice find-file (before viper-add-suffix-advice activate)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Use `read-file-name' for reading arguments."
|
|
|
|
|
(interactive (cons (read-file-name "Find file: " nil default-directory)
|
2000-06-05 00:07:02 +00:00
|
|
|
|
;; XEmacs: if Mule & prefix arg, ask for coding system
|
|
|
|
|
(cond ((and viper-xemacs-p (featurep 'mule))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(list
|
|
|
|
|
(and current-prefix-arg
|
2000-06-05 00:07:02 +00:00
|
|
|
|
(read-coding-system "Coding-system: "))))
|
|
|
|
|
;; Emacs: do wildcards
|
|
|
|
|
((and viper-emacs-p (boundp 'find-file-wildcards))
|
|
|
|
|
(list find-file-wildcards))))
|
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice find-file-other-window (before viper-add-suffix-advice activate)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Use `read-file-name' for reading arguments."
|
|
|
|
|
(interactive (cons (read-file-name "Find file in other window: "
|
|
|
|
|
nil default-directory)
|
2000-06-05 00:07:02 +00:00
|
|
|
|
;; XEmacs: if Mule & prefix arg, ask for coding system
|
|
|
|
|
(cond ((and viper-xemacs-p (featurep 'mule))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(list
|
|
|
|
|
(and current-prefix-arg
|
2000-06-05 00:07:02 +00:00
|
|
|
|
(read-coding-system "Coding-system: "))))
|
|
|
|
|
;; Emacs: do wildcards
|
|
|
|
|
((and viper-emacs-p (boundp 'find-file-wildcards))
|
|
|
|
|
(list find-file-wildcards))))
|
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice find-file-other-frame (before viper-add-suffix-advice activate)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Use `read-file-name' for reading arguments."
|
|
|
|
|
(interactive (cons (read-file-name "Find file in other frame: "
|
|
|
|
|
nil default-directory)
|
2000-06-05 00:07:02 +00:00
|
|
|
|
;; XEmacs: if Mule & prefix arg, ask for coding system
|
|
|
|
|
(cond ((and viper-xemacs-p (featurep 'mule))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(list
|
|
|
|
|
(and current-prefix-arg
|
2000-06-05 00:07:02 +00:00
|
|
|
|
(read-coding-system "Coding-system: "))))
|
|
|
|
|
;; Emacs: do wildcards
|
|
|
|
|
((and viper-emacs-p (boundp 'find-file-wildcards))
|
|
|
|
|
(list find-file-wildcards))))
|
|
|
|
|
))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice read-file-name (around viper-suffix-advice activate)
|
|
|
|
|
"Tell `exit-minibuffer' to run `viper-file-add-suffix' as a hook."
|
1997-09-05 04:48:58 +00:00
|
|
|
|
(let ((viper-minibuffer-exit-hook
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(append viper-minibuffer-exit-hook
|
|
|
|
|
'(viper-minibuffer-trim-tail viper-file-add-suffix))))
|
1997-06-18 01:26:55 +00:00
|
|
|
|
ad-do-it))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(defadvice start-kbd-macro (after viper-kbd-advice activate)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
"Remove Viper's intercepting bindings for C-x ).
|
|
|
|
|
This may be needed if the previous `:map' command terminated abnormally."
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(define-key viper-vi-intercept-map "\C-x)" nil)
|
|
|
|
|
(define-key viper-insert-intercept-map "\C-x)" nil)
|
|
|
|
|
(define-key viper-emacs-intercept-map "\C-x)" nil))
|
1997-08-07 04:48:48 +00:00
|
|
|
|
|
2005-07-10 18:46:24 +00:00
|
|
|
|
(defadvice add-minor-mode (after
|
|
|
|
|
viper-advice-add-minor-mode
|
|
|
|
|
(toggle name &optional keymap after toggle-fun)
|
|
|
|
|
activate)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
"Run viper-normalize-minor-mode-map-alist after adding a minor mode."
|
|
|
|
|
(viper-normalize-minor-mode-map-alist)
|
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list) (boundp 'emulation-mode-map-alists))
|
|
|
|
|
(setq-default minor-mode-map-alist minor-mode-map-alist)))
|
2005-07-10 18:46:24 +00:00
|
|
|
|
|
1997-08-07 04:48:48 +00:00
|
|
|
|
;; catch frame switching event
|
|
|
|
|
(if (viper-window-display-p)
|
|
|
|
|
(if viper-xemacs-p
|
|
|
|
|
(add-hook 'mouse-leave-frame-hook
|
|
|
|
|
'viper-remember-current-frame)
|
|
|
|
|
(defadvice handle-switch-frame (before viper-frame-advice activate)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
"Remember the selected frame before the switch-frame event."
|
1997-08-07 04:48:48 +00:00
|
|
|
|
(viper-remember-current-frame (selected-frame)))) )
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
) ; end viper-non-hook-settings
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
1997-08-07 04:48:48 +00:00
|
|
|
|
;; Ask only if this-command/last-command are nil, i.e., when loading
|
|
|
|
|
(cond ((and (eq viper-mode 'ask) (null this-command) (null last-command))
|
|
|
|
|
(save-window-excursion
|
|
|
|
|
(with-output-to-temp-buffer " *viper-info*"
|
|
|
|
|
(princ "
|
1997-06-18 01:26:55 +00:00
|
|
|
|
You have loaded Viper, and are about to Viperize your emacs!
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
Viper is a Package for Emacs Rebels and a venomous VI PERil,
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
|
|
|
|
It's time to decide: to Viperize or not to Viperize...
|
|
|
|
|
|
2003-02-04 13:24:35 +00:00
|
|
|
|
If you wish to Viperize AND make this your way of life, please put
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
|
|
|
|
(setq viper-mode t)
|
|
|
|
|
(require 'viper)
|
|
|
|
|
|
|
|
|
|
in your .emacs file (preferably, close to the top).
|
|
|
|
|
These two lines must come in the order given.
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
** Viper users:
|
|
|
|
|
**** The startup file name has been changed from .vip to .viper
|
|
|
|
|
**** All vip-* style names have been converted to viper-* style."))
|
1997-08-07 04:48:48 +00:00
|
|
|
|
(if (y-or-n-p "Viperize? ")
|
|
|
|
|
(setq viper-mode t)
|
|
|
|
|
(setq viper-mode nil))
|
|
|
|
|
(message "")
|
|
|
|
|
(kill-buffer " *viper-info*")))
|
|
|
|
|
|
1999-11-01 07:16:15 +00:00
|
|
|
|
;; If viper-mode is t, then just continue. Viper will kick in.
|
1997-08-07 04:48:48 +00:00
|
|
|
|
((eq viper-mode t))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
;; Otherwise, it was asking Viper was not loaded through .emacs
|
1997-08-07 04:48:48 +00:00
|
|
|
|
;; In this case, it was either through M-x viper-mode or via something
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; else, like the custom widget. If Viper was loaded through
|
1997-08-07 04:48:48 +00:00
|
|
|
|
;; M-x viper-mode, then viper will kick in anyway.
|
|
|
|
|
(t (setq viper-mode nil)))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
|
|
|
|
|
(defun viper-load-custom-file ()
|
|
|
|
|
(if (and (file-exists-p viper-custom-file-name)
|
|
|
|
|
(not noninteractive))
|
|
|
|
|
(load viper-custom-file-name)))
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
1997-06-09 04:00:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; save non-viper vars that Viper might change
|
|
|
|
|
(if (null viper-saved-non-viper-variables)
|
|
|
|
|
(setq viper-saved-non-viper-variables
|
|
|
|
|
(list
|
|
|
|
|
(cons 'next-line-add-newlines (list next-line-add-newlines))
|
|
|
|
|
(cons 'require-final-newline (list require-final-newline))
|
|
|
|
|
(cons 'scroll-step (list scroll-step))
|
|
|
|
|
(cons 'mode-line-buffer-identification
|
|
|
|
|
(list (default-value 'mode-line-buffer-identification)))
|
|
|
|
|
(cons 'global-mode-string (list global-mode-string))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(if viper-emacs-p
|
1997-07-18 18:55:36 +00:00
|
|
|
|
(cons 'mark-even-if-inactive (list mark-even-if-inactive)))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
)))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; Set some useful macros, advices
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; These must be BEFORE ~/.viper is loaded,
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; so the user can unrecord them in ~/.viper.
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(if viper-mode
|
|
|
|
|
(progn
|
|
|
|
|
;; set advices and some variables that give emacs Vi look.
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-non-hook-settings)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
|
|
|
|
|
;; repeat the 2nd previous command without rotating the command history
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-record-kbd-macro
|
|
|
|
|
(vector viper-repeat-from-history-key '\1) 'vi-state
|
|
|
|
|
[(meta x) v i p e r - r e p e a t - f r o m - h i s t o r y return] 't)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; repeat the 3d previous command without rotating the command history
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-record-kbd-macro
|
|
|
|
|
(vector viper-repeat-from-history-key '\2) 'vi-state
|
|
|
|
|
[(meta x) v i p e r - r e p e a t - f r o m - h i s t o r y return] 't)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
|
|
|
|
;; set macros for toggling case sensitivity and regexp search
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-set-searchstyle-toggling-macros nil)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
;; Make %%% toggle parsing comments for matching parentheses
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-set-parsing-style-toggling-macro nil)
|
|
|
|
|
|
|
|
|
|
;; ~/.viper is loaded if exists
|
|
|
|
|
(viper-load-custom-file)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; should be after loading custom file to avoid the pesky msg that
|
|
|
|
|
;; mouse-search/insert keys are already bound
|
|
|
|
|
(viper-bind-mouse-search-key)
|
|
|
|
|
(viper-bind-mouse-insert-key)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; Applying Viper customization -- runs after (load .viper)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
2001-11-16 18:37:52 +00:00
|
|
|
|
;; Save user settings or Viper defaults for vars controlled by
|
2003-02-04 13:24:35 +00:00
|
|
|
|
;; viper-expert-level
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(if (null viper-saved-user-settings)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(setq viper-saved-user-settings
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(list (cons 'viper-want-ctl-h-help (list viper-want-ctl-h-help))
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(cons 'viper-always (list viper-always))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(cons 'viper-no-multiple-ESC (list viper-no-multiple-ESC))
|
|
|
|
|
(cons 'viper-ex-style-motion (list viper-ex-style-motion))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(cons 'viper-ex-style-editing
|
|
|
|
|
(list viper-ex-style-editing))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(cons 'viper-want-emacs-keys-in-vi
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(list viper-want-emacs-keys-in-vi))
|
|
|
|
|
(cons 'viper-electric-mode (list viper-electric-mode))
|
|
|
|
|
(cons 'viper-want-emacs-keys-in-insert
|
|
|
|
|
(list viper-want-emacs-keys-in-insert))
|
|
|
|
|
(cons 'viper-re-search (list viper-re-search)))))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(if viper-mode
|
|
|
|
|
(progn
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-set-minibuffer-style)
|
|
|
|
|
(if viper-buffer-search-char
|
|
|
|
|
(viper-buffer-search-enable))
|
1997-08-22 03:15:57 +00:00
|
|
|
|
(viper-update-syntax-classes 'set-default)
|
1997-06-18 01:26:55 +00:00
|
|
|
|
))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;;; Familiarize Viper with some minor modes that have their own keymaps
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(if viper-mode
|
|
|
|
|
(progn
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-harness-minor-mode "compile")
|
|
|
|
|
(viper-harness-minor-mode "outline")
|
|
|
|
|
(viper-harness-minor-mode "allout")
|
|
|
|
|
(viper-harness-minor-mode "xref")
|
|
|
|
|
(viper-harness-minor-mode "lmenu")
|
|
|
|
|
(viper-harness-minor-mode "vc")
|
|
|
|
|
(viper-harness-minor-mode "ltx-math") ; LaTeX-math-mode in AUC-TeX, which
|
|
|
|
|
(viper-harness-minor-mode "latex") ; sits in one of these two files
|
|
|
|
|
(viper-harness-minor-mode "cyrillic")
|
|
|
|
|
(viper-harness-minor-mode "russian")
|
|
|
|
|
(viper-harness-minor-mode "view-less")
|
|
|
|
|
(viper-harness-minor-mode "view")
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(viper-harness-minor-mode "reftex")
|
1999-11-01 07:16:15 +00:00
|
|
|
|
(viper-harness-minor-mode "flyspell")
|
1997-06-18 01:26:55 +00:00
|
|
|
|
))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Intercept maps could go in viper-keym.el
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;; We keep them here in case someone redefines them in ~/.viper
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(define-key viper-vi-intercept-map viper-ESC-key 'viper-intercept-ESC-key)
|
|
|
|
|
(define-key viper-insert-intercept-map viper-ESC-key 'viper-intercept-ESC-key)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; This is taken care of by viper-insert-global-user-map.
|
|
|
|
|
;;(define-key viper-replace-map viper-ESC-key 'viper-intercept-ESC-key)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1996-09-06 01:17:30 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; The default viper-toggle-key is \C-z; for the novice, it suspends or
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; iconifies Emacs
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(define-key viper-vi-intercept-map viper-toggle-key 'viper-toggle-key-action)
|
|
|
|
|
(define-key
|
|
|
|
|
viper-emacs-intercept-map viper-toggle-key 'viper-change-state-to-vi)
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2005-08-06 16:58:54 +00:00
|
|
|
|
;;; Removed to avoid bad interaction with cua-mode.
|
1997-11-01 01:46:51 +00:00
|
|
|
|
;;; Escape from Emacs and Insert modes to Vi for one command
|
2005-08-06 16:58:54 +00:00
|
|
|
|
;;(define-key viper-emacs-intercept-map "\C-c\\" 'viper-escape-to-vi)
|
|
|
|
|
;;(define-key viper-insert-intercept-map "\C-c\\" 'viper-escape-to-vi)
|
1997-11-01 01:46:51 +00:00
|
|
|
|
|
|
|
|
|
(if viper-mode
|
1997-11-25 02:10:08 +00:00
|
|
|
|
(setq-default viper-emacs-intercept-minor-mode t
|
|
|
|
|
viper-emacs-local-user-minor-mode t
|
|
|
|
|
viper-emacs-global-user-minor-mode t
|
|
|
|
|
viper-emacs-kbd-minor-mode t
|
|
|
|
|
viper-emacs-state-modifier-minor-mode t))
|
|
|
|
|
(if (and viper-mode (eq viper-current-state 'emacs-state))
|
|
|
|
|
(setq viper-emacs-intercept-minor-mode t
|
|
|
|
|
viper-emacs-local-user-minor-mode t
|
|
|
|
|
viper-emacs-global-user-minor-mode t
|
|
|
|
|
viper-emacs-kbd-minor-mode t
|
|
|
|
|
viper-emacs-state-modifier-minor-mode t))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
|
|
|
|
|
1997-06-18 01:26:55 +00:00
|
|
|
|
(if (and viper-mode
|
2003-02-04 13:24:35 +00:00
|
|
|
|
(or viper-always
|
1997-07-17 19:37:07 +00:00
|
|
|
|
(and (< viper-expert-level 5) (> viper-expert-level 0))))
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-set-hooks))
|
2003-02-04 13:24:35 +00:00
|
|
|
|
|
2001-01-19 07:13:03 +00:00
|
|
|
|
;; Let all minor modes take effect after loading.
|
|
|
|
|
;; This may not be enough, so we also set default minor-mode-alist.
|
1995-02-20 23:15:10 +00:00
|
|
|
|
;; Without setting the default, new buffers that come up in emacs mode have
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;; minor-mode-map-alist = nil, unless we call viper-change-state-*
|
1997-11-01 01:46:51 +00:00
|
|
|
|
(if (and viper-mode (eq viper-current-state 'emacs-state))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
(progn
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(viper-change-state-to-emacs)
|
2005-08-06 16:58:54 +00:00
|
|
|
|
(unless
|
|
|
|
|
(and (fboundp 'add-to-ordered-list)
|
|
|
|
|
(boundp 'emulation-mode-map-alists))
|
|
|
|
|
(setq-default minor-mode-map-alist minor-mode-map-alist))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
|
* viper-ex.el (ex-token-list,ex-cmd-execute): Revamped, courtesy
of Scott Bronson.
(ex-cmd-assoc,ex-compile,ex-cmd-one-letr): New functions.
(viper-check-sub,viper-get-ex-command,viper-execute-ex-command):
Deleted functions.
(viper-get-ex-com-subr,viper-ex,ex-mark): Changed to use the new
ex-token-list.
(viper-get-ex-address-subr): convert registers to char data type.
* viper-util.el (viper-int-to-char,viper-char-equal): new
functions.
(viper-memq-char): use viper-int-to-char.
(viper-file-checked-in-p): use vc-locking-user, if vc doesn't have
vc-locking-state.
(viper-read-key): use viper-read-key-sequence.
* viper.el (viper-major-mode-modifier-list): added
inferior-emacs-lisp-mode.
(this-major-mode-requires-vi-state): new function that uses simple
heuristics to decide if vi state is appropriate.
(set-viper-state-in-major-mode): use this-major-mode-requires-vi-state.
(viper-non-hook-settings): don't advise read-key-sequence.
(viper-read-key-sequence): new function that replaces the
previously used advice to read-key-sequence.
* viper-cmd.el (viper-test-com-defun,viper-exec-change,
viper-exec-Change,viper-execute-com,viper-insert,viper-append,
viper-Append,viper-Insert,viper-open-line,viper-Open-line,
viper-open-line-at-point,viper-substitute,viper-overwrite,
viper-replace-char-subr,viper-forward-word,viper-forward-Word):
got rid of the negative character hack.
(viper-escape-to-state,viper-replace-state-exit-cmd):
use viper-read-key-sequence.
(viper-envelop-ESC-key): no need for ad-get-orig-definition.
(viper-minibuffer-standard-hook,viper-read-string-with-history):
don't override existing minibuffer-setup-hook.
(viper-mark-point,viper-goto-mark-subr,viper-brac-function):
convert registers to char data type.
(viper-autoindent): use viper-indent-line.
* viper-keym.el: use viper-exec-key-in-emacs.
* viper.texi: Added credits, new commands, like :make.
* ediff-util.el: Copyright years.
(ediff-choose-syntax-table): New function.
(ediff-setup): Use ediff-choose-syntax-table.
(ediff-file-checked-out-p,ediff-file-checked-in-p): check if
vc-state is available.
(ediff-make-temp-file): use ediff-coding-system-for-write.
* ediff-init.el (ediff-with-syntax-table): New macro, uses
with-syntax-table.
(ediff-coding-system-for-read): from ediff-diff.el
(ediff-coding-system-for-write): new variable.
(ediff-highest-priority): fixed the bug having to do with disappearing
overlays.
(ediff-file-remote-p): use file-remote-p, if available.
(ediff-listable-file): new function.
(ediff-file-attributes): use ediff-listable-file.
* ediff-mult.el (ediff-meta-insert-file-info1): use
ediff-listable-file.
* ediff-ptch.el (ediff-prompt-for-patch-file): use
ediff-coding-system-for-read.
(ediff-patch-file-internal): use ediff-coding-system-for-write.
* ediff-diff.el (ediff-coding-system-for-read): moved to ediff-init.el.
(ediff-match-diff3-line,ediff-get-diff3-group): improved pattern.
* ediff.el: Date of last update, copyright years.
* ediff-wind (ediff-setup-control-frame): Nill->nil.
* ediff.texi: added clarifications, acknowledgements.
2001-07-21 05:28:24 +00:00
|
|
|
|
(if (and viper-mode (this-major-mode-requires-vi-state major-mode))
|
1998-05-04 22:42:59 +00:00
|
|
|
|
(viper-mode))
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
2001-01-19 07:13:03 +00:00
|
|
|
|
(if viper-mode
|
|
|
|
|
(setq initial-major-mode
|
|
|
|
|
`(lambda ()
|
|
|
|
|
(funcall (quote ,initial-major-mode))
|
|
|
|
|
(set-viper-state-in-major-mode))
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
|
1997-08-02 07:40:22 +00:00
|
|
|
|
(run-hooks 'viper-load-hook) ; the last chance to change something
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-06-02 22:50:31 +00:00
|
|
|
|
(provide 'viper)
|
1995-02-20 23:15:10 +00:00
|
|
|
|
|
1997-07-17 19:37:07 +00:00
|
|
|
|
|
|
|
|
|
;;; Local Variables:
|
1997-08-02 07:40:22 +00:00
|
|
|
|
;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
|
1997-07-17 19:37:07 +00:00
|
|
|
|
;;; End:
|
|
|
|
|
|
2003-09-01 15:45:59 +00:00
|
|
|
|
;;; arch-tag: 5f3e844c-c4e6-4bbd-9b73-63bdc14e7d79
|
2001-07-15 19:53:53 +00:00
|
|
|
|
;;; viper.el ends here
|