emacs-diffs
[Top][All Lists]
Advanced

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

scratch/oclosure 810ce4778f: kmacro.el: Reduce size of `kmacro` objects


From: Stefan Monnier
Subject: scratch/oclosure 810ce4778f: kmacro.el: Reduce size of `kmacro` objects
Date: Tue, 18 Jan 2022 15:22:41 -0500 (EST)

branch: scratch/oclosure
commit 810ce4778f2a22a12e0997cef454e93adbaf100b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    kmacro.el: Reduce size of `kmacro` objects
    
    * lisp/kmacro.el (interactive-form, kmacro): Don't duplicate kmacros's
    interactive form in each and every kmacro.
    
    * lisp/emacs-lisp/cl-lib.el:
    * lisp/emacs-lisp/gv.el: Make it more robust for the bootstrap.
---
 lisp/emacs-lisp/cl-lib.el |  1 +
 lisp/emacs-lisp/gv.el     |  1 +
 lisp/kmacro.el            | 17 ++++++++++++-----
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 4e60a3c63d..dc48057176 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -85,6 +85,7 @@
 ;;; Code:
 
 (require 'macroexp)
+(eval-when-compile (require 'easy-mmode)) ;Needed during bootstrap.
 
 (defvar cl--optimize-speed 1)
 (defvar cl--optimize-safety 1)
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 1e9793261f..1562012c07 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -67,6 +67,7 @@
 ;;; Code:
 
 (require 'macroexp)
+(eval-when-compile (require 'pcase))    ;Needed during bootstrap.
 
 ;; What we call a "gvar" is basically a function of type "(getter * setter ->
 ;; code) -> code", where "getter" is code and setter is "code -> code".
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index c1d7c4fc45..e8883ad77f 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -819,13 +819,14 @@ If kbd macro currently being defined end it before 
activating it."
                            (counter (or counter 0))
                            (format (or format "%d")))
       (&optional arg)
-    (interactive "p")
     ;; Use counter and format specific to the macro on the ring!
     (let ((kmacro-counter counter)
          (kmacro-counter-format-start format))
       (execute-kbd-macro keys arg #'kmacro-loop-setup-function)
       (setq counter kmacro-counter))))
 
+(cl-defmethod interactive-form ((_ kmacro)) '(interactive "p"))
+
 ;;;###autoload
 (defun kmacro-lambda-form (mac &optional counter format)
   ;; Apparently, there are two different ways this is called:
@@ -1083,21 +1084,27 @@ following additional answers: `insert', `insert-1', 
`replace', `replace-1',
             (concat
              (format "Macro: %s%s%s%s%s\n"
                      (format-kbd-macro kmacro-step-edit-new-macro 1)
-                     (if (and kmacro-step-edit-new-macro (> (length 
kmacro-step-edit-new-macro) 0)) " " "")
+                     (if (and kmacro-step-edit-new-macro
+                              (> (length kmacro-step-edit-new-macro) 0))
+                         " " "")
                      (propertize (if keys (format-kbd-macro keys)
-                                   (if kmacro-step-edit-appending "<APPEND>" 
"<INSERT>")) 'face 'region)
+                                   (if kmacro-step-edit-appending
+                                       "<APPEND>" "<INSERT>"))
+                                 'face 'region)
                      (if future " " "")
                      (if future (format-kbd-macro future) ""))
              (cond
               ((minibufferp)
                (format "%s\n%s\n"
                          (propertize "\
-                         minibuffer                             " 'face 
'header-line)
+                         minibuffer                             "
+                                     'face 'header-line)
                          (buffer-substring (point-min) (point-max))))
               (curmsg
                (format "%s\n%s\n"
                        (propertize "\
-                         echo area                              " 'face 
'header-line)
+                         echo area                              "
+                                    'face 'header-line)
                        curmsg))
               (t ""))
              (if keys



reply via email to

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