emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/setup bb11fa8 06/19: Avoid reconstructing entire edebug


From: Stefan Monnier
Subject: [elpa] externals/setup bb11fa8 06/19: Avoid reconstructing entire edebug specification
Date: Mon, 15 Mar 2021 17:26:27 -0400 (EDT)

branch: externals/setup
commit bb11fa8aa713fa43c029f752c32d8053226d46f7
Author: Philip K <philipk@posteo.net>
Commit: Philip K <philipk@posteo.net>

    Avoid reconstructing entire edebug specification
---
 setup.el | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/setup.el b/setup.el
index 5089b2e..9973212 100644
--- a/setup.el
+++ b/setup.el
@@ -81,6 +81,9 @@
 (defvar setup-macros nil
   "Local macro definitions to be bound in `setup' bodies.")
 
+(defvar setup-edebug-specifications nil
+  "Part of the edebug specification for `setup'.")
+
 ;;;###autoload
 (defun setup-make-docstring ()
   "Return a docstring for `setup'."
@@ -159,7 +162,6 @@ If not given, it is assumed nothing is evaluated."
                    (if (plist-get opts :repeatable) '(...)))))
   (put name 'setup-shorthand (plist-get opts :shorthand))
   (put name 'lisp-indent-function (plist-get opts :indent))
-  (put name 'setup-repeatable (plist-get opts :repeatable))
   (put name 'setup-debug (plist-get opts :debug))
   ;; forget previous definition
   (setq setup-macros (delq (assq name setup-macros)
@@ -183,17 +185,23 @@ If not given, it is assumed nothing is evaluated."
                       `(with-eval-after-load setup-name ,,body))
             `(,name (&rest args) `,,body)))
         setup-macros)
+  ;; update edebug specification for `setup'
+  (setq setup-edebug-specifications
+        (delq (assoc (symbol-name name)
+                     setup-edebug-specifications)
+              setup-edebug-specifications))
+  (let ((body (cond ((eq (plist-get opts :debug) 'none) nil)
+                    ((plist-get opts :debug))
+                    ('(sexp)))))
+    ;; FIXME: Use `&interpose' in Emacsā‰„28.
+    (push (if (plist-get opts :repeatable)
+              `(,(symbol-name name) &rest ,@body)
+            `(,(symbol-name name) ,@body))
+          setup-edebug-specifications))
   (put 'setup 'edebug-form-spec
-       (let (specs)
-         (dolist (name (mapcar #'car setup-macros))
-           (let ((body (cond ((eq (get name 'setup-debug) 'none) nil)
-                             ((get name 'setup-debug) nil)
-                             ('(sexp)))))
-             (push (if (get name 'setup-repeatable)
-                       `(,(symbol-name name) &rest ,@body)
-                     `(,(symbol-name name) ,@body))
-                   specs)))
-         `(&rest &or [symbolp sexp] ,@specs form))))
+       (append '(&rest &or [symbolp sexp])
+               setup-edebug-specifications
+               '(form))))
 
 
 ;;; definitions of `setup' keywords



reply via email to

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