unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Syntax question for experts
@ 2008-05-23  6:48 Sébastien Vauban
  2008-05-23  8:34 ` Thierry Volpiatto
  2008-05-23  8:37 ` David Hansen
  0 siblings, 2 replies; 3+ messages in thread
From: Sébastien Vauban @ 2008-05-23  6:48 UTC (permalink / raw)
  To: help-gnu-emacs-mXXj517/zsQ

Hi,

A quick question...

I've seen both

--8<---------------cut here---------------start------------->8---
(add-hook 'shell-mode-hook
	  (lambda ()
	    (whatever)))
--8<---------------cut here---------------end--------------->8---

and

--8<---------------cut here---------------start------------->8---
(add-hook 'shell-mode-hook
	  '(lambda ()
	     (whatever)))
--8<---------------cut here---------------end--------------->8---

(see the quote in front of lambda).

What is the best writing?  With or without the quote?

By "best", I mean more portable (XEmacs, etc.), or with a longer
life-time (won't become erroneous in a couple of years), etc.

Best regards,
  Seb

-- 
Sébastien Vauban


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax question for experts
  2008-05-23  6:48 Syntax question for experts Sébastien Vauban
@ 2008-05-23  8:34 ` Thierry Volpiatto
  2008-05-23  8:37 ` David Hansen
  1 sibling, 0 replies; 3+ messages in thread
From: Thierry Volpiatto @ 2008-05-23  8:34 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: help-gnu-emacs

Sébastien Vauban <zthjwsqqafhv@spammotel.com> writes:

> Hi,
>
> A quick question...
>
> I've seen both
>
> (add-hook 'shell-mode-hook
> 	  (lambda ()
> 	    (whatever)))
>
> and
>
> (add-hook 'shell-mode-hook
> 	  '(lambda ()
> 	     (whatever)))
>
> (see the quote in front of lambda).
>
> What is the best writing?  With or without the quote?
Without, read that:
http://www.emacswiki.org/cgi-bin/wiki/QuotedLambda

> By "best", I mean more portable (XEmacs, etc.), or with a longer
> life-time (won't become erroneous in a couple of years), etc.
>
> Best regards,
>   Seb

If you want to quote the lambda , quote it like:

,----
| #'(lambda ()...)
`----


that is the same as

,----
| (function (lambda ()...))
`----

 
-- 
A + Thierry
Pub key: http://pgp.mit.edu




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Syntax question for experts
  2008-05-23  6:48 Syntax question for experts Sébastien Vauban
  2008-05-23  8:34 ` Thierry Volpiatto
@ 2008-05-23  8:37 ` David Hansen
  1 sibling, 0 replies; 3+ messages in thread
From: David Hansen @ 2008-05-23  8:37 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 23 May 2008 08:48:25 +0200 Sébastien Vauban wrote:

> (add-hook 'shell-mode-hook
> 	  (lambda ()
> 	    (whatever)))
>
> and
>
> (add-hook 'shell-mode-hook
> 	  '(lambda ()
> 	     (whatever)))
>
> (see the quote in front of lambda).
>
> What is the best writing?  With or without the quote?

First one is better if you byte compile the code (the quoted expression
isn't byte compiled).  Note that `lambda' is actually a macro that
expands to (function (lambda ...)).

Longer answer here:

http://www.emacswiki.org/cgi-bin/wiki/QuotedLambda

David





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-05-23  8:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-23  6:48 Syntax question for experts Sébastien Vauban
2008-05-23  8:34 ` Thierry Volpiatto
2008-05-23  8:37 ` David Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).