[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defining functions on the fly
From: |
Tassilo Horn |
Subject: |
Re: Defining functions on the fly |
Date: |
Mon, 15 Jun 2015 12:42:44 +0200 |
User-agent: |
Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) |
Andreas Röhler <andreas.roehler@easy-emacs.de> writes:
>> i'm probably misunderstanding you, but does:
>>
>> (defun (intern (concat "current-prefix-" foo) ...
>>
>> do what you need?
>
> Seems (intern... is not evaluated at this point:
>
> (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
But as Pascal already said, duplicating your function is not a good
idea. Defining aliases is a bit better if you persist on prefixed
versions although I the only benefit I can see is a slightly better
discoverability through C-h f <prefix>-TAB.
Bye,
Tassilo
- Defining functions on the fly, Andreas Röhler, 2015/06/15
- Re: Defining functions on the fly, Dmitry Gutov, 2015/06/15
- Re: Defining functions on the fly, Alexis, 2015/06/15
- Re: Defining functions on the fly, Andreas Röhler, 2015/06/15
- Re: Defining functions on the fly, Alexis, 2015/06/15
- Re: Defining functions on the fly, Michael Heerdegen, 2015/06/15
- Re: Defining functions on the fly,
Tassilo Horn <=
- Re: Defining functions on the fly, Alexis, 2015/06/15
- Re: Defining functions on the fly, Michael Heerdegen, 2015/06/15
- Re: Defining functions on the fly, Tassilo Horn, 2015/06/15
- Re: Defining functions on the fly, Michael Heerdegen, 2015/06/15
Re: Defining functions on the fly, Tassilo Horn, 2015/06/15
Message not available