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

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

Re: Defining functions on the fly


From: Michael Heerdegen
Subject: Re: Defining functions on the fly
Date: Mon, 15 Jun 2015 13:31:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Tassilo Horn <tsdh@gnu.org> writes:

> Ah, yes, so that's basically as if
>
>   (defalias '(intern (concat pfxd "-foo")) ...)
>
> had been written.

Yip: (macroexpand '(defun (concat "current-prefix-" foo) ())) ==>

(defalias
  '(concat "current-prefix-" foo)
  #'(lambda nil nil))

The "problem" is that the defun macro (intentionally) adds a quote, so
that

  (defun name ..)

expands to

  (defalias 'name ...)

and `name' doesn't get evaluated.  If the defun macro would not add that
quote, you would have to write

  (defun 'name ...)

but (defun (intern name) ...) would work then.


Michael.



reply via email to

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