From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: how to add button to emacs that play a elisp code Date: Thu, 11 Sep 2014 23:15:58 +0200 Organization: Aioe.org NNTP Server Message-ID: <87vbotx3ht.fsf@debian.uxu> References: <04dd6007-693a-4e56-9e2a-e930e51a9563@googlegroups.com> <21521.22678.640570.26495@mail.eng.it> <21521.24551.904371.551048@mail.eng.it> <21521.37886.262510.961741@mail.eng.it> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410470429 14193 80.91.229.3 (11 Sep 2014 21:20:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Sep 2014 21:20:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 11 23:20:22 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XSBms-0006A5-C1 for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2014 23:20:18 +0200 Original-Received: from localhost ([::1]:41277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSBmr-0004rf-SL for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2014 17:20:17 -0400 Original-Path: usenet.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 40 Original-NNTP-Posting-Host: P0uMB9BthHuWo8+BJXB4Mw.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:TxW4lOZbi/S5PyKUZo6TcGcQ73w= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:207556 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99831 Archived-At: Stefan Monnier 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