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

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

[nongnu] elpa/macrostep 0bcb143 019/110: Handle backquotes better


From: ELPA Syncer
Subject: [nongnu] elpa/macrostep 0bcb143 019/110: Handle backquotes better
Date: Sat, 7 Aug 2021 09:17:54 -0400 (EDT)

branch: elpa/macrostep
commit 0bcb14304890815fe8c63f84fae99badb583ea6f
Author: George Kettleborough <g.kettleborough@member.fsf.org>
Commit: George Kettleborough <g.kettleborough@member.fsf.org>

    Handle backquotes better
---
 macrostep.el | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/macrostep.el b/macrostep.el
index 38f0bc1..1784e8b 100644
--- a/macrostep.el
+++ b/macrostep.el
@@ -496,8 +496,11 @@ so that they can be colored consistently. See also
 `macrostep-print-sexp'.
 
 Also moves point to the beginning of the returned s-expression."
-  (if (not (looking-at "("))
+  (if (and (not (looking-at "("))
+           (not (looking-at "`")))
       (backward-up-list 1))
+  (if (equal (char-before) ?`)
+      (backward-char))
   (or (get-text-property (point) 'macrostep-expanded-text)
       (progn
        ;; use scan-sexps for the side-effect of producing an error
@@ -589,14 +592,16 @@ fontified using the same face (modulo the number of 
faces; see
          (put symbol 'macrostep-gensym-face face)
          face))))
 
-(defun macrostep-print-sexp (sexp)
+(defun macrostep-print-sexp (sexp &optional no-macro-show)
   "Pretty-print SEXP, a macro expansion, in the current buffer.
 
 Fontifies uninterned symbols and macro forms using
 `font-lock-face' property, and saves the actual text of SEXP's
 sub-forms as the `macrostep-expanded-text' text property so that
 any uninterned symbols can be reused in macro expansions of the
-sub-forms. See also `macrostep-sexp-at-point'."
+sub-forms.  If NO-MACRO-SHOW is non-nil then any macros in the
+expansion will not be fontified.  See also
+`macrostep-sexp-at-point'."
   (cond
    ((symbolp sexp)
     (let ((p (point)))
@@ -615,14 +620,22 @@ sub-forms. See also `macrostep-sexp-at-point'."
             (insert "'")
             (macrostep-print-sexp (cadr sexp)))
 
-           ((and (memq head '(\` \, \,@)) ; quasiquote, unquote etc.
+           ((and (memq head '(\, \,@)) ; unquote
                  (= (length sexp) 2))
             (princ head (current-buffer))
             (macrostep-print-sexp (cadr sexp)))
-
+            ((and (eq head '\`)
+                  (= (length sexp) 2))
+             (insert "`")               ; backquote
+             (put-text-property
+              (1- (point)) (point) 'macrostep-expanded-text sexp)
+             (put-text-property
+              (1- (point)) (point) 'font-lock-face 'macrostep-macro-face)
+             (macrostep-print-sexp (cadr sexp) t))
            (t                          ; other list form
             (insert "(")
-            (when (macrostep-macro-form-p sexp)
+            (when (and (not no-macro-show)
+                        (macrostep-macro-form-p sexp))
               (let ((p (point)))
                 ;; save the real expansion as a text property on the
                 ;; opening paren



reply via email to

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