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

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

[nongnu] elpa/macrostep a0ae61c 073/110: Properly handle forms not prese


From: ELPA Syncer
Subject: [nongnu] elpa/macrostep a0ae61c 073/110: Properly handle forms not present in the expansion
Date: Sat, 7 Aug 2021 09:18:05 -0400 (EDT)

branch: elpa/macrostep
commit a0ae61c516d410c74353b9443c0293a060c55d55
Author: Luís Oliveira <loliveira@common-lisp.net>
Commit: Luís Oliveira <loliveira@common-lisp.net>

    Properly handle forms not present in the expansion
---
 macrostep.el         |  2 +-
 swank-macrostep.lisp | 28 +++++++++++++++++-----------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/macrostep.el b/macrostep.el
index 564784b..6794bb0 100644
--- a/macrostep.el
+++ b/macrostep.el
@@ -966,7 +966,7 @@ sub-forms.  See also `macrostep-sexp-at-point'."
 (defun macrostep-slime--propertize-macros (start-offset column-offset 
positions)
   "Put text properties on macro forms."
   (dolist (position positions)
-    (destructuring-bind (type start start-line op-end op-end-line end end-line)
+    (destructuring-bind (_ type start start-line op-end op-end-line end 
end-line)
         position
       (put-text-property (+ start-offset start (* column-offset start-line))
                          (+ start-offset end (* column-offset end-line))
diff --git a/swank-macrostep.lisp b/swank-macrostep.lisp
index 84daa1a..6376af2 100644
--- a/swank-macrostep.lisp
+++ b/swank-macrostep.lisp
@@ -45,15 +45,20 @@
           (list pretty-expansion
                 (loop for form in all-macros
                       for (start end) in positions
-                      ;; this assumes that the operator starts right
-                      ;; next to the opening parenthesis. We could
-                      ;; probably be more forgiving.
-                      for op-end = (+ start (length (to-string (first form))))
-                      collect (list
-                               (if (member form macros) :macro :compiler-macro)
-                               start (position-line start pretty-expansion)
-                               op-end (position-line op-end pretty-expansion)
-                               end (position-line end pretty-expansion)))))))))
+                      when (and start end)
+                        collect (let* ((op-name (to-string (first form)))
+                                       ;; this assumes that the
+                                       ;; operator starts right next
+                                       ;; to the opening
+                                       ;; parenthesis. We could
+                                       ;; probably be more forgiving.
+                                       (op-end (+ start (length op-name))))
+                                  (list
+                                   op-name
+                                   (if (member form macros) :macro 
:compiler-macro)
+                                   start (position-line start pretty-expansion)
+                                   op-end (position-line op-end 
pretty-expansion)
+                                   end (position-line end 
pretty-expansion))))))))))
 
 (defun position-line (position string)
   (let ((line 0)
@@ -195,7 +200,8 @@
           in (collect-marker-positions
               (pprint-to-string expansion (make-tracking-pprint-dispatch 
forms))
               (length forms))
-        collect (list (find-non-whitespace-position printed-expansion start)
-                      (find-non-whitespace-position printed-expansion end))))
+        collect (when (and start end)
+                  (list (find-non-whitespace-position printed-expansion start)
+                        (find-non-whitespace-position printed-expansion 
end)))))
 
 (provide :swank-macrostep)



reply via email to

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