emacs's function special form

Austin Clements aclements at csail.mit.edu
Sun Nov 18 19:48:28 PST 2012


On Sun, 18 Nov 2012, Ethan <ethan.glasser.camp at gmail.com> wrote:
> On Sun, Nov 18, 2012 at 7:10 PM, Aaron Ecay <aaronecay at gmail.com> wrote:
>
>> 2012ko azaroak 18an, Ethan Glasser-Camp-ek idatzi zuen:
>> >
>> > - You might want to use #' on lambdas.
>>
>> This is actually unnecessary – as the info node "(elisp) Anonymous
>> Functions" says, the forms with and without #' are equivalent.  The
>> current notmuch style is not to have #' on lambdas (that is, there are 0
>> instances of #'(lambda ...) in the code base).  IMO that’s correct:
>> the unnecessary #' is just line-noise-ish.
>>
>
> OK, I think I understand. Thanks for the clarification. I found that info
> node very confusing.
>
> It says that #' has effects "assuming function-object is a valid lambda
> expression". So why put #' on variables that are the names of functions?
>
> In fact, outside names of functions, when are you supposed to use #' at all?

You don't need to use #' on a lambda form because lambda is actually a
macro (implemented in Elisp!) that expands to
  #'(lambda ...)
so using #' would be redundant.  But you should use it on function
symbols to hint the byte code compiler that you're referring to a
function rather than a variable.  Using #' on symbols affects the
optimizer (and may improve warnings?), even though the info node doesn't
explicitly say how.  Plus, #' makes code more self-documenting.


More information about the notmuch mailing list