[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fri, 25 Jan 2013 11:18:57 -0800
> In one of my setup files I have this:
> (eval-after-load 'ruby-mode
> (lambda ()
> (ruby-electric-mode t)))))
> Other places, I just do the add-hook.
You don't need the `eval-after-load' (or the `function').
> The reason I'm asking is because I need to do:
> (eval-after-load 'grep '(add-to-list 'grep-files-aliases ...))
> 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
Good question. Let's ask Emacs...
Yes - see the last paragraph of `C-h f add-hook':
| add-hook is a compiled Lisp function in `subr.el'.
| (add-hook HOOK FUNCTION &optional APPEND LOCAL)
| Add to the value of HOOK the function FUNCTION.
| FUNCTION is not added if already present.
| FUNCTION is added (if necessary) at the beginning of the hook list
| unless the optional argument APPEND is non-nil, in which case
| FUNCTION is added at the end.
| The optional fourth argument, LOCAL, if non-nil, says to modify
| the hook's buffer-local value rather than its global value.
| This makes the hook buffer-local, and it makes t a member of the
| buffer-local value. That acts as a flag to run the hook
| functions of the global value as well as in the local value.
| 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.
If HOOK is void then it is initialized to nil.
(add-hook 'ruby-mode-hook (lambda () (ruby-electric-mode t)))
- add-hook, Perry Smith, 2013/01/25
- RE: add-hook,
Drew Adams <=
- Re: add-hook, Dmitry Gutov, 2013/01/25
- Message not available