branch: elpa/macrostep
commit 817322b3234c89a5e6d043d79f70f3869723cccf
Author: Luís Oliveira <[email protected]>
Commit: Luís Oliveira <[email protected]>
Properly place the macrostep[-compiler]-macro-face
Simplified things a bit in the process given that we don't need to pass
the bounds of the macro forms, just the start position.
---
macrostep.el | 26 ++++++++++++++++----------
swank-macrostep.lisp | 21 ++++++++-------------
2 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/macrostep.el b/macrostep.el
index 6794bb0..ebf01d4 100644
--- a/macrostep.el
+++ b/macrostep.el
@@ -966,17 +966,23 @@ 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-length)
position
- (put-text-property (+ start-offset start (* column-offset start-line))
- (+ start-offset end (* column-offset end-line))
- 'macrostep-macro-start t)
- (put-text-property (+ 1 start-offset start (* column-offset start-line))
- (+ 1 start-offset op-end (* column-offset
op-end-line))
- 'font-lock-face
- (if (eq type :macro)
- 'macrostep-macro-face
- 'macrostep-compiler-macro-face)))))
+ (let ((opening-parenthesis-position
+ (+ start-offset start (* column-offset start-line))))
+ (put-text-property opening-parenthesis-position
+ (1+ opening-parenthesis-position)
+ 'macrostep-macro-start
+ t)
+ ;; this assumes that the operator starts right next to the
+ ;; opening parenthesis. We could probably be more robust.
+ (let ((op-start (1+ opening-parenthesis-position)))
+ (put-text-property op-start
+ (+ op-start op-length)
+ 'font-lock-face
+ (if (eq type :macro)
+ 'macrostep-macro-face
+ 'macrostep-compiler-macro-face)))))))
(defun macrostep-slime-macro-form-p (string)
(slime-eval
diff --git a/swank-macrostep.lisp b/swank-macrostep.lisp
index 6376af2..202801f 100644
--- a/swank-macrostep.lisp
+++ b/swank-macrostep.lisp
@@ -46,19 +46,14 @@
(loop for form in all-macros
for (start end) in positions
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))))))))))
+ collect (let ((op-name (to-string (first form))))
+ (list op-name
+ (if (member form macros)
+ :macro
+ :compiler-macro)
+ start
+ (position-line start pretty-expansion)
+ (length op-name))))))))))
(defun position-line (position string)
(let ((line 0)