From: Drew Adams <drew.adams@oracle.com>
To: Marco Maggi <mrc.mgg@gmail.com>, help-gnu-emacs@gnu.org
Subject: RE: [newbie] trouble getting the context of macros
Date: Sun, 2 Feb 2020 08:20:28 -0800 (PST) [thread overview]
Message-ID: <518e7bcc-e6f2-45f8-ab12-f60025420b76@default> (raw)
In-Reply-To: <CA+SGfQQrDqi8fnV2aemN14ZRRE8oJ2sXo-4ObWyPPBKYYLJ0Pw@mail.gmail.com>
> (defmacro my-try-2 (op)
> (let ((fun (make-symbol (concat "my-" (symbol-name op)))))
> `(defun ,fun (op1 op1) t)))
> my-try-2
> (my-try-2 fun3)
> my-fun3
> (my-fun3 1 2)
>
> the last form gives me the error "eval: Symbol’s function definition is
> void: my-fun3". I do not understand why.
Try this instead:
(defmacro my-try-2 (op)
(let ((fun (intern (concat "my-" (symbol-name op)))))
`(defun ,fun (op1 op2) t)))
`C-h f make-symbol' tells you that the new symbol
it returns is not interned.
See the Elisp manual, node Creating Symbols, for
info about `intern' and `make-symbol'.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Symbols.html
prev parent reply other threads:[~2020-02-02 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-02 11:03 [newbie] trouble getting the context of macros Marco Maggi
2020-02-02 16:20 ` Drew Adams [this message]
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=518e7bcc-e6f2-45f8-ab12-f60025420b76@default \
--to=drew.adams@oracle.com \
--cc=help-gnu-emacs@gnu.org \
--cc=mrc.mgg@gmail.com \
/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).