]> git.eshelyaron.com Git - emacs.git/commitdiff
Use events instead of chars to keep track of steps.
authorJay Belanger <jay.p.belanger@gmail.com>
Sat, 10 Oct 2015 22:21:44 +0000 (17:21 -0500)
committerJay Belanger <jay.p.belanger@gmail.com>
Sat, 10 Oct 2015 22:24:55 +0000 (17:24 -0500)
* lisp/calc/calc-prog.el (calc-kbd-loop): Use events instead of chars
to keep track of steps.

lisp/calc/calc-prog.el

index 57af0d27822d8bd94fe1fc69065c8100f8fb2d13..c5a837d3260766d4f2c92d6e69715352969eb232 100644 (file)
@@ -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)