emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 519f9e1: Remove some additional XEmacs compat code from viper


From: Stefan Kangas
Subject: master 519f9e1: Remove some additional XEmacs compat code from viper
Date: Fri, 8 Oct 2021 14:54:53 -0400 (EDT)

branch: master
commit 519f9e144f1c1719156d98b67d5e5d78eb932f72
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Remove some additional XEmacs compat code from viper
    
    * lisp/emulation/viper-util.el (viper-memq-char): Make into
    obsolete function alias for 'memq'.  Update callers.
    (viper-char-equal): Make into obsolete function alias for 'eq'.
    Update callers.
    (viper-color-display-p): Make into obsolete function alias for
    'x-display-color-p'.  Update callers.
---
 lisp/emulation/viper-cmd.el  | 47 +++++++++++++++++++++-----------------------
 lisp/emulation/viper-ex.el   |  1 -
 lisp/emulation/viper-init.el |  8 ++------
 lisp/emulation/viper-mous.el |  5 ++---
 lisp/emulation/viper-util.el | 47 ++++++++++++--------------------------------
 lisp/emulation/viper.el      |  1 -
 6 files changed, 39 insertions(+), 70 deletions(-)

diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 9f3d515..59be3f4 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
 
@@ -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))
@@ -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)))
@@ -4714,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
@@ -4780,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 ef15779..85c8b87 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)
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index fe37048..a170d67 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,7 +44,7 @@
 
 (define-obsolete-function-alias 'viper-device-type #'window-system "27.1")
 
-(defun viper-color-display-p ()
+(defun x-display-color-p ()
   (condition-case nil
       (display-color-p)
     (error nil)))
@@ -81,7 +77,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)))))
 
 
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 02db39f..3d55690 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)
@@ -76,8 +75,8 @@ or a triple-click."
 
 ;; 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)
 
 
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index 0f6dceb..71043b1 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -29,9 +29,6 @@
 
 ;; 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)
@@ -64,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)
@@ -88,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))))
@@ -110,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
@@ -142,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
@@ -1183,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)))
@@ -1327,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)
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index e9c0fb5..1ee5365 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]