]> code.delx.au - gnu-emacs/blobdiff - lisp/emulation/viper-init.el
* lisp/simple.el (undo-amalgamate-change-group): New function
[gnu-emacs] / lisp / emulation / viper-init.el
index 76a8c4106769778dbcdede3dfb04246e380a8560..ee093906771ac24908890d2b873cc886b78a2db2 100644 (file)
@@ -1,6 +1,6 @@
 ;;; viper-init.el --- some common definitions for Viper
 
 ;;; viper-init.el --- some common definitions for Viper
 
-;; Copyright (C) 1997-201 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2016 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
 
 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
 ;; Package: viper
@@ -96,13 +96,18 @@ In all likelihood, you don't need to bother with this setting."
 ;;; Macros
 
 (defmacro viper-deflocalvar (var default-value &optional documentation)
 ;;; Macros
 
 (defmacro viper-deflocalvar (var default-value &optional documentation)
+  "Define VAR as a buffer-local variable.
+DEFAULT-VALUE is the default value, and DOCUMENTATION is the
+docstring.  The variable becomes buffer-local whenever set."
+  (declare (indent defun))
   `(progn
     (defvar ,var ,default-value
   `(progn
     (defvar ,var ,default-value
-      ,(format "%s\n\(buffer local\)" documentation))
+      ,(format "%s\n(buffer local)" documentation))
     (make-variable-buffer-local ',var)))
 
 ;; (viper-loop COUNT BODY) Execute BODY COUNT times.
 (defmacro viper-loop (count &rest body)
     (make-variable-buffer-local ',var)))
 
 ;; (viper-loop COUNT BODY) Execute BODY COUNT times.
 (defmacro viper-loop (count &rest body)
+  (declare (indent defun))
   `(let ((count ,count))
     (while (> count 0)
       ,@body
   `(let ((count ,count))
     (while (> count 0)
       ,@body
@@ -274,7 +279,7 @@ The minor mode viper-vi-diehard-minor-mode is in effect when
 viper-expert-level is 1 or 2 or when viper-want-emacs-keys-in-vi is t.
 The minor mode viper-insert-diehard-minor-mode is in effect when
 viper-expert-level is 1 or 2 or if viper-want-emacs-keys-in-insert is t.
 viper-expert-level is 1 or 2 or when viper-want-emacs-keys-in-vi is t.
 The minor mode viper-insert-diehard-minor-mode is in effect when
 viper-expert-level is 1 or 2 or if viper-want-emacs-keys-in-insert is t.
-Use `M-x viper-set-expert-level' to change this.")
+Use `\\[viper-set-expert-level]' to change this.")
 
 ;; Max expert level supported by Viper.  This is NOT a user option.
 ;; It is here to make it hard for the user from resetting it.
 
 ;; Max expert level supported by Viper.  This is NOT a user option.
 ;; It is here to make it hard for the user from resetting it.
@@ -316,7 +321,7 @@ Use `M-x viper-set-expert-level' to change this.")
     ))
 
 ;; viper hook to run on input-method deactivation
     ))
 
 ;; viper hook to run on input-method deactivation
-(defun viper-inactivate-input-method-action ()
+(defun viper-deactivate-input-method-action ()
   (if (null viper-mule-hook-flag)
       ()
     (setq viper-special-input-method nil)
   (if (null viper-mule-hook-flag)
       ()
     (setq viper-special-input-method nil)
@@ -328,9 +333,9 @@ Use `M-x viper-set-expert-level' to change this.")
                             (or current-input-method default-input-method))
                   "")))))
 
                             (or current-input-method default-input-method))
                   "")))))
 
-(defun viper-inactivate-input-method ()
-  (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method))
-        (inactivate-input-method))
+(defun viper-deactivate-input-method ()
+  (cond ((and (featurep 'emacs) (fboundp 'deactivate-input-method))
+        (deactivate-input-method))
        ((and (featurep 'xemacs) (boundp 'current-input-method))
         ;; XEmacs had broken quail-mode for some time, so we are working around
         ;; it here
        ((and (featurep 'xemacs) (boundp 'current-input-method))
         ;; XEmacs had broken quail-mode for some time, so we are working around
         ;; it here
@@ -339,7 +344,9 @@ Use `M-x viper-set-expert-level' to change this.")
             (quail-delete-overlays))
         (setq describe-current-input-method-function nil)
         (setq current-input-method nil)
             (quail-delete-overlays))
         (setq describe-current-input-method-function nil)
         (setq current-input-method nil)
-        (run-hooks 'input-method-inactivate-hook)
+        (run-hooks
+         'input-method-inactivate-hook ; for backward compatibility
+         'input-method-deactivate-hook)
         (force-mode-line-update))
        ))
 (defun viper-activate-input-method ()
         (force-mode-line-update))
        ))
 (defun viper-activate-input-method ()
@@ -356,21 +363,12 @@ Use `M-x viper-set-expert-level' to change this.")
           ;; activate input method
           (viper-activate-input-method))
          (t ; deactivate input method
           ;; activate input method
           (viper-activate-input-method))
          (t ; deactivate input method
-          (viper-inactivate-input-method)))
+          (viper-deactivate-input-method)))
     ))
 
 
 ;; VI-style Undo
 
     ))
 
 
 ;; VI-style Undo
 
-;; Used to 'undo' complex commands, such as replace and insert commands.
-(viper-deflocalvar viper-undo-needs-adjustment nil)
-(put 'viper-undo-needs-adjustment 'permanent-local t)
-
-;; A mark that Viper puts on buffer-undo-list.  Marks the beginning of a
-;; complex command that must be undone atomically.  If inserted, it is
-;; erased by viper-change-state-to-vi and viper-repeat.
-(defconst viper-buffer-undo-list-mark 'viper)
-
 (defcustom viper-keep-point-on-undo nil
   "Non-nil means not to move point while undoing commands.
 This style is different from Emacs and Vi.  Try it to see if
 (defcustom viper-keep-point-on-undo nil
   "Non-nil means not to move point while undoing commands.
 This style is different from Emacs and Vi.  Try it to see if
@@ -417,7 +415,7 @@ delete the text being replaced, as in standard Vi."
 ;; (defcustom viper-emacs-state-cursor-color "Magenta"
 (defcustom viper-emacs-state-cursor-color nil
   "Cursor color when Viper is in Emacs state."
 ;; (defcustom viper-emacs-state-cursor-color "Magenta"
 (defcustom viper-emacs-state-cursor-color nil
   "Cursor color when Viper is in Emacs state."
-  :type 'string
+  :type '(choice (const nil) string)
   :group 'viper)
 
 ;; internal var, used to remember the default cursor color of emacs frames
   :group 'viper)
 
 ;; internal var, used to remember the default cursor color of emacs frames
@@ -456,7 +454,7 @@ color displays.  By default, the delimiters are used only on TTYs."
   :type 'boolean
   :group 'viper)
 
   :type 'boolean
   :group 'viper)
 
-(defcustom viper-read-buffer-function 'read-buffer
+(defcustom viper-read-buffer-function #'read-buffer
   "Function to use for prompting the user for a buffer name."
   :type 'symbol
   :group 'viper)
   "Function to use for prompting the user for a buffer name."
   :type 'symbol
   :group 'viper)
@@ -576,7 +574,7 @@ the Insert state."
 
 (defcustom viper-keep-point-on-repeat t
   "If t, don't move point when repeating previous command.
 
 (defcustom viper-keep-point-on-repeat t
   "If t, don't move point when repeating previous command.
-This is useful for doing repeated changes with the '.' key.
+This is useful for doing repeated changes with the `.' key.
 The user can change this to nil, if she likes when the cursor moves
 to a new place after repeating previous Vi command."
   :type 'boolean
 The user can change this to nil, if she likes when the cursor moves
 to a new place after repeating previous Vi command."
   :type 'boolean
@@ -683,7 +681,7 @@ to a new place after repeating previous Vi command."
 the window will be scrolled up or down appropriately, to reveal context.
 If you want Viper search to behave as usual in Vi, set this variable to a
 negative number."
 the window will be scrolled up or down appropriately, to reveal context.
 If you want Viper search to behave as usual in Vi, set this variable to a
 negative number."
-  :type 'boolean
+  :type 'integer
   :group 'viper-search)
 
 (defcustom viper-re-query-replace t
   :group 'viper-search)
 
 (defcustom viper-re-query-replace t
@@ -771,7 +769,7 @@ Related buffers can be cycled through via :R and :P commands."
          "^\\\\[sb][a-z]*{.*}\\s-*$\\|"                        ; latex
          "^@node\\|@table\\|^@m?enu\\|^@itemize\\|^@if\\|"     ; texinfo
          "^.+:-")                                              ; prolog
          "^\\\\[sb][a-z]*{.*}\\s-*$\\|"                        ; latex
          "^@node\\|@table\\|^@m?enu\\|^@itemize\\|^@if\\|"     ; texinfo
          "^.+:-")                                              ; prolog
-  "Regexps for Headings.  Used by \[\[ and \]\].")
+  "Regexps for Headings.  Used by [[ and ]].")
 
 (defvar viper-heading-end
   (concat "^}\\|"                                              ; C/C++
 
 (defvar viper-heading-end
   (concat "^}\\|"                                              ; C/C++
@@ -779,7 +777,7 @@ Related buffers can be cycled through via :R and :P commands."
          "^@end \\|"                                           ; texinfo
          ")\n\n[ \t\n]*\\|"                                    ; lisp
          "\\.\\s-*$")                                          ; prolog
          "^@end \\|"                                           ; texinfo
          ")\n\n[ \t\n]*\\|"                                    ; lisp
          "\\.\\s-*$")                                          ; prolog
-      "*Regexps to end Headings/Sections.  Used by \[\].")
+  "Regexps to end Headings/Sections.  Used by [].")
 
 
 ;; These two vars control the interaction of jumps performed by ' and `.
 
 
 ;; These two vars control the interaction of jumps performed by ' and `.
@@ -915,7 +913,7 @@ value refers to the number of characters affected."
 
 (defcustom viper-vi-style-in-minibuffer t
   "If t, use vi-style editing in minibuffer.
 
 (defcustom viper-vi-style-in-minibuffer t
   "If t, use vi-style editing in minibuffer.
-Should be set in `~/.viper' file."
+Should be set in `viper-custom-file-name'."
   :type 'boolean
   :group 'viper)
 
   :type 'boolean
   :group 'viper)