diff options
author | Jay Belanger <jay.p.belanger@gmail.com> | 2015-10-10 17:21:44 -0500 |
---|---|---|
committer | Jay Belanger <jay.p.belanger@gmail.com> | 2015-10-10 17:24:55 -0500 |
commit | 5186c998574a8807713b9a43518fdeae52feac67 (patch) | |
tree | 36b66d95837dfee91b6fde1f213386ffaffad5ab /lisp/calc | |
parent | bb61fa844885a9a9219fc6df7eaaabdbdce45b28 (diff) | |
download | emacs-5186c998574a8807713b9a43518fdeae52feac67.tar.gz |
Use events instead of chars to keep track of steps.
* lisp/calc/calc-prog.el (calc-kbd-loop): Use events instead of chars
to keep track of steps.
Diffstat (limited to 'lisp/calc')
-rw-r--r-- | lisp/calc/calc-prog.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el index 57af0d27822..c5a837d3260 100644 --- a/lisp/calc/calc-prog.el +++ b/lisp/calc/calc-prog.el @@ -1287,37 +1287,37 @@ Redefine the corresponding command." (setq rpt-count (if rpt-count (prefix-numeric-value rpt-count) 1000000)) (let* ((count 0) (parts nil) - (body "") + (body (vector) ) (open last-command-event) (counter initial) ch) (or executing-kbd-macro (message "Reading loop body...")) (while (>= count 0) - (setq ch (read-char)) - (if (= ch -1) + (setq ch (read-event)) + (if (eq ch -1) (error "Unterminated Z%c in keyboard macro" open)) - (if (= ch ?Z) + (if (eq ch ?Z) (progn - (setq ch (read-char) - body (concat body "Z" (char-to-string ch))) + (setq ch (read-event) + body (vconcat body (vector ?Z ch) )) (cond ((memq ch '(?\< ?\( ?\{)) (setq count (1+ count))) ((memq ch '(?\> ?\) ?\})) (setq count (1- count))) ((and (= ch ?/) (= count 0)) - (setq parts (nconc parts (list (concat (substring body 0 -2) - "Z]"))) + (setq parts (nconc parts (list (vconcat (substring body 0 -2) + (vector ?Z ?\]) ))) body "")) ((eq ch 7) (keyboard-quit)))) - (setq body (concat body (char-to-string ch))))) + (setq body (vconcat body (vector ch))))) (if (/= ch (cdr (assq open '( (?\< . ?\>) (?\( . ?\)) (?\{ . ?\}) )))) (error "Mismatched Z%c and Z%c in keyboard macro" open ch)) (or executing-kbd-macro (message "Looping...")) - (setq body (concat (substring body 0 -2) "Z]")) + (setq body (vconcat (substring body 0 -2) (vector ?Z ?\]) )) (and (not executing-kbd-macro) (= rpt-count 1000000) (null parts) |