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

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

[newbie] trouble getting the context of macros


From: Marco Maggi
Subject: [newbie] trouble getting the context of macros
Date: Sun, 2 Feb 2020 12:03:02 +0100

Ciao,

  under Emacs 26 I'm trying to learn how to define macros.  This is a
session in the *scratch* buffer:

(defmacro my-try (op)
  `(defun ,op (op1 op1) t))
my-try
(my-try fun1)
fun1
(fun1 1 2)
t

fine, now this:

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

TIA
-- 
Marco Maggi


reply via email to

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