summaryrefslogtreecommitdiff
path: root/lisp/emulation/viper-init.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emulation/viper-init.el')
-rw-r--r--lisp/emulation/viper-init.el54
1 files changed, 29 insertions, 25 deletions
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 2e06b24e0bb..d0f89751d57 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -26,8 +26,6 @@
;;; Code:
-(provide 'viper-init)
-
;; compiler pacifier
(defvar mark-even-if-inactive)
(defvar quail-mode)
@@ -49,10 +47,6 @@
(interactive)
(message "Viper version is %s" viper-version))
-;; Is it XEmacs?
-(defconst viper-xemacs-p (string-match "XEmacs" emacs-version))
-;; Is it Emacs?
-(defconst viper-emacs-p (not viper-xemacs-p))
;; Tell whether we are running as a window application or on a TTY
;; This is used to avoid compilation warnings. When emacs/xemacs forms can
@@ -61,7 +55,7 @@
;; compiler at hand.
;; Suggested by rms.
(defmacro viper-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
- (if (string-match "XEmacs" emacs-version)
+ (if (featurep 'xemacs)
xemacs-form emacs-form))
@@ -97,6 +91,13 @@
:tag "Is it VMS?"
:group 'viper-misc)
+(defcustom viper-suppress-input-method-change-message nil
+ "If t, the message notifying about changes in the input method is not displayed.
+Normally, a message is displayed each time on enters the vi, insert or replace
+state."
+ :type 'boolean
+ :group 'viper-misc)
+
(defcustom viper-force-faces nil
"If t, Viper will think that it is running on a display that supports faces.
This is provided as a temporary relief for users of graphics-capable terminals
@@ -109,8 +110,8 @@ In all likelihood, you don't need to bother with this setting."
(cond ((viper-window-display-p))
(viper-force-faces)
((viper-color-display-p))
- (viper-emacs-p (memq (viper-device-type) '(pc)))
- (viper-xemacs-p (memq (viper-device-type) '(tty pc)))))
+ ((featurep 'emacs) (memq (viper-device-type) '(pc)))
+ ((featurep 'xemacs) (memq (viper-device-type) '(tty pc)))))
;;; Macros
@@ -326,7 +327,8 @@ Use `M-x viper-set-expert-level' to change this.")
;; turn off special input methods in vi-state
(if (eq viper-current-state 'vi-state)
(viper-set-input-method nil))
- (if (memq viper-current-state '(vi-state insert-state replace-state))
+ (if (and (memq viper-current-state '(vi-state insert-state replace-state))
+ (not viper-suppress-input-method-change-message))
(message "Viper special input method%s: on"
(if (or current-input-method default-input-method)
(format " %S"
@@ -339,7 +341,8 @@ Use `M-x viper-set-expert-level' to change this.")
(if (null viper-mule-hook-flag)
()
(setq viper-special-input-method nil)
- (if (memq viper-current-state '(vi-state insert-state replace-state))
+ (if (and (memq viper-current-state '(vi-state insert-state replace-state))
+ (not viper-suppress-input-method-change-message))
(message "Viper special input method%s: off"
(if (or current-input-method default-input-method)
(format " %S"
@@ -347,9 +350,9 @@ Use `M-x viper-set-expert-level' to change this.")
"")))))
(defun viper-inactivate-input-method ()
- (cond ((and viper-emacs-p (fboundp 'inactivate-input-method))
+ (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method))
(inactivate-input-method))
- ((and viper-xemacs-p (boundp 'current-input-method))
+ ((and (featurep 'xemacs) (boundp 'current-input-method))
;; XEmacs had broken quil-mode for some time, so we are working around
;; it here
(setq quail-mode nil)
@@ -361,7 +364,7 @@ Use `M-x viper-set-expert-level' to change this.")
(force-mode-line-update))
))
(defun viper-activate-input-method ()
- (cond ((and viper-emacs-p (fboundp 'activate-input-method))
+ (cond ((and (featurep 'emacs) (fboundp 'activate-input-method))
(activate-input-method default-input-method))
((featurep 'xemacs)
(if (fboundp 'quail-mode) (quail-mode 1)))))
@@ -369,7 +372,7 @@ Use `M-x viper-set-expert-level' to change this.")
;; Set quail-mode to ARG
(defun viper-set-input-method (arg)
(setq viper-mule-hook-flag t) ; just a precaution
- (let (viper-mule-hook-flag) ; temporarily inactivate viper mule hooks
+ (let (viper-mule-hook-flag) ; temporarily deactivate viper mule hooks
(cond ((and arg (> (prefix-numeric-value arg) 0) default-input-method)
;; activate input method
(viper-activate-input-method))
@@ -424,15 +427,11 @@ delete the text being replaced, as in standard Vi."
"*Cursor color when Viper is in Replace state."
:type 'string
:group 'viper)
-(if (fboundp 'make-variable-frame-local)
- (make-variable-frame-local 'viper-replace-overlay-cursor-color))
(defcustom viper-insert-state-cursor-color "Green"
"Cursor color when Viper is in insert state."
:type 'string
:group 'viper)
-(if (fboundp 'make-variable-frame-local)
- (make-variable-frame-local 'viper-insert-state-cursor-color))
;; viper-emacs-state-cursor-color doesn't work well. Causes cursor colors to be
;; confused in some cases. So, this var is nulled for now.
@@ -441,13 +440,15 @@ delete the text being replaced, as in standard Vi."
"Cursor color when Viper is in Emacs state."
:type 'string
:group 'viper)
-(if (fboundp 'make-variable-frame-local)
- (make-variable-frame-local 'viper-emacs-state-cursor-color))
;; internal var, used to remember the default cursor color of emacs frames
(defvar viper-vi-state-cursor-color nil)
+
(if (fboundp 'make-variable-frame-local)
- (make-variable-frame-local 'viper-vi-state-cursor-color))
+ (dolist (v '(viper-replace-overlay-cursor-color
+ viper-insert-state-cursor-color viper-emacs-state-cursor-color
+ viper-vi-state-cursor-color))
+ (make-variable-frame-local v)))
(viper-deflocalvar viper-replace-overlay nil "")
(put 'viper-replace-overlay 'permanent-local t)
@@ -466,7 +467,7 @@ is non-nil."
:group 'viper)
(defcustom viper-use-replace-region-delimiters
(or (not (viper-has-face-support-p))
- (and viper-xemacs-p (eq (viper-device-type) 'tty)))
+ (and (featurep 'xemacs) (eq (viper-device-type) 'tty)))
"*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and
`viper-replace-region-start-delimiter' to delimit replacement regions, even on
color displays. By default, the delimiters are used only on TTYs."
@@ -1009,17 +1010,20 @@ Should be set in `~/.viper' file."
(defun viper-restore-cursor-type ()
(condition-case nil
- (if viper-xemacs-p
+ (if (featurep 'xemacs)
(set (make-local-variable 'bar-cursor) nil)
(setq cursor-type default-cursor-type))
(error nil)))
(defun viper-set-insert-cursor-type ()
- (if viper-xemacs-p
+ (if (featurep 'xemacs)
(set (make-local-variable 'bar-cursor) 2)
(setq cursor-type '(bar . 2))))
+(provide 'viper-init)
+
+
;; Local Variables:
;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
;; End: