(viper-cond-compile-for-xemacs-or-emacs): Delete macro.
authorGlenn Morris <rgm@gnu.org>
Sat, 1 Mar 2008 20:23:36 +0000 (20:23 +0000)
committerGlenn Morris <rgm@gnu.org>
Sat, 1 Mar 2008 20:23:36 +0000 (20:23 +0000)
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.

lisp/ChangeLog
lisp/emulation/viper-init.el

index 045be91..e774809 100644 (file)
@@ -1,3 +1,50 @@
+2008-03-01  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/bytecomp.el (byte-compile-maybe-guarded): Restore
+       code commented out 2007-11-10.
+
+       * emulation/edt.el (zmacs-region-stays): Define for compiler once only.
+
+       * emulation/viper-init.el (viper-cond-compile-for-xemacs-or-emacs):
+       Delete macro.
+       * emulation/viper-cmd.el, emulation/viper-ex.el:
+       * emulation/viper-init.el, emulation/viper-keym.el:
+       * emulation/viper-mous.el, emulation/viper-util.el:
+       * emulation/viper.el:
+       Expand all viper-cond-compile-for-xemacs-or-emacs calls to a
+       featurep test.
+
+       Replace obselete frame-local variables with frame-parameters.
+       * emulation/viper-init.el (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.
+       * emulation/viper-util.el (viper-frame-value): New macro.
+       * emulation/viper-cmd.el (viper-insert-state-post-command-sentinel)
+       (viper-R-state-post-command-sentinel)
+       (viper-replace-state-post-command-sentinel)
+       (viper-change-state-to-insert, viper-change-state-to-emacs):
+       * emulation/viper-util.el (viper-set-cursor-color-according-to-state)
+       (viper-save-cursor-color, viper-get-saved-cursor-color-in-replace-mode)
+       (viper-get-saved-cursor-color-in-insert-mode)
+       (viper-get-saved-cursor-color-in-emacs-mode, viper-set-replace-overlay):
+       Use viper-frame-value for viper-replace-overlay-cursor-color,
+       viper-emacs-state-cursor-color, viper-insert-state-cursor-color, and
+       viper-vi-state-cursor-color values.
+
+       * emulation/viper-cmd.el (zmacs-region-stays):
+       * emulation/viper-util.el (zmacs-region-stays): No need to define
+       for compiler.
+
+       * emulation/viper-keym.el (viper-add-keymap): Use mapc rather than
+       mapcar on Emacs.
+
+       * emulation/viper-mous.el (viper-counting-clicks-p): Only define
+       on XEmacs.
+
+       * emulation/viper-util.el (viper-set-minibuffer-overlay): Use when
+       rather than if.
+
 2008-03-01  Vinicius Jose Latorre  <viniciusjl@ig.com.br>
 
        * whitespace.el: New version 9.3.  As the glyph code generation was
@@ -42,8 +89,6 @@
        * diff-mode.el (diff-sanity-check-hunk): Only accept an empty line if
        we still expect more lines.
 
-2008-03-01  Stefan Monnier  <monnier@iro.umontreal.ca>
-
        * textmodes/fill.el (fill-comment-paragraph): Don't try to do
        comment-paragraph filling if the commark doesn't match
        comment-start-skip.
index d0f8975..d14e34b 100644 (file)
 
 ;; 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
-;; generate compile time warnings, we use this macro.
-;; In this case, the macro will expand into the form that is appropriate to the
-;; compiler at hand.
-;; Suggested by rms.
-(defmacro viper-cond-compile-for-xemacs-or-emacs (xemacs-form emacs-form)
-  (if (featurep 'xemacs)
-      xemacs-form emacs-form))
-
-
 (defsubst viper-device-type ()
-  (viper-cond-compile-for-xemacs-or-emacs
-   (device-type (selected-device))
-   window-system
-   ))
+  (if (featurep 'xemacs)
+      (device-type (selected-device))
+    window-system))
 
 (defun viper-color-display-p ()
   (condition-case nil
-      (viper-cond-compile-for-xemacs-or-emacs
-       (eq (device-class (selected-device)) 'color) ; xemacs form
-       (if (fboundp 'display-color-p) ; emacs form
-          (display-color-p)
-        (x-display-color-p))
-       )
+      (if (featurep 'xemacs)
+          (eq (device-class (selected-device)) 'color)
+        (display-color-p))
     (error nil)))
 
 ;; 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.")
   (cond ((and (featurep 'emacs) (fboundp 'inactivate-input-method))
         (inactivate-input-method))
        ((and (featurep 'xemacs) (boundp 'current-input-method))
-        ;; XEmacs had broken quil-mode for some time, so we are working around
+        ;; XEmacs had broken quail-mode for some time, so we are working around
         ;; it here
         (setq quail-mode nil)
         (if (featurep 'quail)
@@ -444,11 +430,14 @@ 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)
 
-(if (fboundp 'make-variable-frame-local)
-    (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)))
+;; Frame-local variables are obsolete from Emacs 22.2 onwards, so we
+;; do it by hand with viper-frame-value (qv).
+(when (and (featurep 'xemacs)
+           (fboundp 'make-variable-frame-local))
+  (make-variable-frame-local 'viper-replace-overlay-cursor-color)
+  (make-variable-frame-local 'viper-insert-state-cursor-color)
+  (make-variable-frame-local 'viper-emacs-state-cursor-color)
+  (make-variable-frame-local 'viper-vi-state-cursor-color))
 
 (viper-deflocalvar viper-replace-overlay nil "")
 (put 'viper-replace-overlay 'permanent-local t)
@@ -480,19 +469,13 @@ color displays.  By default, the delimiters are used only on TTYs."
   :group 'viper)
 
 ;; XEmacs requires glyphs
-(viper-cond-compile-for-xemacs-or-emacs
- (progn ; xemacs
-   (or (glyphp viper-replace-region-end-delimiter)
-       (setq viper-replace-region-end-delimiter
-            (make-glyph viper-replace-region-end-delimiter)))
-   (or (glyphp viper-replace-region-start-delimiter)
-       (setq viper-replace-region-start-delimiter
-            (make-glyph viper-replace-region-start-delimiter)))
-   )
-  nil ; emacs
- )
-
-
+(when (featurep 'xemacs)
+  (or (glyphp viper-replace-region-end-delimiter)
+      (setq viper-replace-region-end-delimiter
+            (make-glyph viper-replace-region-end-delimiter)))
+  (or (glyphp viper-replace-region-start-delimiter)
+      (setq viper-replace-region-start-delimiter
+            (make-glyph viper-replace-region-start-delimiter))))
 
 ;; These are local marker that must be initialized to nil and moved with
 ;; `viper-move-marker-locally'