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

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

Re: add-hook


From: Sebastian Tennant
Subject: Re: add-hook
Date: Thu, 07 Jun 2007 03:20:33 +0300
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux)

It was a rushed, and poorly thought out question.  There are a number
of simple tests I should have perfomed first, but sometimes... well,
call it laziness perhaps...

C-h f add-hook:

  add-hook is a compiled Lisp function in `subr.el'.
  (add-hook HOOK FUNCTION &optional APPEND LOCAL)

  [...]

  HOOK should be a symbol, and FUNCTION may be any valid function.  If
  HOOK is void, it is first set to nil.  If HOOK's value is a single
  function, it is changed to a list of functions.
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As I read it now, I realise it is hook's _value_ that is changed to a
list of functions, not FUNCTIONS's value...

Would it not be clearer if it read, "If HOOK's _existing_ value..."?

At first I read it to mean FUNCTION's value was changed to a list of
functions... confusion all round!

Another point:

  Quoth "Robert D. Crawford" <rdc1x@comcast.net>:
  > For example:

  > (add-hook 'emacs-lisp-mode-hook
  >       '(lambda ()
  >          ...

I understand that lambda functions allow you to pass a number of
functions in a single FUNCTION, but I think you'll find lambda
functions don't need to be quoted.

This fact, and the fact that symbols representing funtions _do_ need
to be quoted, only added to my 'list of functions versus single
function' misconception.

Perhaps someone could explain why it is lambda functions don't need to
be quoted in this context?

Sebastian





reply via email to

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