summaryrefslogtreecommitdiff
path: root/lisp/emulation/viper-cmd.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emulation/viper-cmd.el')
-rw-r--r--lisp/emulation/viper-cmd.el68
1 files changed, 35 insertions, 33 deletions
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 8ca8ee7190b..192eb99a570 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -194,9 +194,9 @@
viper-delete-backward-char
viper-join-lines
viper-delete-char))
- (memq (viper-event-key last-command-event)
- '(up down left right (meta f) (meta b)
- (control n) (control p) (control f) (control b)))))
+ (member (viper-event-key last-command-event)
+ '(up down left right (meta f) (meta b)
+ (control n) (control p) (control f) (control b)))))
(defsubst viper-insert-state-pre-command-sentinel ()
(or (viper-preserve-cursor-color)
@@ -466,6 +466,12 @@
;; Viper mode-changing commands and utilities
+(defcustom viper-enable-minibuffer-faces t
+ "If non-nil, viper uses distinct faces in the minibuffer."
+ :type 'boolean
+ :version "30.1"
+ :group 'viper-misc)
+
;; Modifies mode-line-buffer-identification.
(defun viper-refresh-mode-line ()
(setq-local viper-mode-string
@@ -561,14 +567,14 @@
))
;; minibuffer faces
- (if (viper-has-face-support-p)
+ (if (and (viper-has-face-support-p) viper-enable-minibuffer-faces)
(setq viper-minibuffer-current-face
(cond ((eq state 'emacs-state) viper-minibuffer-emacs-face)
((eq state 'vi-state) viper-minibuffer-vi-face)
((memq state '(insert-state replace-state))
viper-minibuffer-insert-face))))
- (if (viper-is-in-minibuffer)
+ (if (and (viper-is-in-minibuffer) viper-enable-minibuffer-faces)
(viper-set-minibuffer-overlay))
)
@@ -716,16 +722,12 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
(let (viper-vi-kbd-minor-mode
viper-insert-kbd-minor-mode
viper-emacs-kbd-minor-mode)
- (unwind-protect
- (progn
- (setq com
- (key-binding (setq key (read-key-sequence nil))))
- ;; In case of binding indirection--chase definitions.
- ;; Have to do it here because we execute this command under
- ;; different keymaps, so command-execute may not do the
- ;; right thing there
- (while (vectorp com) (setq com (key-binding com))))
- nil)
+ (setq com (key-binding (setq key (read-key-sequence nil))))
+ ;; In case of binding indirection--chase definitions.
+ ;; Have to do it here because we execute this command under
+ ;; different keymaps, so command-execute may not do the
+ ;; right thing there
+ (while (vectorp com) (setq com (key-binding com)))
;; Execute command com in the original Viper state, not in state
;; `state'. Otherwise, if we switch buffers while executing the
;; escaped to command, Viper's mode vars will remain those of
@@ -1705,8 +1707,8 @@ to in the global map, instead of cycling through the insertion ring."
(if (eq viper-current-state 'replace-state)
(undo 1)
(if viper-last-inserted-string-from-insertion-ring
- (backward-delete-char
- (length viper-last-inserted-string-from-insertion-ring))))
+ (delete-char
+ (- (length viper-last-inserted-string-from-insertion-ring)))))
)
;;first search through insertion history
(setq viper-temp-insertion-ring (ring-copy viper-insertion-ring)))
@@ -1944,16 +1946,16 @@ To turn this feature off, set this variable to nil."
(if found
()
(viper-tmp-insert-at-eob " [Please complete file name]")
- (unwind-protect
- (while (not (memq cmd
- '(exit-minibuffer viper-exit-minibuffer)))
- (setq cmd
- (key-binding (setq key (read-key-sequence nil))))
- (cond ((eq cmd 'self-insert-command)
- (insert key))
- ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
- nil)
- (t (command-execute cmd))))))))))
+
+ (while (not (memq cmd
+ '(exit-minibuffer viper-exit-minibuffer)))
+ (setq cmd
+ (key-binding (setq key (read-key-sequence nil))))
+ (cond ((eq cmd 'self-insert-command)
+ (insert key))
+ ((memq cmd '(exit-minibuffer viper-exit-minibuffer))
+ nil)
+ (t (command-execute cmd)))))))))
(defun viper-minibuffer-trim-tail ()
@@ -4635,7 +4637,7 @@ sensitive for VI-style look-and-feel."
(insert (substitute-command-keys "
Please specify your level of familiarity with the venomous VI PERil
\(and the VI Plan for Emacs Rescue).
-You can change it at any time by typing `\\[viper-set-expert-level]'
+You can change it at any time by typing \\[viper-set-expert-level]
1 -- BEGINNER: Almost all Emacs features are suppressed.
Feels almost like straight Vi. File name completion and
@@ -4722,15 +4724,15 @@ Please, specify your level now: "))
(defun viper-submit-report ()
"Submit bug report on Viper."
(interactive)
- (defvar x-display-color-p)
+ (defvar 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)
- (x-display-color-p (if (viper-window-display-p)
- (x-display-color-p)
- 'non-x))
+ (display-color-p (if (viper-window-display-p)
+ (display-color-p)
+ 'non-x))
(viper-frame-parameters (frame-parameters (selected-frame)))
(viper-minibuffer-emacs-face (if (viper-has-face-support-p)
(facep
@@ -4788,7 +4790,7 @@ Please, specify your level now: "))
'viper-expert-level
'major-mode
'window-system
- 'x-display-color-p
+ 'display-color-p
'viper-frame-parameters
'viper-minibuffer-vi-face
'viper-minibuffer-insert-face