all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Mastro <john.b.mastro@gmail.com>
To: Sam Halliday <sam.halliday@gmail.com>,
	 "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: a mode-specific hack-local-variables-hook ?
Date: Wed, 17 Jun 2015 14:06:07 -0700	[thread overview]
Message-ID: <CAOj2CQRRsTDHwJfaJAHTsc8sjfgZek7ikvV4hBgZnAdYMz=SUg@mail.gmail.com> (raw)
In-Reply-To: <bde320e7-4e6f-4786-9f06-b1bdea88f8f5@googlegroups.com>

> I did this in my major mode hook, thinking that it would just add it
> to the current mode's hooks, but it seems to be a global hook. Other
> than putting in an "(if (eq major-mode 'scala-mode) ... )" type test
> in a lambda (outside of my major mode hook), is there any other way to
> set a buffer-local hack-local-variables-hook?

The function `add-hook' has an optional fourth argument, LOCAL, about
which the `add-hook' docstring says:

    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.

Does this do what you need?

    (add-hook 'hack-local-variables-hook 'whitespace-mode nil t)

-- 
john



  reply	other threads:[~2015-06-17 21:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-17 19:54 a mode-specific hack-local-variables-hook ? Sam Halliday
2015-06-17 20:19 ` Sam Halliday
2015-06-17 21:06   ` John Mastro [this message]
     [not found]   ` <mailman.5204.1434575192.904.help-gnu-emacs@gnu.org>
2015-06-17 21:19     ` Sam Halliday

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='CAOj2CQRRsTDHwJfaJAHTsc8sjfgZek7ikvV4hBgZnAdYMz=SUg@mail.gmail.com' \
    --to=john.b.mastro@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=sam.halliday@gmail.com \
    /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.