all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Le Wang <l26wang@gmail.com>
To: Luca Ferrari <fluca1978@infinito.it>
Cc: help-gnu-emacs <help-gnu-emacs@gnu.org>
Subject: Re: doubt about mode hooks
Date: Mon, 3 Jun 2013 23:21:16 +0800	[thread overview]
Message-ID: <CAM=K+ioF_Q1_3X6tB0M7y7zkzEbgVHVv5SgLRsXRsUNNM8RJJw@mail.gmail.com> (raw)
In-Reply-To: <CAKoxK+425=_69guq-9nPbXuZ7a15LV38f57Xf6U=WBCkUKaznA@mail.gmail.com>

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	other threads:[~2013-06-03 15:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 14:51 doubt about mode hooks Luca Ferrari
2013-06-03 15:21 ` Le Wang [this message]
     [not found] <mailman.929.1370271116.22516.help-gnu-emacs@gnu.org>
2013-06-03 20:14 ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM=K+ioF_Q1_3X6tB0M7y7zkzEbgVHVv5SgLRsXRsUNNM8RJJw@mail.gmail.com' \
    --to=l26wang@gmail.com \
    --cc=fluca1978@infinito.it \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.