summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/cua-base.el47
-rw-r--r--lisp/emulation/cua-rect.el6
-rw-r--r--lisp/emulation/edt-mapper.el6
-rw-r--r--lisp/emulation/keypad.el4
-rw-r--r--lisp/emulation/viper-cmd.el68
-rw-r--r--lisp/emulation/viper-ex.el15
-rw-r--r--lisp/emulation/viper-init.el78
-rw-r--r--lisp/emulation/viper-keym.el19
-rw-r--r--lisp/emulation/viper-macs.el12
-rw-r--r--lisp/emulation/viper-mous.el10
-rw-r--r--lisp/emulation/viper-util.el86
-rw-r--r--lisp/emulation/viper.el7
12 files changed, 151 insertions, 207 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index 54f881bde8a..befcb423823 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -67,7 +67,7 @@
;; In addition to using the shifted movement keys, you can also use
;; [C-space] to start the region and use unshifted movement keys to extend
-;; it. To cancel the region, use [C-space] or [C-g].
+;; it. To cancel the region, use [C-space] or [C-g].
;; If you prefer to use the standard Emacs cut, copy, paste, and undo
;; bindings, customize cua-enable-cua-keys to nil.
@@ -116,7 +116,7 @@
;; "register commands".
;;
;; CUA's register support is activated by providing a numeric
-;; prefix argument to the C-x, C-c, and C-v commands. For example,
+;; prefix argument to the C-x, C-c, and C-v commands. For example,
;; to copy the selected region to register 2, enter [M-2 C-c].
;; Or if you have activated the keypad prefix mode, enter [kp-2 C-c].
;;
@@ -182,7 +182,7 @@
;; If you type a normal (self-inserting) character when the rectangle is
;; active, the character is inserted on the "current side" of every line
;; of the rectangle. The "current side" is the side on which the cursor
-;; is currently located. If the rectangle is only 1 column wide,
+;; is currently located. If the rectangle is only 1 column wide,
;; insertion will be performed to the left when the cursor is at the
;; bottom of the rectangle. So, for example, to comment out an entire
;; paragraph like this one, just place the cursor on the first character
@@ -330,9 +330,9 @@ See `cua-set-mark' for details."
"If non-nil, registers are supported via numeric prefix arg.
If the value is t, any numeric prefix arg in the range 0 to 9 will be
interpreted as a register number.
-If the value is `not-ctrl-u', using C-u to enter a numeric prefix is not
+If the value is `not-ctrl-u', using \\[universal-argument] to enter a numeric prefix is not
interpreted as a register number.
-If the value is `ctrl-u-only', only numeric prefix entered with C-u is
+If the value is `ctrl-u-only', only numeric prefix entered with \\[universal-argument] is
interpreted as a register number."
:type '(choice (const :tag "Disabled" nil)
(const :tag "Enabled, but C-u arg is not a register" not-ctrl-u)
@@ -360,7 +360,7 @@ managers, so try setting this to nil, if prefix override doesn't work."
:type 'boolean)
(defcustom cua-paste-pop-rotate-temporarily nil
- "If non-nil, \\[cua-paste-pop] only rotates the kill-ring temporarily.
+ "If non-nil, \\[cua-paste-pop] only rotates the kill ring temporarily.
This means that both \\[yank] and the first \\[yank-pop] in a sequence always
insert the most recently killed text. Each immediately following \\[cua-paste-pop]
replaces the previous text with the next older element on the `kill-ring'.
@@ -396,17 +396,17 @@ and after the region marked by the rectangle to search."
(defcustom cua-rectangle-mark-key [(control return)]
"Global key used to toggle the cua rectangle mark."
- :set #'(lambda (symbol value)
- (set symbol value)
- (when (and (boundp 'cua--keymaps-initialized)
- cua--keymaps-initialized)
- (define-key cua-global-keymap value
- #'cua-set-rectangle-mark)
- (when (boundp 'cua--rectangle-keymap)
- (define-key cua--rectangle-keymap value
- #'cua-clear-rectangle-mark)
- (define-key cua--region-keymap value
- #'cua-toggle-rectangle-mark))))
+ :set (lambda (symbol value)
+ (set symbol value)
+ (when (and (boundp 'cua--keymaps-initialized)
+ cua--keymaps-initialized)
+ (define-key cua-global-keymap value
+ #'cua-set-rectangle-mark)
+ (when (boundp 'cua--rectangle-keymap)
+ (define-key cua--rectangle-keymap value
+ #'cua-clear-rectangle-mark)
+ (define-key cua--region-keymap value
+ #'cua-toggle-rectangle-mark))))
:type 'key-sequence)
(defcustom cua-rectangle-modifier-key 'meta
@@ -699,6 +699,11 @@ Repeating prefix key when region is active works as a single prefix key."
(interactive)
(cua--prefix-override-replay 0))
+;; These aliases are so that we can look up the commands and find the
+;; correct keys when generating menus.
+(defalias 'cua-cut-handler #'cua--prefix-override-handler)
+(defalias 'cua-copy-handler #'cua--prefix-override-handler)
+
(defun cua--prefix-repeat-handler ()
"Repeating prefix key when region is active works as a single prefix key."
(interactive)
@@ -1140,7 +1145,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
def nil))
(defvar cua-global-keymap (make-sparse-keymap)
- "Global keymap for cua-mode; users may add to this keymap.")
+ "Global keymap for `cua-mode'; users may add to this keymap.")
(defvar cua--cua-keys-keymap (make-sparse-keymap))
(defvar cua--prefix-override-keymap (make-sparse-keymap))
@@ -1258,10 +1263,8 @@ If ARG is the atom `-', scroll upward by nearly full screen."
(define-key cua--cua-keys-keymap [(meta v)]
#'delete-selection-repeat-replace-region))
- (define-key cua--prefix-override-keymap [(control x)]
- #'cua--prefix-override-handler)
- (define-key cua--prefix-override-keymap [(control c)]
- #'cua--prefix-override-handler)
+ (define-key cua--prefix-override-keymap [(control x)] #'cua-cut-handler)
+ (define-key cua--prefix-override-keymap [(control c)] #'cua-copy-handler)
(define-key cua--prefix-repeat-keymap [(control x) (control x)]
#'cua--prefix-repeat-handler)
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 0039092fd6e..65ae2f192fa 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -710,9 +710,11 @@ Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear."
(nreverse rect)))
(defun cua--insert-rectangle (rect &optional below paste-column line-count)
- "Insert rectangle as insert-rectangle, but don't set mark and exit with
+ "Insert rectangle RECT similarly to `insert-rectangle'.
+In contrast to `insert-rectangle', don't set mark and exit with
point at either next to top right or below bottom left corner
-Notice: In overwrite mode, the rectangle is inserted as separate text lines."
+
+Note: In overwrite mode, the rectangle is inserted as separate text lines."
(if (eq below 'auto)
(setq below (and (bolp)
(or (eolp) (eobp) (= (1+ (point)) (point-max))))))
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index a723dbdbb90..8a42f893152 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -55,7 +55,7 @@
;; Usage:
-;; Simply load this file into emacs and run the function edt-mapper,
+;; Simply load this file into Emacs and run the function edt-mapper,
;; using the following command.
;; emacs -q -l edt-mapper -f edt-mapper
@@ -82,8 +82,8 @@
;; Sometimes, edt-mapper will ignore a key you press, and just
;; continue to prompt for the same key. This can happen when your
-;; window manager sucks up the key and doesn't pass it on to emacs,
-;; or it could be an emacs bug. Either way, there's nothing that
+;; window manager sucks up the key and doesn't pass it on to Emacs,
+;; or it could be an Emacs bug. Either way, there's nothing that
;; edt-mapper can do about it. You must press RETURN, to skip the
;; current key and continue. Later, you and/or your local Emacs guru
;; can try to figure out why the key is being ignored.
diff --git a/lisp/emulation/keypad.el b/lisp/emulation/keypad.el
index 56202c7fff8..4500faae57b 100644
--- a/lisp/emulation/keypad.el
+++ b/lisp/emulation/keypad.el
@@ -27,7 +27,7 @@
;;
;; With the following setup, the keypad can be used for numeric data
;; entry when NumLock is off, and to give numeric prefix arguments to
-;; emacs commands, when NumLock is on.
+;; Emacs commands, when NumLock is on.
;;
;; keypad-setup => Plain Numeric Keypad
;; keypad-numlock-setup => Prefix numeric args
@@ -203,7 +203,7 @@ keys are bound.
`S-cursor' Bind shifted keypad keys to the shifted cursor movement keys.
`cursor' Bind keypad keys to the cursor movement keys.
`numeric' Plain numeric keypad, i.e. 0 .. 9 and . (or DECIMAL arg)
- `none' Removes all bindings for keypad keys in function-key-map;
+ `none' Removes all bindings for keypad keys in `function-key-map';
this enables any user-defined bindings for the keypad keys
in the global and local keymaps.
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 728f790a962..59be3f48462 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -35,9 +35,7 @@
(defvar viper--key-maps)
(defvar viper--intercept-key-maps)
(defvar iso-accents-mode)
-(defvar quail-mode)
(defvar quail-current-str)
-(defvar mark-even-if-inactive)
(defvar viper--init-message)
(defvar viper-initial)
(defvar undo-beg-posn)
@@ -69,8 +67,7 @@
(nm-p (intern (concat snm "-p")))
(nms (intern (concat snm "s"))))
`(defun ,nm-p (com)
- (consp (viper-memq-char com ,nms)
- ))))
+ (consp (memq com ,nms)))))
;; Variables for defining VI commands
@@ -91,7 +88,7 @@
space return
delete backspace
)
- "Movement commands")
+ "Movement commands.")
;; define viper-movement-command-p
(viper-test-com-defun viper-movement-command)
@@ -487,7 +484,7 @@
(viper-change-state-to-vi))
(defun viper-set-mode-vars-for (state)
- "Sets Viper minor mode variables to put Viper's state STATE in effect."
+ "Set Viper minor mode variables to put Viper's state STATE in effect."
;; Emacs state
(setq viper-vi-minibuffer-minor-mode nil
@@ -1035,23 +1032,23 @@ as a Meta key and any number of multiple escapes are allowed."
cmd-info
cmd-to-exec-at-end)
(while (and cont
- (viper-memq-char char
- (list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\"
- viper-buffer-search-char)))
+ (memq char
+ (list ?c ?d ?y ?! ?< ?> ?= ?# ?r ?R ?\"
+ viper-buffer-search-char)))
(if com
;; this means that we already have a command character, so we
;; construct a com list and exit while. however, if char is "
;; it is an error.
(progn
;; new com is (CHAR . OLDCOM)
- (if (viper-memq-char char '(?# ?\")) (user-error viper-ViperBell))
+ (if (memq char '(?# ?\")) (user-error viper-ViperBell))
(setq com (cons char com))
(setq cont nil))
;; If com is nil we set com as char, and read more. Again, if char is
;; ", we read the name of register and store it in viper-use-register.
;; if char is !, =, or #, a complete com is formed so we exit the while
;; loop.
- (cond ((viper-memq-char char '(?! ?=))
+ (cond ((memq char '(?! ?=))
(setq com char)
(setq char (read-char))
(setq cont nil))
@@ -1091,7 +1088,7 @@ as a Meta key and any number of multiple escapes are allowed."
`(key-binding (char-to-string ,char)))))
;; as com is non-nil, this means that we have a command to execute
- (if (viper-memq-char (car com) '(?r ?R))
+ (if (memq (car com) '(?r ?R))
;; execute appropriate region command.
(let ((char (car com)) (com (cdr com)))
(setq prefix-arg (cons value com))
@@ -1197,7 +1194,7 @@ as a Meta key and any number of multiple escapes are allowed."
)
(defsubst viper-yank-last-insertion ()
- "Inserts the text saved by the previous viper-save-last-insertion command."
+ "Insert the text saved by the previous viper-save-last-insertion command."
(condition-case nil
(insert viper-last-insertion)
(error nil)))
@@ -1500,7 +1497,7 @@ Doesn't change viper-command-ring in any way, so `.' will work as before
executing this command.
This command is supposed to be bound to a two-character Vi macro where
the second character is a digit 0 to 9. The digit indicates which
-history command to execute. `<char>0' is equivalent to `.', `<char>1'
+history command to execute. `<char>0' is equivalent to `.', `<char>1'
invokes the command before that, etc."
(interactive)
(let* ((viper-intermediate-command 'repeating-display-destructive-command)
@@ -2603,12 +2600,12 @@ On reaching beginning of line, stop and signal error."
(let ((prev-char (viper-char-at-pos 'backward))
(saved-point (point)))
;; skip non-newline separators backward
- (while (and (not (viper-memq-char prev-char '(nil \n)))
+ (while (and (not (memq prev-char '(nil \n)))
(< lim (point))
;; must be non-newline separator
(if (eq viper-syntax-preference 'strict-vi)
- (viper-memq-char prev-char '(?\ ?\t))
- (viper-memq-char (char-syntax prev-char) '(?\ ?-))))
+ (memq prev-char '(?\ ?\t))
+ (memq (char-syntax prev-char) '(?\ ?-))))
(viper-backward-char-carefully)
(setq prev-char (viper-char-at-pos 'backward)))
@@ -2622,12 +2619,12 @@ On reaching beginning of line, stop and signal error."
;; skip again, but make sure we don't overshoot the limit
(if twice
- (while (and (not (viper-memq-char prev-char '(nil \n)))
+ (while (and (not (memq prev-char '(nil \n)))
(< lim (point))
;; must be non-newline separator
(if (eq viper-syntax-preference 'strict-vi)
- (viper-memq-char prev-char '(?\ ?\t))
- (viper-memq-char (char-syntax prev-char) '(?\ ?-))))
+ (memq prev-char '(?\ ?\t))
+ (memq (char-syntax prev-char) '(?\ ?-))))
(viper-backward-char-carefully)
(setq prev-char (viper-char-at-pos 'backward))))
@@ -2645,10 +2642,10 @@ On reaching beginning of line, stop and signal error."
(viper-forward-word-kernel val)
(if com
(progn
- (cond ((viper-char-equal com ?c)
+ (cond ((eq com ?c)
(viper-separator-skipback-special 'twice viper-com-point))
;; Yank words including the whitespace, but not newline
- ((viper-char-equal com ?y)
+ ((eq com ?y)
(viper-separator-skipback-special nil viper-com-point))
((viper-dotable-command-p com)
(viper-separator-skipback-special nil viper-com-point)))
@@ -2666,10 +2663,10 @@ On reaching beginning of line, stop and signal error."
(viper-skip-nonseparators 'forward)
(viper-skip-separators t))
(if com (progn
- (cond ((viper-char-equal com ?c)
+ (cond ((eq com ?c)
(viper-separator-skipback-special 'twice viper-com-point))
;; Yank words including the whitespace, but not newline
- ((viper-char-equal com ?y)
+ ((eq com ?y)
(viper-separator-skipback-special nil viper-com-point))
((viper-dotable-command-p com)
(viper-separator-skipback-special nil viper-com-point)))
@@ -3546,10 +3543,11 @@ If MODE is set, set the macros only in that major mode."
(defun viper-set-parsing-style-toggling-macro (unset)
- "Set `%%%' to be a macro that toggles whether comment fields should be parsed for matching parentheses.
+ "Set or unset `%%%' as a macro that toggles comment parsing for parentheses.
This is used in conjunction with the `%' command.
-
-With a prefix argument, unsets the macro."
+By default, sets the macro which will toggle whether comment fields should
+be parsed for matching parentheses. With a prefix argument, unsets the
+macro instead."
(interactive "P")
(or noninteractive
(if (not unset)
@@ -3766,7 +3764,7 @@ Null string will repeat previous search."
(define-key viper-vi-basic-map
(cond ((characterp viper-buffer-search-char)
(char-to-string viper-buffer-search-char))
- (t (error "viper-buffer-search-char: wrong value type, %S"
+ (t (error "viper-buffer-search-char: Wrong value type, %S"
viper-buffer-search-char)))
#'viper-command-argument)
(aset viper-exec-array viper-buffer-search-char #'viper-exec-buffer-search)
@@ -3838,7 +3836,7 @@ Null string will repeat previous search."
;; yank and pop
(defsubst viper-yank (text)
- "Yank TEXT silently. This works correctly with Emacs's yank-pop command."
+ "Yank TEXT silently. This works correctly with Emacs's `yank-pop' command."
(insert text)
(setq this-command 'yank))
@@ -4510,7 +4508,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 step back."
(defun viper-set-expert-level (&optional dont-change-unless)
- "Sets the expert level for a Viper user.
+ "Set the expert level for a Viper user.
Can be called interactively to change (temporarily or permanently) the
current expert level.
@@ -4713,15 +4711,15 @@ Please, specify your level now: "))
(defun viper-submit-report ()
"Submit bug report on Viper."
(interactive)
- (defvar viper-color-display-p)
+ (defvar x-display-color-p)
(defvar viper-frame-parameters)
(defvar viper-minibuffer-emacs-face)
(defvar viper-minibuffer-vi-face)
(defvar viper-minibuffer-insert-face)
(let ((reporter-prompt-for-summary-p t)
- (viper-color-display-p (if (viper-window-display-p)
- (viper-color-display-p)
- 'non-x))
+ (x-display-color-p (if (viper-window-display-p)
+ (x-display-color-p)
+ 'non-x))
(viper-frame-parameters (frame-parameters (selected-frame)))
(viper-minibuffer-emacs-face (if (viper-has-face-support-p)
(facep
@@ -4779,7 +4777,7 @@ Please, specify your level now: "))
'viper-expert-level
'major-mode
'window-system
- 'viper-color-display-p
+ 'x-display-color-p
'viper-frame-parameters
'viper-minibuffer-vi-face
'viper-minibuffer-insert-face
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index 5b2fa048a09..85c8b87b9a1 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -25,7 +25,6 @@
;;; Code:
;; Compiler pacifier
-(defvar read-file-name-map)
(defvar viper-use-register)
(defvar viper-s-string)
(defvar viper-shift-width)
@@ -1100,7 +1099,7 @@ reversed."
(setq viper-keep-reading-filename nil
val (read-file-name (concat prompt str) nil default-directory))
(setq val (expand-file-name val))
- (if (and (string-match " " val)
+ (if (and (string-search " " val)
(ex-cmd-accepts-multiple-files-p ex-token))
(setq val (concat "\"" val "\"")))
(setq str (concat str (if (equal val "") "" " ")
@@ -1798,7 +1797,7 @@ reversed."
set-cmd var auto-cmd-label)))
(if (and ask-if-save
- (y-or-n-p (format "Do you want to save this setting in %s "
+ (y-or-n-p (format "Do you want to save this setting in %s?"
viper-custom-file-name)))
(progn
(viper-save-string-in-file
@@ -1876,11 +1875,11 @@ reversed."
(message "Type `i' to search for a specific topic"))
(error (beep 1)
(with-output-to-temp-buffer " *viper-info*"
- (princ (format "
+ (princ "
The Info file for Viper does not seem to be installed.
This file is part of the standard distribution of Emacs.
-Please contact your system administrator. "))))))
+Please contact your system administrator. ")))))
;; Ex source command.
;; Loads the file specified as argument or viper-custom-file-name.
@@ -2176,7 +2175,7 @@ Please contact your system administrator. "))))))
(goto-char beg)))))
(defun ex-compile ()
- "Reads args from the command line, then runs make with the args.
+ "Read args from the command line, then run make with the args.
If no args are given, then it runs the last compile command.
Type `mak ' (including the space) to run make with no args."
(let (args)
@@ -2300,10 +2299,10 @@ Type `mak ' (including the space) to run make with no args."
(defun ex-print-display-lines (lines)
(cond
;; String doesn't contain a newline.
- ((not (string-match "\n" lines))
+ ((not (string-search "\n" lines))
(message "%s" lines))
;; String contains only one newline at the end. Strip it off.
- ((= (string-match "\n" lines) (1- (length lines)))
+ ((= (string-search "\n" lines) (1- (length lines)))
(message "%s" (substring lines 0 -1)))
;; String spans more than one line. Use a temporary buffer.
(t
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 8188971c0d0..e3790b74534 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -25,16 +25,12 @@
;;; Code:
;; compiler pacifier
-(defvar mark-even-if-inactive)
-(defvar quail-mode)
(defvar iso-accents-mode)
(defvar viper-current-state)
(defvar viper-version)
(defvar viper-expert-level)
(defvar current-input-method)
(defvar default-input-method)
-(defvar describe-current-input-method-function)
-(defvar bar-cursor)
(defvar cursor-type)
;; end pacifier
@@ -48,11 +44,6 @@
(define-obsolete-function-alias 'viper-device-type #'window-system "27.1")
-(defun viper-color-display-p ()
- (condition-case nil
- (display-color-p)
- (error nil)))
-
;; in XEmacs: device-type is tty on tty and stream in batch.
(defun viper-window-display-p ()
(and window-system (not (memq window-system '(tty stream pc)))))
@@ -81,7 +72,7 @@ In all likelihood, you don't need to bother with this setting."
(defun viper-has-face-support-p ()
(cond ((viper-window-display-p))
(viper-force-faces)
- ((viper-color-display-p))
+ ((x-display-color-p))
(t (memq window-system '(pc)))))
@@ -246,19 +237,19 @@ that deletes a file.")
;; Some common error messages
-(defconst viper-SpuriousText "Spurious text after command" "")
-(defconst viper-BadExCommand "Not an editor command" "")
-(defconst viper-InvalidCommandArgument "Invalid command argument" "")
-(defconst viper-NoPrevSearch "No previous search string" "")
-(defconst viper-EmptyRegister "`%c': Nothing in this register" "")
-(defconst viper-InvalidRegister "`%c': Invalid register" "")
-(defconst viper-EmptyTextmarker "`%c': Text marker doesn't point anywhere" "")
-(defconst viper-InvalidTextmarker "`%c': Invalid text marker" "")
-(defconst viper-InvalidViCommand "Invalid command" "")
-(defconst viper-BadAddress "Ill-formed address" "")
-(defconst viper-FirstAddrExceedsSecond "First address exceeds second" "")
-(defconst viper-NoFileSpecified "No file specified" "")
-(defconst viper-ViperBell "Viper bell" "")
+(defconst viper-SpuriousText "Spurious text after command")
+(defconst viper-BadExCommand "Not an editor command")
+(defconst viper-InvalidCommandArgument "Invalid command argument")
+(defconst viper-NoPrevSearch "No previous search string")
+(defconst viper-EmptyRegister "`%c': Nothing in this register")
+(defconst viper-InvalidRegister "`%c': Invalid register")
+(defconst viper-EmptyTextmarker "`%c': Text marker doesn't point anywhere")
+(defconst viper-InvalidTextmarker "`%c': Invalid text marker")
+(defconst viper-InvalidViCommand "Invalid command")
+(defconst viper-BadAddress "Ill-formed address")
+(defconst viper-FirstAddrExceedsSecond "First address exceeds second")
+(defconst viper-NoFileSpecified "No file specified")
+(defconst viper-ViperBell "Viper bell")
;; Is t until viper-mode executes for the very first time.
;; Prevents recursive descend into startup messages.
@@ -282,7 +273,7 @@ Use `\\[viper-set-expert-level]' to change this.")
;; If non-nil, ISO accents will be turned on in insert/replace emacs states and
;; turned off in vi-state. For some users, this behavior may be too
;; primitive. In this case, use insert/emacs/vi state hooks.
-(defvar-local viper-automatic-iso-accents nil "")
+(defvar-local viper-automatic-iso-accents nil)
;; Set iso-accents-mode to ARG. Check if it is bound first
(defsubst viper-set-iso-accents-mode (arg)
(if (boundp 'iso-accents-mode)
@@ -292,7 +283,7 @@ Use `\\[viper-set-expert-level]' to change this.")
;; Don't change this!
(defvar viper-mule-hook-flag t)
;; If non-nil, the default intl. input method is turned on.
-(defvar-local viper-special-input-method nil "")
+(defvar-local viper-special-input-method nil)
;; viper hook to run on input-method activation
(defun viper-activate-input-method-action ()
@@ -355,7 +346,7 @@ it better fits your working style."
;; Replace mode and changing text
;; Hack used to pass global states around for short period of time
-(defvar-local viper-intermediate-command nil "")
+(defvar-local viper-intermediate-command nil)
;; This is used to pass the right Vi command key sequence to
;; viper-set-destructive-command whenever (this-command-keys) doesn't give the
@@ -365,7 +356,7 @@ it better fits your working style."
(defconst viper-this-command-keys nil)
;; Indicates that the current destructive command has started in replace mode.
-(defvar-local viper-began-as-replace nil "")
+(defvar-local viper-began-as-replace nil)
(defcustom viper-allow-multiline-replace-regions t
"If non-nil, Viper will allow multi-line replace regions.
@@ -396,7 +387,7 @@ delete the text being replaced, as in standard Vi."
;; internal var, used to remember the default cursor color of emacs frames
(defvar viper-vi-state-cursor-color nil)
-(defvar-local viper-replace-overlay nil "")
+(defvar-local viper-replace-overlay nil)
(put 'viper-replace-overlay 'permanent-local t)
(defcustom viper-replace-region-end-delimiter "$"
@@ -434,18 +425,18 @@ color displays. By default, the delimiters are used only on TTYs."
(put 'viper-last-posn-in-replace-region 'permanent-local t)
(put 'viper-last-posn-while-in-insert-state 'permanent-local t)
-(defvar-local viper-sitting-in-replace nil "")
+(defvar-local viper-sitting-in-replace nil)
(put 'viper-sitting-in-replace 'permanent-local t)
;; Remember the number of characters that have to be deleted in replace
;; mode to compensate for the inserted characters.
-(defvar-local viper-replace-chars-to-delete 0 "")
+(defvar-local viper-replace-chars-to-delete 0)
;; This variable is used internally by the before/after changed functions to
;; determine how many chars were deleted by the change. This can't be
;; determined inside after-change-functions because those get the length of the
;; deleted region, not the number of chars deleted (which are two different
;; things under MULE).
-(defvar-local viper-replace-region-chars-deleted 0 "")
+(defvar-local viper-replace-region-chars-deleted 0)
;; Insertion ring and command ring
(defcustom viper-insertion-ring-size 14
@@ -494,7 +485,7 @@ will make it hard to use Vi-style timeout macros."
;; Autoindent in insert
;; Variable that keeps track of whether C-t has been pressed.
-(defvar-local viper-cted nil "")
+(defvar-local viper-cted nil)
;; Preserve the indent value, used by C-d in insert mode.
(defvar-local viper-current-indent 0)
@@ -502,14 +493,14 @@ will make it hard to use Vi-style timeout macros."
;; Whether to preserve the indent, used by C-d in insert mode.
(defvar-local viper-preserve-indent nil)
-(defvar-local viper-auto-indent nil "")
+(defvar-local viper-auto-indent nil)
(defcustom viper-auto-indent nil
"Enable autoindent, if t.
This is a buffer-local variable."
:type 'boolean
:group 'viper)
-(defvar-local viper-electric-mode t "")
+(defvar-local viper-electric-mode t)
(defcustom viper-electric-mode t
"If t, electrify Viper.
Currently, this only electrifies auto-indentation, making it appropriate to the
@@ -595,7 +586,7 @@ to a new place after repeating previous Vi command."
;;; Variables for Moves and Searches
(defgroup viper-search nil
- "Variables that define the search and query-replace behavior of Viper."
+ "Variables that define the search and `query-replace' behavior of Viper."
:prefix "viper-"
:group 'viper)
@@ -658,14 +649,14 @@ negative number."
:type 'boolean
:group 'viper)
-(defvar-local viper-ex-style-motion t "")
+(defvar-local viper-ex-style-motion t)
(defcustom viper-ex-style-motion t
"If t, the commands l,h do not cross lines, etc (Ex-style).
If nil, these commands cross line boundaries."
:type 'boolean
:group 'viper)
-(defvar-local viper-ex-style-editing t "")
+(defvar-local viper-ex-style-editing t)
(defcustom viper-ex-style-editing t
"If t, Ex-style behavior while editing in Vi command and insert states.
`Backspace' and `Delete' don't cross line boundaries in insert.
@@ -677,14 +668,14 @@ If nil, the above commands can work across lines."
:type 'boolean
:group 'viper)
-(defvar-local viper-ESC-moves-cursor-back viper-ex-style-editing "")
+(defvar-local viper-ESC-moves-cursor-back viper-ex-style-editing)
(defcustom viper-ESC-moves-cursor-back nil
"If t, ESC moves cursor back when changing from insert to vi state.
If nil, the cursor stays where it was when ESC was hit."
:type 'boolean
:group 'viper)
-(defvar-local viper-delete-backwards-in-replace nil "")
+(defvar-local viper-delete-backwards-in-replace nil)
(defcustom viper-delete-backwards-in-replace nil
"If t, DEL key will delete characters while moving the cursor backwards.
If nil, the cursor will move backwards without deleting anything."
@@ -702,7 +693,7 @@ If nil, the cursor will move backwards without deleting anything."
:tag "Search Wraps Around"
:group 'viper-search)
-(defvar-local viper-related-files-and-buffers-ring nil "")
+(defvar-local viper-related-files-and-buffers-ring nil)
(defcustom viper-related-files-and-buffers-ring nil
"List of file and buffer names to consider related to the current buffer.
Related buffers can be cycled through via :R and :P commands."
@@ -839,8 +830,7 @@ to customize the actual face object `viper-minibuffer-vi'
this variable represents.")
;; the current face to be used in the minibuffer
-(defvar-local
- viper-minibuffer-current-face viper-minibuffer-emacs-face "")
+(defvar-local viper-minibuffer-current-face viper-minibuffer-emacs-face)
;;; Miscellaneous
@@ -933,7 +923,9 @@ Should be set in `viper-custom-file-name'."
(setq cursor-type '(bar . 2)))
(defun viper-ESC-keyseq-timeout ()
- "Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
+ "Return the timeout for considering an ESC sequence to be a function key.
+Sequences of keys beginning with ESC and separated by no more than this many
+milliseconds are considered to be generated by a keyboard function key.
Setting this too high may slow down switching from insert to vi state. Setting
this value too low will make it impossible to use function keys in insert mode
on a dumb terminal."
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index 4a9070e84be..2f7d17351dc 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -69,7 +69,8 @@ major mode in effect."
:group 'viper)
(defcustom viper-want-ctl-h-help nil
- "If non-nil, bind C-h to help-command; otherwise, C-h gets the usual Vi bindings."
+ "If non-nil, bind C-h to `help-command'.
+If nil, C-h gets the usual Vi bindings."
:type 'boolean
:group 'viper)
@@ -86,8 +87,8 @@ major mode in effect."
"Keymap for user-defined local bindings.
Useful for changing bindings such as ZZ in certain major modes.
For instance, in letter-mode, one may want to bind ZZ to
-mh-send-letter. In a newsreader such as gnus, tin, or rn, ZZ could be bound
-to save-buffers-kill-emacs then post article, etc.")
+`mh-send-letter'. In a newsreader such as gnus, tin, or rn, ZZ could be bound
+to `save-buffers-kill-emacs' then post article, etc.")
(put 'viper-vi-local-user-map 'permanent-local t)
(defvar viper-vi-global-user-map (make-sparse-keymap)
@@ -181,7 +182,7 @@ In insert mode, this key also functions as Meta."
:type 'string
:group 'viper)
-(defconst viper-ESC-key (kbd "ESC")
+(defconst viper-ESC-key [escape]
"Key used to ESC.")
@@ -211,17 +212,17 @@ In insert mode, this key also functions as Meta."
;; Tells viper-add-local-keys to create a new viper-vi-local-user-map for new
;; buffers. Not a user option.
-(defvar-local viper-need-new-vi-local-map t "")
+(defvar-local viper-need-new-vi-local-map t)
(put 'viper-need-new-vi-local-map 'permanent-local t)
;; Tells viper-add-local-keys to create a new viper-insert-local-user-map for
;; new buffers. Not a user option.
-(defvar-local viper-need-new-insert-local-map t "")
+(defvar-local viper-need-new-insert-local-map t)
(put 'viper-need-new-insert-local-map 'permanent-local t)
;; Tells viper-add-local-keys to create a new viper-emacs-local-user-map for
;; new buffers. Not a user option.
-(defvar-local viper-need-new-emacs-local-map t "")
+(defvar-local viper-need-new-emacs-local-map t)
(put 'viper-need-new-emacs-local-map 'permanent-local t)
@@ -491,7 +492,7 @@ ALIST is of the form ((KEY . FUNC) (KEY . FUNC) ...)
Normally, this would be called from a hook to a major mode or
on a per buffer basis.
Usage:
- (viper-add-local-keys state \\='((key-str . func) (key-str . func)...)) "
+ (viper-add-local-keys state \\='((key-str . func) (key-str . func)...))"
(let (map)
(cond ((eq state 'vi-state)
@@ -520,7 +521,7 @@ Usage:
(defun viper-zap-local-keys ()
"Unconditionally reset Viper viper-*-local-user-map's.
Rarely useful, but if you made a mistake by switching to a mode that adds
-undesirable local keys, e.g., comint-mode, then this function can restore
+undesirable local keys, e.g., `comint-mode', then this function can restore
sanity."
(interactive)
(setq viper-vi-local-user-map (make-sparse-keymap)
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index 94ab8178925..fb60f6a5458 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -166,7 +166,7 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
(if (member
key
'(?\b ?\d '^? '^H (control h) (control \?) backspace delete))
- (setq key-seq (viper-subseq key-seq 0 (- (length key-seq) 2))))
+ (setq key-seq (seq-subseq key-seq 0 (- (length key-seq) 2))))
(setq message
(format
":map%s %s"
@@ -230,9 +230,9 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
(cond ((member
key
'(?\b ?\d '^? '^H (control h) (control \?) backspace delete))
- (setq key-seq (viper-subseq key-seq 0 (- (length key-seq) 2))))
+ (setq key-seq (cl-subseq key-seq 0 (- (length key-seq) 2))))
((member key '(tab (control i) ?\t))
- (setq key-seq (viper-subseq key-seq 0 (1- (length key-seq))))
+ (setq key-seq (cl-subseq key-seq 0 (1- (length key-seq))))
(setq message
(format
":unmap%s %s"
@@ -611,7 +611,7 @@ mistakes in macro names to be passed to this function is to use
(if (null macro-alist-elt)
(setq macro-alist-elt (car next-best-match)
- unmatched-suffix (viper-subseq event-seq (cdr next-best-match))))
+ unmatched-suffix (cl-subseq event-seq (cdr next-best-match))))
(cond ((null macro-alist-elt))
((setq macro-body (viper-kbd-buf-definition macro-alist-elt)))
@@ -693,7 +693,7 @@ mistakes in macro names to be passed to this function is to use
(let ((len1 (length seq1))
(len2 (length seq2)))
(if (<= len1 len2)
- (equal seq1 (viper-subseq seq2 0 len1)))))
+ (equal seq1 (cl-subseq seq2 0 len1)))))
;; find the longest common prefix
(defun viper-common-seq-prefix (&rest seqs)
@@ -757,7 +757,7 @@ mistakes in macro names to be passed to this function is to use
(setq macro-def (car lis)
def-len (length (car macro-def)))
(if (and (>= str-len def-len)
- (equal (car macro-def) (viper-subseq str 0 def-len)))
+ (equal (car macro-def) (cl-subseq str 0 def-len)))
(if (or (viper-kbd-buf-definition macro-def)
(viper-kbd-mode-definition macro-def)
(viper-kbd-global-definition macro-def))
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 83fc5afafa5..3d55690bd6f 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -26,7 +26,6 @@
;; compiler pacifier
(defvar double-click-time)
-(defvar mouse-track-multi-click-time)
(defvar viper-search-start-marker)
(defvar viper-local-search-start-marker)
(defvar viper-search-history)
@@ -65,8 +64,7 @@ or a triple-click."
(defcustom viper-multiclick-timeout (if (viper-window-display-p)
double-click-time
500)
- "Time interval in millisecond within which successive mouse clicks are
-considered related."
+ "Time interval in milliseconds for mouse clicks to be considered related."
:type 'integer)
;; Local variable used to toggle wraparound search on click.
@@ -77,8 +75,8 @@ considered related."
;; remembers prefix argument to pass along to commands invoked by second
;; click.
-;; This is needed because in Emacs (not XEmacs), assigning to prefix-arg
-;; causes Emacs to count the second click as if it was a single click
+;; This is needed because assigning to prefix-arg causes Emacs to
+;; count the second click as if it was a single click
(defvar viper-global-prefix-argument nil)
@@ -116,7 +114,7 @@ considered related."
(buffer-name (viper-mouse-click-window-buffer click)))
(defsubst viper-mouse-click-posn (click)
- "Returns position of a click."
+ "Return position of a click."
(declare (obsolete nil "27.1"))
(posn-point (event-start click)))
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 51f7406ad26..71043b189db 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -25,12 +25,10 @@
;;; Code:
(require 'seq)
+(require 'cl-lib)
;; Compiler pacifier
(defvar viper-minibuffer-current-face)
-(defvar viper-minibuffer-insert-face)
-(defvar viper-minibuffer-vi-face)
-(defvar viper-minibuffer-emacs-face)
(defvar viper-replace-overlay-face)
(defvar viper-fast-keyseq-timeout)
(defvar ex-unix-type-shell)
@@ -63,22 +61,8 @@
(define-obsolete-function-alias 'viper-iconify
#'iconify-or-deiconify-frame "27.1")
-
-;; CHAR is supposed to be a char or an integer (positive or negative)
-;; LIST is a list of chars, nil, and negative numbers
-;; Check if CHAR is a member by trying to convert in characters, if necessary.
-;; Introduced for compatibility with XEmacs, where integers are not the same as
-;; chars.
-(defun viper-memq-char (char list)
- (cond ((and (integerp char) (>= char 0))
- (memq char list))
- ((memq char list))))
-
-;; Check if char-or-int and char are the same as characters
-(defun viper-char-equal (char-or-int char)
- (cond ((and (integerp char-or-int) (>= char-or-int 0))
- (= char-or-int char))
- ((eq char-or-int char))))
+(define-obsolete-function-alias 'viper-memq-char #'memq "29.1")
+(define-obsolete-function-alias 'viper-char-equal #'eq "29.1")
;; Like =, but accommodates null and also is t for eq-objects
(defun viper= (char char1)
@@ -87,8 +71,7 @@
(= char char1))
(t nil)))
-(defsubst viper-color-display-p ()
- (x-display-color-p))
+(define-obsolete-function-alias 'viper-color-display-p #'x-display-color-p "29.1")
(defun viper-get-cursor-color (&optional _frame)
(cdr (assoc 'cursor-color (frame-parameters))))
@@ -109,7 +92,7 @@ Otherwise return the normal value."
;; cursor colors
(defun viper-change-cursor-color (new-color &optional frame)
- (if (and (viper-window-display-p) (viper-color-display-p)
+ (if (and (viper-window-display-p) (x-display-color-p)
(stringp new-color) (x-color-defined-p new-color)
(not (string= new-color (viper-get-cursor-color))))
(modify-frame-parameters
@@ -141,7 +124,7 @@ Otherwise return the normal value."
;; By default, saves current frame cursor color before changing viper state
(defun viper-save-cursor-color (before-which-mode)
- (if (and (viper-window-display-p) (viper-color-display-p))
+ (if (and (viper-window-display-p) (x-display-color-p))
(let ((color (viper-get-cursor-color)))
(if (and (stringp color) (x-color-defined-p color)
;; there is something fishy in that the color is not saved if
@@ -927,7 +910,7 @@ Otherwise return the normal value."
(t key)))
((listp key)
- (setq modifiers (viper-subseq key 0 (1- (length key)))
+ (setq modifiers (cl-subseq key 0 (1- (length key)))
base-key (viper-seq-last-elt key)
base-key-name (symbol-name base-key)
char-p (= (length base-key-name) 1))
@@ -1091,14 +1074,11 @@ In addition, the symbol `_' may be considered alphanumeric if
`viper-syntax-preference' is `strict-vi' or `reformed-vi'.")
(defconst viper-strict-ALPHA-chars "a-zA-Z0-9_"
- "Regexp matching the set of alphanumeric characters acceptable to strict
-Vi.")
+ "Regexp matching the set of alphanumeric characters acceptable to strict Vi.")
(defconst viper-strict-SEP-chars " \t\n"
- "Regexp matching the set of alphanumeric characters acceptable to strict
-Vi.")
+ "Regexp matching the set of alphanumeric characters acceptable to strict Vi.")
(defconst viper-strict-SEP-chars-sans-newline " \t"
- "Regexp matching the set of alphanumeric characters acceptable to strict
-Vi.")
+ "Regexp matching the set of alphanumeric characters acceptable to strict Vi.")
(defconst viper-SEP-char-class " -"
"String of syntax classes for Vi separators.
@@ -1185,25 +1165,23 @@ This option is appropriate if you like Emacs-style words."
(looking-at (concat "[" viper-strict-ALPHA-chars addl-chars "]"))
(or
;; or one of the additional chars being asked to include
- (viper-memq-char char (viper-string-to-list addl-chars))
+ (memq char (viper-string-to-list addl-chars))
(and
;; not one of the excluded word chars (note:
;; viper-non-word-characters is a list)
- (not (viper-memq-char char viper-non-word-characters))
+ (not (memq char viper-non-word-characters))
;; char of the Viper-word syntax class
- (viper-memq-char (char-syntax char)
- (viper-string-to-list viper-ALPHA-char-class))))))
- ))
+ (memq (char-syntax char)
+ (viper-string-to-list viper-ALPHA-char-class))))))))
(defun viper-looking-at-separator ()
(let ((char (char-after (point))))
(if char
(if (eq viper-syntax-preference 'strict-vi)
- (viper-memq-char char (viper-string-to-list viper-strict-SEP-chars))
+ (memq char (viper-string-to-list viper-strict-SEP-chars))
(or (eq char ?\n) ; RET is always a separator in Vi
- (viper-memq-char (char-syntax char)
- (viper-string-to-list viper-SEP-char-class)))))
- ))
+ (memq (char-syntax char)
+ (viper-string-to-list viper-SEP-char-class)))))))
(defsubst viper-looking-at-alphasep (&optional addl-chars)
(or (viper-looking-at-separator) (viper-looking-at-alpha addl-chars)))
@@ -1329,8 +1307,7 @@ This option is appropriate if you like Emacs-style words."
;; of the excluded characters
(if (and (eq syntax-of-char-looked-at ?w)
(not negated-syntax))
- (not (viper-memq-char
- char-looked-at viper-non-word-characters))
+ (not (memq char-looked-at viper-non-word-characters))
t))
(funcall skip-syntax-func 1)
0)
@@ -1345,32 +1322,7 @@ This option is appropriate if you like Emacs-style words."
(not (eq (get-char-property (point) 'field)
(get-char-property (1- (point)) 'field)))))
-
-;; this is copied from cl-extra.el
-;; Return the subsequence of SEQ from START to END.
-;; If END is omitted, it defaults to the length of the sequence.
-;; If START or END is negative, it counts from the end.
-(defun viper-subseq (seq start &optional end)
- (if (stringp seq) (substring seq start end)
- (let (len)
- (and end (< end 0) (setq end (+ end (setq len (length seq)))))
- (if (< start 0) (setq start (+ start (or len (setq len (length seq))))))
- (cond ((listp seq)
- (if (> start 0) (setq seq (nthcdr start seq)))
- (if end
- (let ((res nil))
- (while (>= (setq end (1- end)) start)
- (push (pop seq) res))
- (nreverse res))
- (copy-sequence seq)))
- (t
- (or end (setq end (or len (length seq))))
- (let ((res (make-vector (max (- end start) 0) nil))
- (i 0))
- (while (< start end)
- (aset res i (aref seq start))
- (setq i (1+ i) start (1+ start)))
- res))))))
+(define-obsolete-function-alias 'viper-subseq #'cl-subseq "28.1")
(provide 'viper-util)
;;; viper-util.el ends here
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index cce51174336..1ee53651264 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -15,7 +15,7 @@
;; of the bug report be sent to the maintainer's email address.
(defconst viper-version "3.14.2 of July 4, 2013"
- "The current version of Viper")
+ "The current version of Viper.")
;; This file is part of GNU Emacs.
@@ -304,7 +304,6 @@
;; compiler pacifier
(defvar mark-even-if-inactive)
-(defvar quail-mode)
(defvar viper-expert-level)
(defvar viper-mode-string)
(defvar viper-major-mode-modifier-list)
@@ -516,7 +515,7 @@ If Viper is enabled, turn it off. Otherwise, turn it on."
;;;###autoload
(defun viper-mode ()
- "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'."
+ "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'."
(interactive)
(if (not noninteractive)
(progn
@@ -577,7 +576,7 @@ For more information on Viper:
To submit a bug report or to contact the author, type :submitReport in Vi
command mode. To shoo Viper away and return to pure Emacs (horror!), type:
- M-x viper-go-away
+ \\[viper-go-away]
This startup message appears whenever you load Viper, unless you type `y' now."
))