all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sam Halliday <sam.halliday@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: a mode-specific hack-local-variables-hook ?
Date: Wed, 17 Jun 2015 14:19:47 -0700 (PDT)	[thread overview]
Message-ID: <5dfd3469-837c-4b17-9f72-9850187cafff@googlegroups.com> (raw)
In-Reply-To: <mailman.5204.1434575192.904.help-gnu-emacs@gnu.org>

Fantastic! Perfect for my needs. I was looking at the docs for all the wrong things.

On Wednesday, 17 June 2015 22:06:34 UTC+1, John Mastro  wrote:
> > 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



      parent reply	other threads:[~2015-06-17 21:19 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
     [not found]   ` <mailman.5204.1434575192.904.help-gnu-emacs@gnu.org>
2015-06-17 21:19     ` Sam Halliday [this message]

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=5dfd3469-837c-4b17-9f72-9850187cafff@googlegroups.com \
    --to=sam.halliday@gmail.com \
    --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.