]> code.delx.au - gnu-emacs/blobdiff - lisp/edmacro.el
* autorevert.el (auto-revert-use-notify): Fix docstring.
[gnu-emacs] / lisp / edmacro.el
index f98d901ddec92fc2c10f8ad12a7e706f0598536a..6ef2e29dc838e05ea4e8f36adff928cda0b00bf8 100644 (file)
@@ -1,7 +1,6 @@
 ;;; edmacro.el --- keyboard macro editor
 
 ;;; edmacro.el --- keyboard macro editor
 
-;; Copyright (C) 1993, 1994, 2001, 2002, 2003, 2004,
-;;   2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2013 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Maintainer: Dave Gillespie <daveg@synaptics.com>
 ;; With a prefix argument, `edit-kbd-macro' will format the
 ;; macro in a more concise way that omits the comments.
 
 ;; With a prefix argument, `edit-kbd-macro' will format the
 ;; macro in a more concise way that omits the comments.
 
-;; This package requires GNU Emacs 19 or later, and daveg's CL
-;; package 2.02 or later.  (CL 2.02 comes standard starting with
-;; Emacs 19.18.)  This package does not work with Emacs 18 or
-;; Lucid Emacs.
-
 ;;; Code:
 \f
 ;;; Code:
 \f
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'kmacro)
 
 ;;; The user-level commands for editing macros.
 
 
 (require 'kmacro)
 
 ;;; The user-level commands for editing macros.
 
-;;;###autoload
-(defvar edmacro-eight-bits nil
-  "*Non-nil if `edit-kbd-macro' should leave 8-bit characters intact.
-Default nil means to write characters above \\177 in octal notation.")
+(defcustom edmacro-eight-bits nil
+  "Non-nil if `edit-kbd-macro' should leave 8-bit characters intact.
+Default nil means to write characters above \\177 in octal notation."
+  :type 'boolean
+  :group 'kmacro)
 
 (defvar edmacro-mode-map
   (let ((map (make-sparse-keymap)))
 
 (defvar edmacro-mode-map
   (let ((map (make-sparse-keymap)))
@@ -230,7 +224,7 @@ or nil, use a compact 80-column format."
      "This command is valid only in buffers created by `edit-kbd-macro'"))
   (run-hooks 'edmacro-finish-hook)
   (let ((cmd nil) (keys nil) (no-keys nil)
      "This command is valid only in buffers created by `edit-kbd-macro'"))
   (run-hooks 'edmacro-finish-hook)
   (let ((cmd nil) (keys nil) (no-keys nil)
-       (mac-counter nil) (mac-format nil) (kmacro nil)
+       (mac-counter nil) (mac-format nil)
        (top (point-min)))
     (goto-char top)
     (let ((case-fold-search nil))
        (top (point-min)))
     (goto-char top)
     (let ((case-fold-search nil))
@@ -245,7 +239,7 @@ or nil, use a compact 80-column format."
                        (setq cmd (and (not (equal str "none"))
                                       (intern str)))
                        (and (fboundp cmd) (not (arrayp (symbol-function cmd)))
                        (setq cmd (and (not (equal str "none"))
                                       (intern str)))
                        (and (fboundp cmd) (not (arrayp (symbol-function cmd)))
-                            (not (setq kmacro (get cmd 'kmacro)))
+                            (not (get cmd 'kmacro))
                             (not (y-or-n-p
                                   (format "Command %s is already defined; %s"
                                           cmd "proceed? ")))
                             (not (y-or-n-p
                                   (format "Command %s is already defined; %s"
                                           cmd "proceed? ")))
@@ -324,17 +318,18 @@ or nil, use a compact 80-column format."
                        mac))))
            (if no-keys
                (when cmd
                        mac))))
            (if no-keys
                (when cmd
-                 (loop for key in (where-is-internal cmd '(keymap)) do
-                       (global-unset-key key)))
+                 (cl-loop for key in (where-is-internal cmd '(keymap)) do
+                           (global-unset-key key)))
              (when keys
                (if (= (length mac) 0)
              (when keys
                (if (= (length mac) 0)
-                   (loop for key in keys do (global-unset-key key))
-                 (loop for key in keys do
-                       (global-set-key key
-                                       (or cmd
-                                           (if (and mac-counter mac-format)
-                                               (kmacro-lambda-form mac mac-counter mac-format)
-                                             mac))))))))))
+                   (cl-loop for key in keys do (global-unset-key key))
+                 (cl-loop for key in keys do
+                           (global-set-key key
+                                           (or cmd
+                                               (if (and mac-counter mac-format)
+                                                   (kmacro-lambda-form
+                                                    mac mac-counter mac-format)
+                                                 mac))))))))))
       (kill-buffer buf)
       (when (buffer-name obuf)
        (switch-to-buffer obuf))
       (kill-buffer buf)
       (when (buffer-name obuf)
        (switch-to-buffer obuf))
@@ -442,9 +437,9 @@ doubt, use whitespace."
         (one-line (eq verbose 1)))
     (if one-line (setq verbose nil))
     (when (stringp macro)
         (one-line (eq verbose 1)))
     (if one-line (setq verbose nil))
     (when (stringp macro)
-      (loop for i below (length macro) do
-           (when (>= (aref rest-mac i) 128)
-             (incf (aref rest-mac i) (- ?\M-\^@ 128)))))
+      (cl-loop for i below (length macro) do
+               (when (>= (aref rest-mac i) 128)
+                 (cl-incf (aref rest-mac i) (- ?\M-\^@ 128)))))
     (while (not (eq (aref rest-mac 0) 'end-macro))
       (let* ((prefix
              (or (and (integerp (aref rest-mac 0))
     (while (not (eq (aref rest-mac 0) 'end-macro))
       (let* ((prefix
              (or (and (integerp (aref rest-mac 0))
@@ -453,57 +448,58 @@ doubt, use whitespace."
                             '(digit-argument negative-argument))
                       (let ((i 1))
                         (while (memq (aref rest-mac i) (cdr mdigs))
                             '(digit-argument negative-argument))
                       (let ((i 1))
                         (while (memq (aref rest-mac i) (cdr mdigs))
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "M-" (edmacro-subseq rest-mac 0 i) " ")
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "M-" (edmacro-subseq rest-mac 0 i) " ")
-                               (callf edmacro-subseq rest-mac i)))))
+                               (cl-callf edmacro-subseq rest-mac i)))))
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (while (eq (aref rest-mac i) ?\C-u)
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (while (eq (aref rest-mac i) ?\C-u)
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
                         (and (not (memq (aref rest-mac i) pkeys))
-                             (prog1 (loop repeat i concat "C-u ")
-                               (callf edmacro-subseq rest-mac i)))))
+                             (prog1 (cl-loop repeat i concat "C-u ")
+                               (cl-callf edmacro-subseq rest-mac i)))))
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (when (eq (aref rest-mac i) ?-)
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (when (eq (aref rest-mac i) ?-)
-                          (incf i))
+                          (cl-incf i))
                         (while (memq (aref rest-mac i)
                                      '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
                         (while (memq (aref rest-mac i)
                                      '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "C-u " (edmacro-subseq rest-mac 1 i) " ")
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "C-u " (edmacro-subseq rest-mac 1 i) " ")
-                               (callf edmacro-subseq rest-mac i)))))))
+                               (cl-callf edmacro-subseq rest-mac i)))))))
             (bind-len (apply 'max 1
             (bind-len (apply 'max 1
-                             (loop for map in maps
-                                   for b = (lookup-key map rest-mac)
-                                   when b collect b)))
+                             (cl-loop for map in maps
+                                       for b = (lookup-key map rest-mac)
+                                       when b collect b)))
             (key (edmacro-subseq rest-mac 0 bind-len))
             (fkey nil) tlen tkey
             (key (edmacro-subseq rest-mac 0 bind-len))
             (fkey nil) tlen tkey
-            (bind (or (loop for map in maps for b = (lookup-key map key)
-                            thereis (and (not (integerp b)) b))
+            (bind (or (cl-loop for map in maps for b = (lookup-key map key)
+                                thereis (and (not (integerp b)) b))
                       (and (setq fkey (lookup-key local-function-key-map rest-mac))
                            (setq tlen fkey tkey (edmacro-subseq rest-mac 0 tlen)
                                  fkey (lookup-key local-function-key-map tkey))
                       (and (setq fkey (lookup-key local-function-key-map rest-mac))
                            (setq tlen fkey tkey (edmacro-subseq rest-mac 0 tlen)
                                  fkey (lookup-key local-function-key-map tkey))
-                           (loop for map in maps
-                                 for b = (lookup-key map fkey)
-                                 when (and (not (integerp b)) b)
-                                 do (setq bind-len tlen key tkey)
-                                 and return b
-                                 finally do (setq fkey nil)))))
+                           (cl-loop for map in maps
+                                     for b = (lookup-key map fkey)
+                                     when (and (not (integerp b)) b)
+                                     do (setq bind-len tlen key tkey)
+                                     and return b
+                                     finally do (setq fkey nil)))))
             (first (aref key 0))
             (first (aref key 0))
-            (text (loop for i from bind-len below (length rest-mac)
-                        for ch = (aref rest-mac i)
-                        while (and (integerp ch)
-                                   (> ch 32) (< ch maxkey) (/= ch 92)
-                                   (eq (key-binding (char-to-string ch))
-                                       'self-insert-command)
-                                   (or (> i (- (length rest-mac) 2))
-                                       (not (eq ch (aref rest-mac (+ i 1))))
-                                       (not (eq ch (aref rest-mac (+ i 2))))))
-                        finally return i))
+            (text
+              (cl-loop for i from bind-len below (length rest-mac)
+                       for ch = (aref rest-mac i)
+                       while (and (integerp ch)
+                                  (> ch 32) (< ch maxkey) (/= ch 92)
+                                  (eq (key-binding (char-to-string ch))
+                                      'self-insert-command)
+                                  (or (> i (- (length rest-mac) 2))
+                                      (not (eq ch (aref rest-mac (+ i 1))))
+                                      (not (eq ch (aref rest-mac (+ i 2))))))
+                       finally return i))
             desc)
        (if (stringp bind) (setq bind nil))
        (cond ((and (eq bind 'self-insert-command) (not prefix)
             desc)
        (if (stringp bind) (setq bind nil))
        (cond ((and (eq bind 'self-insert-command) (not prefix)
@@ -514,7 +510,7 @@ doubt, use whitespace."
                      (setq desc (concat (edmacro-subseq rest-mac 0 text)))
                      (when (string-match "^[ACHMsS]-." desc)
                        (setq text 2)
                      (setq desc (concat (edmacro-subseq rest-mac 0 text)))
                      (when (string-match "^[ACHMsS]-." desc)
                        (setq text 2)
-                       (callf substring desc 0 2))
+                       (cl-callf substring desc 0 2))
                      (not (string-match
                            "^;;\\|^<.*>$\\|^\\\\[0-9]+$\\|^[0-9]+\\*."
                            desc))))
                      (not (string-match
                            "^;;\\|^<.*>$\\|^\\\\[0-9]+$\\|^[0-9]+\\*."
                            desc))))
@@ -540,17 +536,17 @@ doubt, use whitespace."
                              (cond
                               ((integerp ch)
                                (concat
                              (cond
                               ((integerp ch)
                                (concat
-                                (loop for pf across "ACHMsS"
-                                      for bit in '(?\A-\^@ ?\C-\^@ ?\H-\^@
-                                                   ?\M-\^@ ?\s-\^@ ?\S-\^@)
-                                      when (/= (logand ch bit) 0)
-                                      concat (format "%c-" pf))
+                                (cl-loop for pf across "ACHMsS"
+                                          for bit in '(?\A-\^@ ?\C-\^@ ?\H-\^@
+                                                       ?\M-\^@ ?\s-\^@ ?\S-\^@)
+                                          when (/= (logand ch bit) 0)
+                                          concat (format "%c-" pf))
                                 (let ((ch2 (logand ch (1- (lsh 1 18)))))
                                   (cond ((<= ch2 32)
                                 (let ((ch2 (logand ch (1- (lsh 1 18)))))
                                   (cond ((<= ch2 32)
-                                         (case ch2
+                                         (pcase ch2
                                            (0 "NUL") (9 "TAB") (10 "LFD")
                                            (13 "RET") (27 "ESC") (32 "SPC")
                                            (0 "NUL") (9 "TAB") (10 "LFD")
                                            (13 "RET") (27 "ESC") (32 "SPC")
-                                           (t
+                                           (_
                                             (format "C-%c"
                                                     (+ (if (<= ch2 26) 96 64)
                                                        ch2)))))
                                             (format "C-%c"
                                                     (+ (if (<= ch2 26) 96 64)
                                                        ch2)))))
@@ -568,30 +564,30 @@ doubt, use whitespace."
          (let ((times 1) (pos bind-len))
            (while (not (edmacro-mismatch rest-mac rest-mac
                                          0 bind-len pos (+ bind-len pos)))
          (let ((times 1) (pos bind-len))
            (while (not (edmacro-mismatch rest-mac rest-mac
                                          0 bind-len pos (+ bind-len pos)))
-             (incf times)
-             (incf pos bind-len))
+             (cl-incf times)
+             (cl-incf pos bind-len))
            (when (> times 1)
              (setq desc (format "%d*%s" times desc))
              (setq bind-len (* bind-len times)))))
        (setq rest-mac (edmacro-subseq rest-mac bind-len))
        (if verbose
            (progn
            (when (> times 1)
              (setq desc (format "%d*%s" times desc))
              (setq bind-len (* bind-len times)))))
        (setq rest-mac (edmacro-subseq rest-mac bind-len))
        (if verbose
            (progn
-             (unless (equal res "") (callf concat res "\n"))
-             (callf concat res desc)
+             (unless (equal res "") (cl-callf concat res "\n"))
+             (cl-callf concat res desc)
              (when (and bind (or (stringp bind) (symbolp bind)))
              (when (and bind (or (stringp bind) (symbolp bind)))
-               (callf concat res
+               (cl-callf concat res
                  (make-string (max (- 3 (/ (length desc) 8)) 1) 9)
                  ";; " (if (stringp bind) bind (symbol-name bind))))
              (setq len 0))
          (if (and (> (+ len (length desc) 2) 72) (not one-line))
              (progn
                  (make-string (max (- 3 (/ (length desc) 8)) 1) 9)
                  ";; " (if (stringp bind) bind (symbol-name bind))))
              (setq len 0))
          (if (and (> (+ len (length desc) 2) 72) (not one-line))
              (progn
-               (callf concat res "\n ")
+               (cl-callf concat res "\n ")
                (setq len 1))
            (unless (equal res "")
                (setq len 1))
            (unless (equal res "")
-             (callf concat res " ")
-             (incf len)))
-         (callf concat res desc)
-         (incf len (length desc)))))
+             (cl-callf concat res " ")
+             (cl-incf len)))
+         (cl-callf concat res desc)
+         (cl-incf len (length desc)))))
     res))
 
 (defun edmacro-mismatch (cl-seq1 cl-seq2 cl-start1 cl-end1 cl-start2 cl-end2)
     res))
 
 (defun edmacro-mismatch (cl-seq1 cl-seq2 cl-start1 cl-end1 cl-start2 cl-end2)
@@ -599,28 +595,19 @@ doubt, use whitespace."
 Return nil if the sequences match.  If one sequence is a prefix of the
 other, the return value indicates the end of the shorted sequence.
 \n(fn SEQ1 SEQ2 START1 END1 START2 END2)"
 Return nil if the sequences match.  If one sequence is a prefix of the
 other, the return value indicates the end of the shorted sequence.
 \n(fn SEQ1 SEQ2 START1 END1 START2 END2)"
-  (let (cl-test cl-test-not cl-key cl-from-end)
-    (or cl-end1 (setq cl-end1 (length cl-seq1)))
-    (or cl-end2 (setq cl-end2 (length cl-seq2)))
-    (if cl-from-end
-       (progn
-         (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                     (cl-check-match (elt cl-seq1 (1- cl-end1))
-                                     (elt cl-seq2 (1- cl-end2))))
-           (setq cl-end1 (1- cl-end1) cl-end2 (1- cl-end2)))
-         (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
-              (1- cl-end1)))
-      (let ((cl-p1 (and (listp cl-seq1) (nthcdr cl-start1 cl-seq1)))
-           (cl-p2 (and (listp cl-seq2) (nthcdr cl-start2 cl-seq2))))
-       (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                   (cl-check-match (if cl-p1 (car cl-p1)
-                                     (aref cl-seq1 cl-start1))
-                                   (if cl-p2 (car cl-p2)
-                                     (aref cl-seq2 cl-start2))))
-         (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)
-               cl-start1 (1+ cl-start1) cl-start2 (1+ cl-start2)))
-       (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
-            cl-start1)))))
+  (or cl-end1 (setq cl-end1 (length cl-seq1)))
+  (or cl-end2 (setq cl-end2 (length cl-seq2)))
+  (let ((cl-p1 (and (listp cl-seq1) (nthcdr cl-start1 cl-seq1)))
+        (cl-p2 (and (listp cl-seq2) (nthcdr cl-start2 cl-seq2))))
+    (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
+                (eql (if cl-p1 (car cl-p1)
+                       (aref cl-seq1 cl-start1))
+                     (if cl-p2 (car cl-p2)
+                       (aref cl-seq2 cl-start2))))
+      (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)
+            cl-start1 (1+ cl-start1) cl-start2 (1+ cl-start2)))
+    (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
+         cl-start1)))
 
 (defun edmacro-subseq (seq start &optional end)
   "Return the subsequence of SEQ from START to END.
 
 (defun edmacro-subseq (seq start &optional end)
   "Return the subsequence of SEQ from START to END.
@@ -652,9 +639,9 @@ If START or END is negative, it counts from the end."
 The string represents the same events; Meta is indicated by bit 7.
 This function assumes that the events can be stored in a string."
   (setq seq (copy-sequence seq))
 The string represents the same events; Meta is indicated by bit 7.
 This function assumes that the events can be stored in a string."
   (setq seq (copy-sequence seq))
-  (loop for i below (length seq) do
-        (when (logand (aref seq i) 128)
-          (setf (aref seq i) (logand (aref seq i) 127))))
+  (cl-loop for i below (length seq) do
+           (when (logand (aref seq i) 128)
+             (setf (aref seq i) (logand (aref seq i) 127))))
   seq)
 
 (defun edmacro-fix-menu-commands (macro &optional noerror)
   seq)
 
 (defun edmacro-fix-menu-commands (macro &optional noerror)
@@ -669,7 +656,7 @@ This function assumes that the events can be stored in a string."
                ((eq (car ev) 'switch-frame))
                ((equal ev '(menu-bar))
                 (push 'menu-bar result))
                ((eq (car ev) 'switch-frame))
                ((equal ev '(menu-bar))
                 (push 'menu-bar result))
-               ((equal (cadadr ev) '(menu-bar))
+               ((equal (cl-cadadr ev) '(menu-bar))
                 (push (vector 'menu-bar (car ev)) result))
                ;; It would be nice to do pop-up menus, too, but not enough
                ;; info is recorded in macros to make this possible.
                 (push (vector 'menu-bar (car ev)) result))
                ;; It would be nice to do pop-up menus, too, but not enough
                ;; info is recorded in macros to make this possible.
@@ -729,30 +716,31 @@ This function assumes that the events can be stored in a string."
              (t
               (let ((orig-word word) (prefix 0) (bits 0))
                 (while (string-match "^[ACHMsS]-." word)
              (t
               (let ((orig-word word) (prefix 0) (bits 0))
                 (while (string-match "^[ACHMsS]-." word)
-                  (incf bits (cdr (assq (aref word 0)
+                  (cl-incf bits (cdr (assq (aref word 0)
                                         '((?A . ?\A-\^@) (?C . ?\C-\^@)
                                           (?H . ?\H-\^@) (?M . ?\M-\^@)
                                           (?s . ?\s-\^@) (?S . ?\S-\^@)))))
                                         '((?A . ?\A-\^@) (?C . ?\C-\^@)
                                           (?H . ?\H-\^@) (?M . ?\M-\^@)
                                           (?s . ?\s-\^@) (?S . ?\S-\^@)))))
-                  (incf prefix 2)
-                  (callf substring word 2))
+                  (cl-incf prefix 2)
+                  (cl-callf substring word 2))
                 (when (string-match "^\\^.$" word)
                 (when (string-match "^\\^.$" word)
-                  (incf bits ?\C-\^@)
-                  (incf prefix)
-                  (callf substring word 1))
+                  (cl-incf bits ?\C-\^@)
+                  (cl-incf prefix)
+                  (cl-callf substring word 1))
                 (let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r")
                                            ("LFD" . "\n") ("TAB" . "\t")
                                            ("ESC" . "\e") ("SPC" . " ")
                                            ("DEL" . "\177")))))
                   (when found (setq word (cdr found))))
                 (when (string-match "^\\\\[0-7]+$" word)
                 (let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r")
                                            ("LFD" . "\n") ("TAB" . "\t")
                                            ("ESC" . "\e") ("SPC" . " ")
                                            ("DEL" . "\177")))))
                   (when found (setq word (cdr found))))
                 (when (string-match "^\\\\[0-7]+$" word)
-                  (loop for ch across word
-                        for n = 0 then (+ (* n 8) ch -48)
-                        finally do (setq word (vector n))))
+                  (cl-loop for ch across word
+                            for n = 0 then (+ (* n 8) ch -48)
+                            finally do (setq word (vector n))))
                 (cond ((= bits 0)
                        (setq key word))
                       ((and (= bits ?\M-\^@) (stringp word)
                             (string-match "^-?[0-9]+$" word))
                 (cond ((= bits 0)
                        (setq key word))
                       ((and (= bits ?\M-\^@) (stringp word)
                             (string-match "^-?[0-9]+$" word))
-                       (setq key (loop for x across word collect (+ x bits))))
+                       (setq key (cl-loop for x across word
+                                           collect (+ x bits))))
                       ((/= (length word) 1)
                        (error "%s must prefix a single character, not %s"
                               (substring orig-word 0 prefix) word))
                       ((/= (length word) 1)
                        (error "%s must prefix a single character, not %s"
                               (substring orig-word 0 prefix) word))
@@ -766,7 +754,7 @@ This function assumes that the events can be stored in a string."
                       (t
                        (setq key (list (+ bits (aref word 0)))))))))
        (when key
                       (t
                        (setq key (list (+ bits (aref word 0)))))))))
        (when key
-         (loop repeat times do (callf vconcat res key)))))
+         (cl-loop repeat times do (cl-callf vconcat res key)))))
     (when (and (>= (length res) 4)
               (eq (aref res 0) ?\C-x)
               (eq (aref res 1) ?\()
     (when (and (>= (length res) 4)
               (eq (aref res 0) ?\C-x)
               (eq (aref res 1) ?\()
@@ -774,16 +762,15 @@ This function assumes that the events can be stored in a string."
               (eq (aref res (- (length res) 1)) ?\)))
       (setq res (edmacro-subseq res 2 -2)))
     (if (and (not need-vector)
               (eq (aref res (- (length res) 1)) ?\)))
       (setq res (edmacro-subseq res 2 -2)))
     (if (and (not need-vector)
-            (loop for ch across res
-                  always (and (characterp ch)
-                              (let ((ch2 (logand ch (lognot ?\M-\^@))))
-                                (and (>= ch2 0) (<= ch2 127))))))
-       (concat (loop for ch across res
-                     collect (if (= (logand ch ?\M-\^@) 0)
-                                 ch (+ ch 128))))
+            (cl-loop for ch across res
+                      always (and (characterp ch)
+                                  (let ((ch2 (logand ch (lognot ?\M-\^@))))
+                                    (and (>= ch2 0) (<= ch2 127))))))
+       (concat (cl-loop for ch across res
+                         collect (if (= (logand ch ?\M-\^@) 0)
+                                     ch (+ ch 128))))
       res)))
 
 (provide 'edmacro)
 
       res)))
 
 (provide 'edmacro)
 
-;; arch-tag: 726807b4-3ae6-49de-b0ae-b9590973e0d7
 ;;; edmacro.el ends here
 ;;; edmacro.el ends here