;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
+;;; Commentary:
-;; Code
+;;; Code:
;; Compiler pacifier
(defvar viper-overriding-map)
(symbol-function
(if viper-xemacs-p 'characterp 'integerp)))
-; CHAR is supposed to be a char or an integer; LIST is a list of chars, nil,
-; and negative numbers
-; Check if CHAR is a member by trying to convert into integers, if necessary.
-; Introduced for compatibility with XEmacs, where integers are not the same as
-; chars.
+(fset 'viper-int-to-char
+ (symbol-function
+ (if viper-xemacs-p 'int-to-char 'identity)))
+
+;; 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 (viper-emacs-p (memq char list))
- ((null char) (memq char list))
- ((characterp char) (memq char list))
- ((integerp char) (memq (int-to-char char) list))
- (t nil)))
+ (cond ((and (integerp char) (>= char 0))
+ (memq (viper-int-to-char 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))
+ (= (viper-int-to-char char-or-int) char))
+ ((eq char-or-int char))))
;; Like =, but accommodates null and also is t for eq-objects
(defun viper= (char char1)
(defun viper-append-filter-alist (lis1 lis2)
(let ((temp lis1)
elt)
-
;;filter-append the second list
(while temp
;; delete all occurrences
(nconc lis1 lis2)))
+
\f
;;; Support for :e, :r, :w file globbing
(and (featurep 'vc-hooks)
;; CVS files are considered not checked in
(not (memq (vc-backend file) '(nil CVS)))
- (not (memq (vc-state file) '(edited needs-merge)))
- (not (stringp (vc-state file)))))
+ (if (fboundp 'vc-state)
+ (progn
+ (not (memq (vc-state file) '(edited needs-merge)))
+ (not (stringp (vc-state file))))
+ ;; XEmacs has no vc-state
+ (not (vc-locking-user file)))
+ ))
;; checkout if visited file is checked in
(defun viper-maybe-checkout (buf)
help-char key)
(use-global-map viper-overriding-map)
(unwind-protect
- (setq key (elt (read-key-sequence nil) 0))
+ (setq key (elt (viper-read-key-sequence nil) 0))
(use-global-map global-map))
key))
;;; eval: (put 'viper-deflocalvar 'lisp-indent-hook 'defun)
;;; End:
-;;; viper-util.el ends here
+;;; viper-util.el ends here