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

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

RE: [newbie] trouble getting the context of macros


From: Drew Adams
Subject: RE: [newbie] trouble getting the context of macros
Date: Sun, 2 Feb 2020 08:20:28 -0800 (PST)

> (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



reply via email to

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