all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* add-hook
@ 2011-06-04 13:00 daniele.g
  2011-06-04 14:11 ` add-hook Teemu Likonen
  0 siblings, 1 reply; 26+ messages in thread
From: daniele.g @ 2011-06-04 13:00 UTC (permalink / raw)
  To: help-gnu-emacs

Is that syntax correct?

--8<---------------cut here---------------start------------->8---
(add-hook 'c-mode-common-hook
	  '(lambda ()
	     'hs-minor-mode
	     'linum-mode
	     (local-set-key [(control return)] 
			    'semantic-ia-complete-symbol-menu)))
--8<---------------cut here---------------end--------------->8---

-- 
        "Come va?".
        "Bene, grazie.  E tu?".
        "Medio".  Cosi' diceva sempre.
        		-- Enrico Brizzi, Jack Frusciante e' uscito dal gruppo




^ permalink raw reply	[flat|nested] 26+ messages in thread
* add-hook
@ 2013-01-25 19:03 Perry Smith
  2013-01-25 19:18 ` add-hook Drew Adams
  0 siblings, 1 reply; 26+ messages in thread
From: Perry Smith @ 2013-01-25 19:03 UTC (permalink / raw)
  To: Emacs help

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

In one of my setup files I have this:

> (eval-after-load 'ruby-mode
>   '(add-hook 'ruby-mode-hook (function
> 			      (lambda ()
> 				(ruby-electric-mode t)))))

Other places, I just do the add-hook.

The reason I'm asking is because I need to do:

> (eval-after-load 'grep
>   '(add-to-list 'grep-files-aliases (cons "rails" "*.rb *.erb *.js *.css *.scss")))


because if I don't, I get an error that says grep-files-aliases is not defined.  It appears as if add-hook has smarts that add-to-list does not have but I wanted to be sure which method was preferred.

Thank you,
Perry


[-- Attachment #2: Type: text/html, Size: 1486 bytes --]

^ permalink raw reply	[flat|nested] 26+ messages in thread
[parent not found: <mailman.1634.1181129906.32220.help-gnu-emacs@gnu.org>]
* add-hook
@ 2007-06-06 11:26 Sebastian Tennant
  2007-06-07  0:20 ` add-hook Sebastian Tennant
       [not found] ` <mailman.1696.1181175524.32220.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 26+ messages in thread
From: Sebastian Tennant @ 2007-06-06 11:26 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

Am I right in thinking this is OK:

(add-hook 'foo-hook 'bar-function 'baz-function ...)

And this is OK:

(add-hook 'foo-hook (lambda () ...))

But this is not:

(add-hook 'foo-hook 'bar-function (lambda () ...))

That is to say, single functions passed via add-hook are added to a
list the contents of which are evaluated in turn, but a lambda
function passed via add-hook is evaluated as it stands, (no list of
functions is created) so there can be only one lambda function passed
via add-hook at any one time?

Sebastian

^ permalink raw reply	[flat|nested] 26+ messages in thread
* add-hook
@ 2003-11-10  3:01 Richard Stallman
  2003-11-10  5:07 ` add-hook Miles Bader
  0 siblings, 1 reply; 26+ messages in thread
From: Richard Stallman @ 2003-11-10  3:01 UTC (permalink / raw)


Today I took another look at the code in add-hook and this time I
could clearly see the problem that I originally fixed.  This code

    ;; Detect the case where make-local-variable was used on a hook
    ;; and do what we used to do.
    (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
      (setq local t)))

claims to detect the case where the hook variable was made local in
the wrong way, but it doesn't really do that.  It will set `local' to
t in cases where the hook is not actually local.  In fact, in the
simplest case, where the hook variable has no local binding, and no
local hooks have ever been put on it, this code will still set `local'
to t.

That is very confusing, and contradicts what the comment says.
This needs to be cleaned up somehow.

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

end of thread, other threads:[~2013-01-26  6:21 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-04 13:00 add-hook daniele.g
2011-06-04 14:11 ` add-hook Teemu Likonen
2011-06-04 18:35   ` add-hook daniele.g
2011-06-05 10:58     ` add-hook Richard Riley
2011-06-05 18:58       ` add-hook daniele.g
2011-06-05 20:26         ` add-hook Richard Riley
2011-06-05 22:28           ` add-hook daniele.g
2011-06-05 23:33             ` add-hook Richard Riley
  -- strict thread matches above, loose matches on Subject: below --
2013-01-25 19:03 add-hook Perry Smith
2013-01-25 19:18 ` add-hook Drew Adams
2013-01-26  4:03   ` add-hook Dmitry Gutov
     [not found]   ` <mailman.18346.1359173059.855.help-gnu-emacs@gnu.org>
2013-01-26  5:33     ` add-hook Barry Margolin
2013-01-26  6:21       ` add-hook Dmitry Gutov
     [not found] <mailman.1634.1181129906.32220.help-gnu-emacs@gnu.org>
2007-06-06 12:04 ` add-hook Katsumi Yamaoka
2007-06-06 20:41 ` add-hook Robert D. Crawford
2007-06-06 11:26 add-hook Sebastian Tennant
2007-06-07  0:20 ` add-hook Sebastian Tennant
     [not found] ` <mailman.1696.1181175524.32220.help-gnu-emacs@gnu.org>
2007-06-07  7:16   ` add-hook Thien-Thi Nguyen
2007-06-07 10:00     ` add-hook Sebastian Tennant
     [not found]     ` <mailman.1711.1181210337.32220.help-gnu-emacs@gnu.org>
2007-06-07 14:01       ` add-hook Thien-Thi Nguyen
2003-11-10  3:01 add-hook Richard Stallman
2003-11-10  5:07 ` add-hook Miles Bader
2003-11-10 15:41   ` add-hook Stefan Monnier
2003-11-11  2:26     ` add-hook Miles Bader
2003-11-12 20:02       ` add-hook Richard Stallman
2003-11-11 18:22   ` add-hook Richard Stallman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.