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:19:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Tassilo Horn <tsdh@gnu.org> writes:

> > (defvar pfxd "pfxd-")
> >
> > (defun (intern (concat pfxd "-foo")) ())
> >
> > -->
> >
> > Debugger entered--Lisp error: (wrong-type-argument symbolp (intern
> > (concat pfxd
> > "-foo")))
> >   defalias((intern (concat pfxd "-foo")) (lambda nil nil))
>
> This might depend on emacs version.  At least with the current git
> version, `defalias' evaluates its first argument:
>
>   (defalias (intern "foo-bar") #'forward-sexp) ;; Works fine

In the example above, in the expansion of the `defun' call the first
argument to defalias is the (unevaluated!) list:

  (intern (concat pfxd "-foo"))

The corresponding call to defalias will also fail on trunk.


Michael.




reply via email to

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