[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: a mode-specific hack-local-variables-hook ?
From: |
John Mastro |
Subject: |
Re: a mode-specific hack-local-variables-hook ? |
Date: |
Wed, 17 Jun 2015 14:06:07 -0700 |
> 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