Marcin Borkowski <mb...@wmi.amu.edu.pl> writes:

> On 2014-12-08, at 08:35, Eric Abrahamsen wrote:
>
>> [...] You could do that in a lambda, but
>> it probably won't accept a non-interactive function, [...]
>
> Out of curiosity: can't a lambda (in e.g. global-set-key) be made
> interactive?  I did this right now:
>
> (global-set-key (kbd "C-z C-s") (lambda () (interactive) (message "It can be 
> done!")))
>
> and it seems to work.  Is it going to change e.g. in future Emacs
> versions, IOW, is it deprecated or something?

No, you're quite right, I was just answering off the cuff, without
thorough thought. It is indeed possible to stick (interactive) inside of
a lambda, though intuition tells me that that it's not generally good
practice -- Emacs' introspection functions will probably at some point
bark at you for not having a named function, and it will make it harder
to use the built-in help functions to figure out what's going on. But
yes, you're right, it's definitely possible.

E


Reply via email to