comparison lisp/emulation/viper-util.el @ 90201:fbb2bea03df9

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-69 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 474-484) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 88-91) - Merge from emacs--cvs-trunk--0 - Update FSF's address in GPL notices - Update from CVS
author Miles Bader <miles@gnu.org>
date Thu, 14 Jul 2005 08:02:00 +0000
parents f9a65d7ebd29 a4c59075cac8
children edf295560b5a
comparison
equal deleted inserted replaced
90200:f9a65d7ebd29 90201:fbb2bea03df9
39 (defvar ex-unix-type-shell-options) 39 (defvar ex-unix-type-shell-options)
40 (defvar viper-ex-tmp-buf-name) 40 (defvar viper-ex-tmp-buf-name)
41 (defvar viper-syntax-preference) 41 (defvar viper-syntax-preference)
42 (defvar viper-saved-mark) 42 (defvar viper-saved-mark)
43 43
44 (require 'cl)
45 (require 'ring) 44 (require 'ring)
46 45
47 (if noninteractive 46 (if noninteractive
48 (eval-when-compile 47 (eval-when-compile
49 (let ((load-path (cons (expand-file-name ".") load-path))) 48 (let ((load-path (cons (expand-file-name ".") load-path)))
1066 ?\e) 1065 ?\e)
1067 ;; pass symbol-event as is 1066 ;; pass symbol-event as is
1068 (t key))) 1067 (t key)))
1069 1068
1070 ((listp key) 1069 ((listp key)
1071 (setq modifiers (subseq key 0 (1- (length key))) 1070 (setq modifiers (viper-subseq key 0 (1- (length key)))
1072 base-key (viper-seq-last-elt key) 1071 base-key (viper-seq-last-elt key)
1073 base-key-name (symbol-name base-key) 1072 base-key-name (symbol-name base-key)
1074 char-p (= (length base-key-name) 1)) 1073 char-p (= (length base-key-name) 1))
1075 (setq mod-char-list 1074 (setq mod-char-list
1076 (mapcar 1075 (mapcar
1501 (setq total (+ total local))) 1500 (setq total (+ total local)))
1502 total 1501 total
1503 )) 1502 ))
1504 1503
1505 1504
1505 ;; this is copied from cl-extra.el
1506 ;; Return the subsequence of SEQ from START to END.
1507 ;; If END is omitted, it defaults to the length of the sequence.
1508 ;; If START or END is negative, it counts from the end.
1509 (defun viper-subseq (seq start &optional end)
1510 (if (stringp seq) (substring seq start end)
1511 (let (len)
1512 (and end (< end 0) (setq end (+ end (setq len (length seq)))))
1513 (if (< start 0) (setq start (+ start (or len (setq len (length seq))))))
1514 (cond ((listp seq)
1515 (if (> start 0) (setq seq (nthcdr start seq)))
1516 (if end
1517 (let ((res nil))
1518 (while (>= (setq end (1- end)) start)
1519 (push (pop seq) res))
1520 (nreverse res))
1521 (copy-sequence seq)))
1522 (t
1523 (or end (setq end (or len (length seq))))
1524 (let ((res (make-vector (max (- end start) 0) nil))
1525 (i 0))
1526 (while (< start end)
1527 (aset res i (aref seq start))
1528 (setq i (1+ i) start (1+ start)))
1529 res))))))
1530
1531
1506 1532
1507 (provide 'viper-util) 1533 (provide 'viper-util)
1508 1534
1509 1535
1510 ;;; Local Variables: 1536 ;;; Local Variables: