help-gnu-emacs
[Top][All Lists]
Advanced

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

A more specific/targeted version of macroexpand-all?


From: Okamsn
Subject: A more specific/targeted version of macroexpand-all?
Date: Thu, 09 Jun 2022 01:31:10 +0000

Hello,

I would like to use `macroexpand-all` to substitute code in-place, like
a macro. My problem is that `macroexpand-all` expands all known macros
in the expression. I only want to use it to expand a limited set of macros.

I have been able to explicitly prevent expansion of macros by including
them in the second argument of `macroexpand-all`, such as in

     (macroexpand-all my-code `((cl-block) (cl-return-from) ,@my-macros))

but that still leaves the possibility of other, unknown macros expanding
incorrectly.

Is there a better way to do this kind of limited expansion than
`macroexpand-all`?

If not, is there a way to be more targeted when using `macroexpand-all`?
For example, is the below code the best way to get the currently known
macros that would be expanded by `macroexpand-all`?

     (cl-loop for i being the symbols
              when (eq 'macro (car-safe (symbol-function i)))
              collect i)

Thank you.




reply via email to

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