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

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

Re: doubt about mode hooks


From: Le Wang
Subject: Re: doubt about mode hooks
Date: Mon, 3 Jun 2013 23:21:16 +0800

On Mon, Jun 3, 2013 at 10:51 PM, Luca Ferrari <fluca1978@infinito.it> wrote:
> Hi all,
> so far I've added mode hooks with something like the following:
>
> (add-hook 'c-mode-hook (lambda()
>                           (my-function-hook) )
>
> but then I come across a snippet that does something different:
>
> (setq my-personal-hook 'my-function-hook)
> (add-hook c-mode-hook (lambda ()
>           (run-hooks 'my-personal-hook) ) t )
>
> so I was wondering what are the differences and which advantages
> should I get using the second. I cannot see any particular advantage
> from the manual, so I'm guessing the second effectively does not add
> the hook itself, rather a function that runs the hook.
> Any explaination?

Second way looks like fanciness for the sake of fanciness to me.

The first way can also be simpler:

(add-hook 'c-mode-hook 'my-c-setup-func)


--
Le



reply via email to

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