emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5186c99: Use events instead of chars to keep track


From: Jay Belanger
Subject: [Emacs-diffs] master 5186c99: Use events instead of chars to keep track of steps.
Date: Sat, 10 Oct 2015 22:26:36 +0000

branch: master
commit 5186c998574a8807713b9a43518fdeae52feac67
Author: Jay Belanger <address@hidden>
Commit: Jay Belanger <address@hidden>

    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.
---
 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 57af0d2..c5a837d 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]