From: Okamsn <okamsn@protonmail.com>
To: help-gnu-emacs@gnu.org
Subject: A more specific/targeted version of macroexpand-all?
Date: Thu, 09 Jun 2022 01:31:10 +0000 [thread overview]
Message-ID: <2515e8cf-c3cd-2322-2acd-f7e8144b95c2@protonmail.com> (raw)
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.
next reply other threads:[~2022-06-09 1:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 1:31 Okamsn [this message]
2022-06-09 1:36 ` A more specific/targeted version of macroexpand-all? Emanuel Berg
2022-06-09 1:40 ` cl-loop and collect (was: Re: A more specific/targeted version of macroexpand-all?) Emanuel Berg
2022-06-09 1:48 ` Emanuel Berg
2022-06-09 10:47 ` A more specific/targeted version of macroexpand-all? Michael Heerdegen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2515e8cf-c3cd-2322-2acd-f7e8144b95c2@protonmail.com \
--to=okamsn@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).