summaryrefslogtreecommitdiff
path: root/lisp/emulation
diff options
context:
space:
mode:
authorMichael Kifer <kifer@cs.stonybrook.edu>1996-02-16 19:02:38 +0000
committerMichael Kifer <kifer@cs.stonybrook.edu>1996-02-16 19:02:38 +0000
commitb567ea16ab1cf9bd53a00f80fb3a2e5190f72846 (patch)
treed400e9de38803981d55879f7240a4bf7905d015e /lisp/emulation
parent5ec64991df4bb81f259ccd6f443f387b7de2bda6 (diff)
downloademacs-b567ea16ab1cf9bd53a00f80fb3a2e5190f72846.tar.gz
(ex-map-read-args,ex-unmap-read-args): fixed messages.
(vip-events-to-macro): delete nil in macro definitions.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/viper-macs.el57
1 files changed, 31 insertions, 26 deletions
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index cea440ebab3..3725804f50d 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -150,10 +150,11 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
'(?\b ?\d '^? '^H (control h) (control \?) backspace delete))
(setq key-seq (subseq key-seq 0 (- (length key-seq) 2))))
(setq message
- ":map%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string (vip-display-macro key-seq))
- ""))
+ (format
+ ":map%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string (vip-display-macro key-seq))
+ "")))
(message message)
(setq event (vip-read-key))
;;(setq event (vip-read-event))
@@ -215,20 +216,22 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
((member key '(tab (control i) ?\t))
(setq key-seq (subseq key-seq 0 (1- (length key-seq))))
(setq message
- ":unmap%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string
- (vip-display-macro key-seq))
- ""))
+ (format
+ ":unmap%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string
+ (vip-display-macro key-seq))
+ "")))
(setq key-seq
(vip-do-sequence-completion key-seq macro-alist message))
))
(setq message
- ":unmap%s %s"
- variant (if (> (length key-seq) 0)
- (prin1-to-string
- (vip-display-macro key-seq))
- ""))
+ (format
+ ":unmap%s %s"
+ variant (if (> (length key-seq) 0)
+ (prin1-to-string
+ (vip-display-macro key-seq))
+ "")))
(message message)
(setq event (vip-read-key))
;;(setq event (vip-read-event))
@@ -253,8 +256,11 @@ a key is a symbol, e.g., `a', `\\1', `f2', etc., or a list, e.g.,
))
+;; Terminate a Vi kbd macro.
+;; optional argument IGNORE, if t, indicates that we are dealing with an
+;; existing macro that needs to be registered, but there is no need to
+;; terminate a kbd macro.
(defun vip-end-mapping-kbd-macro (&optional ignore)
- "Terminate kbd macro."
(interactive)
(define-key vip-vi-intercept-map "\C-x)" nil)
(define-key vip-insert-intercept-map "\C-x)" nil)
@@ -769,15 +775,15 @@ there."
;; if seq of Viper key symbols (representing a macro) can be converted to a
;; string--do so. Otherwise, do nothing.
-(defun vip-display-macro (macro-name)
- (cond ((vip-char-symbol-sequence-p macro-name)
- (mapconcat 'symbol-name macro-name ""))
- ((vip-char-array-p macro-name)
- (mapconcat 'char-to-string macro-name ""))
- (t macro-name)))
+(defun vip-display-macro (macro-name-or-body)
+ (cond ((vip-char-symbol-sequence-p macro-name-or-body)
+ (mapconcat 'symbol-name macro-name-or-body ""))
+ ((vip-char-array-p macro-name-or-body)
+ (mapconcat 'char-to-string macro-name-or-body ""))
+ (t macro-name-or-body)))
(defun vip-events-to-macro (event-seq)
- (vconcat (mapcar 'vip-event-key event-seq)))
+ (vconcat (delq nil (mapcar 'vip-event-key event-seq))))
;; convert strings or arrays of characters to Viper macro form
(defun vip-char-array-to-macro (array)
@@ -788,10 +794,10 @@ there."
(setq macro vec))
(vconcat (mapcar 'vip-event-key macro))))
-;; For macros bodies and names, goes over and checks if all members are
+;; For macros bodies and names, goes over MACRO and checks if all members are
;; names of keys (actually, it only checks if they are symbols or lists
-;; if a digit is found, it is converted into a symbol (0 -> \0, etc).
-;; If not list or vector, doesn't change its argument
+;; if a digit is found, it is converted into a symbol (e.g., 0 -> \0, etc).
+;; If MACRO is not a list or vector -- doesn't change MACRO.
(defun vip-fixup-macro (macro)
(let ((len (length macro))
(idx 0)
@@ -810,7 +816,6 @@ there."
(setcar (nthcdr idx macro)
(intern (char-to-string (+ ?0 elt)))))
)))
- ;;(setq break t)))
((listp elt)
(vip-fixup-macro elt))
((symbolp elt) nil)