diff options
| author | Michael Kifer | 1996-02-16 19:02:38 +0000 |
|---|---|---|
| committer | Michael Kifer | 1996-02-16 19:02:38 +0000 |
| commit | edff961b129a26ad5364dc573782dc0c4069da4b (patch) | |
| tree | a5f0491c1e686cf1c8152d5eadcfd575180ecbe5 | |
| parent | f8169b5e8f3864b6e620cc7f9ca776110750f554 (diff) | |
| download | emacs-edff961b129a26ad5364dc573782dc0c4069da4b.tar.gz emacs-edff961b129a26ad5364dc573782dc0c4069da4b.zip | |
(ex-map-read-args,ex-unmap-read-args): fixed messages.
(vip-events-to-macro): delete nil in macro definitions.
| -rw-r--r-- | lisp/emulation/viper-macs.el | 57 |
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., | |||
| 150 | '(?\b ?\d '^? '^H (control h) (control \?) backspace delete)) | 150 | '(?\b ?\d '^? '^H (control h) (control \?) backspace delete)) |
| 151 | (setq key-seq (subseq key-seq 0 (- (length key-seq) 2)))) | 151 | (setq key-seq (subseq key-seq 0 (- (length key-seq) 2)))) |
| 152 | (setq message | 152 | (setq message |
| 153 | ":map%s %s" | 153 | (format |
| 154 | variant (if (> (length key-seq) 0) | 154 | ":map%s %s" |
| 155 | (prin1-to-string (vip-display-macro key-seq)) | 155 | variant (if (> (length key-seq) 0) |
| 156 | "")) | 156 | (prin1-to-string (vip-display-macro key-seq)) |
| 157 | ""))) | ||
| 157 | (message message) | 158 | (message message) |
| 158 | (setq event (vip-read-key)) | 159 | (setq event (vip-read-key)) |
| 159 | ;;(setq event (vip-read-event)) | 160 | ;;(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., | |||
| 215 | ((member key '(tab (control i) ?\t)) | 216 | ((member key '(tab (control i) ?\t)) |
| 216 | (setq key-seq (subseq key-seq 0 (1- (length key-seq)))) | 217 | (setq key-seq (subseq key-seq 0 (1- (length key-seq)))) |
| 217 | (setq message | 218 | (setq message |
| 218 | ":unmap%s %s" | 219 | (format |
| 219 | variant (if (> (length key-seq) 0) | 220 | ":unmap%s %s" |
| 220 | (prin1-to-string | 221 | variant (if (> (length key-seq) 0) |
| 221 | (vip-display-macro key-seq)) | 222 | (prin1-to-string |
| 222 | "")) | 223 | (vip-display-macro key-seq)) |
| 224 | ""))) | ||
| 223 | (setq key-seq | 225 | (setq key-seq |
| 224 | (vip-do-sequence-completion key-seq macro-alist message)) | 226 | (vip-do-sequence-completion key-seq macro-alist message)) |
| 225 | )) | 227 | )) |
| 226 | (setq message | 228 | (setq message |
| 227 | ":unmap%s %s" | 229 | (format |
| 228 | variant (if (> (length key-seq) 0) | 230 | ":unmap%s %s" |
| 229 | (prin1-to-string | 231 | variant (if (> (length key-seq) 0) |
| 230 | (vip-display-macro key-seq)) | 232 | (prin1-to-string |
| 231 | "")) | 233 | (vip-display-macro key-seq)) |
| 234 | ""))) | ||
| 232 | (message message) | 235 | (message message) |
| 233 | (setq event (vip-read-key)) | 236 | (setq event (vip-read-key)) |
| 234 | ;;(setq event (vip-read-event)) | 237 | ;;(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., | |||
| 253 | )) | 256 | )) |
| 254 | 257 | ||
| 255 | 258 | ||
| 259 | ;; Terminate a Vi kbd macro. | ||
| 260 | ;; optional argument IGNORE, if t, indicates that we are dealing with an | ||
| 261 | ;; existing macro that needs to be registered, but there is no need to | ||
| 262 | ;; terminate a kbd macro. | ||
| 256 | (defun vip-end-mapping-kbd-macro (&optional ignore) | 263 | (defun vip-end-mapping-kbd-macro (&optional ignore) |
| 257 | "Terminate kbd macro." | ||
| 258 | (interactive) | 264 | (interactive) |
| 259 | (define-key vip-vi-intercept-map "\C-x)" nil) | 265 | (define-key vip-vi-intercept-map "\C-x)" nil) |
| 260 | (define-key vip-insert-intercept-map "\C-x)" nil) | 266 | (define-key vip-insert-intercept-map "\C-x)" nil) |
| @@ -769,15 +775,15 @@ there." | |||
| 769 | 775 | ||
| 770 | ;; if seq of Viper key symbols (representing a macro) can be converted to a | 776 | ;; if seq of Viper key symbols (representing a macro) can be converted to a |
| 771 | ;; string--do so. Otherwise, do nothing. | 777 | ;; string--do so. Otherwise, do nothing. |
| 772 | (defun vip-display-macro (macro-name) | 778 | (defun vip-display-macro (macro-name-or-body) |
| 773 | (cond ((vip-char-symbol-sequence-p macro-name) | 779 | (cond ((vip-char-symbol-sequence-p macro-name-or-body) |
| 774 | (mapconcat 'symbol-name macro-name "")) | 780 | (mapconcat 'symbol-name macro-name-or-body "")) |
| 775 | ((vip-char-array-p macro-name) | 781 | ((vip-char-array-p macro-name-or-body) |
| 776 | (mapconcat 'char-to-string macro-name "")) | 782 | (mapconcat 'char-to-string macro-name-or-body "")) |
| 777 | (t macro-name))) | 783 | (t macro-name-or-body))) |
| 778 | 784 | ||
| 779 | (defun vip-events-to-macro (event-seq) | 785 | (defun vip-events-to-macro (event-seq) |
| 780 | (vconcat (mapcar 'vip-event-key event-seq))) | 786 | (vconcat (delq nil (mapcar 'vip-event-key event-seq)))) |
| 781 | 787 | ||
| 782 | ;; convert strings or arrays of characters to Viper macro form | 788 | ;; convert strings or arrays of characters to Viper macro form |
| 783 | (defun vip-char-array-to-macro (array) | 789 | (defun vip-char-array-to-macro (array) |
| @@ -788,10 +794,10 @@ there." | |||
| 788 | (setq macro vec)) | 794 | (setq macro vec)) |
| 789 | (vconcat (mapcar 'vip-event-key macro)))) | 795 | (vconcat (mapcar 'vip-event-key macro)))) |
| 790 | 796 | ||
| 791 | ;; For macros bodies and names, goes over and checks if all members are | 797 | ;; For macros bodies and names, goes over MACRO and checks if all members are |
| 792 | ;; names of keys (actually, it only checks if they are symbols or lists | 798 | ;; names of keys (actually, it only checks if they are symbols or lists |
| 793 | ;; if a digit is found, it is converted into a symbol (0 -> \0, etc). | 799 | ;; if a digit is found, it is converted into a symbol (e.g., 0 -> \0, etc). |
| 794 | ;; If not list or vector, doesn't change its argument | 800 | ;; If MACRO is not a list or vector -- doesn't change MACRO. |
| 795 | (defun vip-fixup-macro (macro) | 801 | (defun vip-fixup-macro (macro) |
| 796 | (let ((len (length macro)) | 802 | (let ((len (length macro)) |
| 797 | (idx 0) | 803 | (idx 0) |
| @@ -810,7 +816,6 @@ there." | |||
| 810 | (setcar (nthcdr idx macro) | 816 | (setcar (nthcdr idx macro) |
| 811 | (intern (char-to-string (+ ?0 elt))))) | 817 | (intern (char-to-string (+ ?0 elt))))) |
| 812 | ))) | 818 | ))) |
| 813 | ;;(setq break t))) | ||
| 814 | ((listp elt) | 819 | ((listp elt) |
| 815 | (vip-fixup-macro elt)) | 820 | (vip-fixup-macro elt)) |
| 816 | ((symbolp elt) nil) | 821 | ((symbolp elt) nil) |