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

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

Re: a mode-specific hack-local-variables-hook ?


From: Sam Halliday
Subject: Re: a mode-specific hack-local-variables-hook ?
Date: Wed, 17 Jun 2015 14:19:47 -0700 (PDT)
User-agent: G2/1.0

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



reply via email to

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