aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorGlenn Morris2008-03-01 20:23:36 +0000
committerGlenn Morris2008-03-01 20:23:36 +0000
commitce8fc80bbd0790fc7134bc620f8e6690e0080570 (patch)
tree66601ae53fa9b24f6232524b73ba0f8f13b218e3 /lisp/emulation
parentf3b9e4791f7da7911bd8838c4247b668356c4312 (diff)
downloademacs-ce8fc80bbd0790fc7134bc620f8e6690e0080570.tar.gz
emacs-ce8fc80bbd0790fc7134bc620f8e6690e0080570.zip
(viper-cond-compile-for-xemacs-or-emacs): Delete macro.
Expand all viper-cond-compile-for-xemacs-or-emacs calls to a featurep test. Replace obselete frame-local variables with frame-parameters. (viper-replace-overlay-cursor-color, viper-insert-state-cursor-color) (viper-emacs-state-cursor-color, viper-vi-state-cursor-color): Only call make-variable-frame-local on XEmacs.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-init.el61
1 files changed, 22 insertions, 39 deletions
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index d0f89751d57..d14e34b1340 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -49,30 +49,16 @@
49 49
50;; Tell whether we are running as a window application or on a TTY 50;; Tell whether we are running as a window application or on a TTY
51 51
52;; This is used to avoid compilation warnings. When emacs/xemacs forms can
53;; generate compile time warnings, we use this macro.
54;; In this case, the macro will expand into the form that is appropriate to the
55;; compiler at hand.
56;; Suggested by rms.
57(defmacro viper-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
58 (if (featurep 'xemacs)
59 xemacs-form emacs-form))
60
61
62(defsubst viper-device-type () 52(defsubst viper-device-type ()
63 (viper-cond-compile-for-xemacs-or-emacs 53 (if (featurep 'xemacs)
64 (device-type (selected-device)) 54 (device-type (selected-device))
65 window-system 55 window-system))
66 ))
67 56
68(defun viper-color-display-p () 57(defun viper-color-display-p ()
69 (condition-case nil 58 (condition-case nil
70 (viper-cond-compile-for-xemacs-or-emacs 59 (if (featurep 'xemacs)
71 (eq (device-class (selected-device)) 'color) ; xemacs form 60 (eq (device-class (selected-device)) 'color)
72 (if (fboundp 'display-color-p) ; emacs form 61 (display-color-p))
73 (display-color-p)
74 (x-display-color-p))
75 )
76 (error nil))) 62 (error nil)))
77 63
78;; in XEmacs: device-type is tty on tty and stream in batch. 64;; in XEmacs: device-type is tty on tty and stream in batch.
@@ -353,7 +339,7 @@ Use `M-x viper-set-expert-level' to change this.")
353 (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method)) 339 (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method))
354 (inactivate-input-method)) 340 (inactivate-input-method))
355 ((and (featurep 'xemacs) (boundp 'current-input-method)) 341 ((and (featurep 'xemacs) (boundp 'current-input-method))
356 ;; XEmacs had broken quil-mode for some time, so we are working around 342 ;; XEmacs had broken quail-mode for some time, so we are working around
357 ;; it here 343 ;; it here
358 (setq quail-mode nil) 344 (setq quail-mode nil)
359 (if (featurep 'quail) 345 (if (featurep 'quail)
@@ -444,11 +430,14 @@ delete the text being replaced, as in standard Vi."
444;; internal var, used to remember the default cursor color of emacs frames 430;; internal var, used to remember the default cursor color of emacs frames
445(defvar viper-vi-state-cursor-color nil) 431(defvar viper-vi-state-cursor-color nil)
446 432
447(if (fboundp 'make-variable-frame-local) 433;; Frame-local variables are obsolete from Emacs 22.2 onwards, so we
448 (dolist (v '(viper-replace-overlay-cursor-color 434;; do it by hand with viper-frame-value (qv).
449 viper-insert-state-cursor-color viper-emacs-state-cursor-color 435(when (and (featurep 'xemacs)
450 viper-vi-state-cursor-color)) 436 (fboundp 'make-variable-frame-local))
451 (make-variable-frame-local v))) 437 (make-variable-frame-local 'viper-replace-overlay-cursor-color)
438 (make-variable-frame-local 'viper-insert-state-cursor-color)
439 (make-variable-frame-local 'viper-emacs-state-cursor-color)
440 (make-variable-frame-local 'viper-vi-state-cursor-color))
452 441
453(viper-deflocalvar viper-replace-overlay nil "") 442(viper-deflocalvar viper-replace-overlay nil "")
454(put 'viper-replace-overlay 'permanent-local t) 443(put 'viper-replace-overlay 'permanent-local t)
@@ -480,19 +469,13 @@ color displays. By default, the delimiters are used only on TTYs."
480 :group 'viper) 469 :group 'viper)
481 470
482;; XEmacs requires glyphs 471;; XEmacs requires glyphs
483(viper-cond-compile-for-xemacs-or-emacs 472(when (featurep 'xemacs)
484 (progn ; xemacs 473 (or (glyphp viper-replace-region-end-delimiter)
485 (or (glyphp viper-replace-region-end-delimiter) 474 (setq viper-replace-region-end-delimiter
486 (setq viper-replace-region-end-delimiter 475 (make-glyph viper-replace-region-end-delimiter)))
487 (make-glyph viper-replace-region-end-delimiter))) 476 (or (glyphp viper-replace-region-start-delimiter)
488 (or (glyphp viper-replace-region-start-delimiter) 477 (setq viper-replace-region-start-delimiter
489 (setq viper-replace-region-start-delimiter 478 (make-glyph viper-replace-region-start-delimiter))))
490 (make-glyph viper-replace-region-start-delimiter)))
491 )
492 nil ; emacs
493 )
494
495
496 479
497;; These are local marker that must be initialized to nil and moved with 480;; These are local marker that must be initialized to nil and moved with
498;; `viper-move-marker-locally' 481;; `viper-move-marker-locally'