emacs-diffs
[Top][All Lists]
Advanced

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

master 877893303b: edmacro.el: Silence warnings due to kmacro changes


From: Stefan Monnier
Subject: master 877893303b: edmacro.el: Silence warnings due to kmacro changes
Date: Mon, 4 Apr 2022 09:13:17 -0400 (EDT)

branch: master
commit 877893303bfc7ce447f4acc33f2f9c8caf809489
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    edmacro.el: Silence warnings due to kmacro changes
    
    * lisp/edmacro.el (edit-kbd-macro): Use `kmacro-p` and kmacro accessors.
    (edmacro-finish-edit): Use `kmacro-p` and the new `kmacro` constructor.
---
 lisp/edmacro.el | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 2561994f7b..179fea786d 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -99,8 +99,7 @@ With a prefix argument, format the macro in a more concise 
way."
   (when keys
     (let ((cmd (if (arrayp keys) (key-binding keys) keys))
           (cmd-noremap (when (arrayp keys) (key-binding keys nil t)))
-         (mac nil) (mac-counter nil) (mac-format nil)
-         kmacro)
+         (mac nil) (mac-counter nil) (mac-format nil))
       (cond (store-hook
             (setq mac keys)
             (setq cmd nil))
@@ -131,10 +130,10 @@ With a prefix argument, format the macro in a more 
concise way."
            (t
             (setq mac cmd)
             (setq cmd nil)))
-      (when (setq kmacro (kmacro-extract-lambda mac))
-       (setq mac (car kmacro)
-             mac-counter (nth 1 kmacro)
-             mac-format (nth 2 kmacro)))
+      (when (kmacro-p mac)
+       (setq mac (kmacro--keys mac)
+             mac-counter (kmacro--counter mac)
+             mac-format (kmacro--format mac)))
       (unless (arrayp mac)
        (error "Key sequence %s is not a keyboard macro"
               (key-description keys)))
@@ -260,7 +259,7 @@ or nil, use a compact 80-column format."
                          (push key keys)
                          (let ((b (key-binding key)))
                            (and b (commandp b) (not (arrayp b))
-                                (not (kmacro-extract-lambda b))
+                                (not (kmacro-p b))
                                 (or (not (fboundp b))
                                     (not (or (arrayp (symbol-function b))
                                              (get b 'kmacro))))
@@ -313,10 +312,7 @@ or nil, use a compact 80-column format."
            (when cmd
              (if (= (length mac) 0)
                  (fmakunbound cmd)
-               (fset cmd
-                     (if (and mac-counter mac-format)
-                         (kmacro-lambda-form mac mac-counter mac-format)
-                       mac))))
+               (fset cmd (kmacro mac mac-counter mac-format))))
            (if no-keys
                (when cmd
                  (cl-loop for key in (where-is-internal cmd '(keymap)) do
@@ -327,10 +323,8 @@ or nil, use a compact 80-column format."
                  (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))))))))))
+                                               (kmacro mac mac-counter
+                                                       mac-format))))))))))
       (kill-buffer buf)
       (when (buffer-name obuf)
        (switch-to-buffer obuf))
@@ -645,9 +639,9 @@ This function assumes that the events can be stored in a 
string."
 
 ;;; Parsing a human-readable keyboard macro.
 
-(defun edmacro-parse-keys (string &optional need-vector)
+(defun edmacro-parse-keys (string &optional _need-vector)
   (let ((result (kbd string)))
-    (if (and need-vector (stringp result))
+    (if (stringp result)
         (seq-into result 'vector)
       result)))
 



reply via email to

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