Is there an Elisp analogue for the SLIME macrostepper? Specifically, I'm looking for something that expands code at point into the next expansion step (or just the final expansion) in a new buffer.
The naive
(defun macroexpand-point ()
(interactive)
(let ((b (get-buffer-create "*el-macroexpansion*"))
(expansion (format "%s" (macroexpand (thing-at-point 'sexp)))))
(with-current-buffer b
(insert expansion)
(display-buffer b))))
doesn't do what I'm expecting here.
Perhaps you need this:
(defun macroexpand-sexp-at-point ()
(macroexpand (sexp-at-point)))
The whole function can be expressed more succintly thus
(defun macroexpand-point (sexp)
(interactive (list (sexp-at-point)))
(with-output-to-temp-buffer "*el-macroexpansion*"
(pp (macroexpand sexp)))
(with-current-buffer "*el-macroexpansion*" (emacs-lisp-mode)))
You may find that imacroexpand.el does what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With