Emacs Lisp Macro Stepper

Is there an Elisp counterpart for the SLIME macro master? In particular, I'm looking for something that extends the code at a point to the next extension step (or just the final extension) in a new buffer.

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 fulfill what I expect here.

+6
source share
3 answers

Perhaps you need this:

 (defun macroexpand-sexp-at-point () (macroexpand (sexp-at-point))) 

The entire function can be expressed more strictly, 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))) 
+6
source

You may find that imacroexpand.el does what you want.

+3
source

You can find macrostype useful.

Macro process fast execution:

After installing the package and without further configuration, you can do this:

Move the cursor in front of the expression you want to expand, then Mx macrostep-expand eeeee to expand it step by step. A short help message is displayed in the echo area on how to exit and how to deploy.

You can check this with macro examples ->> from the dash.el page , which are not too simple and not too complicated.

+2
source

Source: https://habr.com/ru/post/887539/


All Articles