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

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

Re: how to add button to emacs that play a elisp code


From: Emanuel Berg
Subject: Re: how to add button to emacs that play a elisp code
Date: Thu, 11 Sep 2014 23:15:58 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>> Please please prettty please don't quote your
>>> lambdas!
>>
>> ?????
>
> Write it:
>
>    (global-set-key [(super meta i)] (lambda ()
> (interactive) (ispell-change-dictionary "italian")))

It is probably easier to remember if you exilian why.

With the quote, it is a list, with the first element
lambda, the second element an empty list, and so on.

    '(1 2 3) ; the list (1 2 3)
(list 1 2 3) ; the same

If it is a function, the lambda, it can be optimized
when byte-compiled. In practice, I kind of think the
OPs lambda won't benefit from this (?), but sure, aim
to get as much of it right from day one, and practice
that on simple things just as well as on difficult
things.

Right?

By the way, I thought I would make it even more
pedagogical with `functionp' and `listp', but:

(functionp '(lambda () (interactive) 1)) ; t
(listp      (lambda () (interactive) 1)) ; t

It is as they say, you should stop when you are
ahead...

-- 
underground experts united


reply via email to

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