From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sam Halliday Newsgroups: gmane.emacs.help Subject: Re: a mode-specific hack-local-variables-hook ? Date: Wed, 17 Jun 2015 14:19:47 -0700 (PDT) Message-ID: <5dfd3469-837c-4b17-9f72-9850187cafff@googlegroups.com> References: <1402b672-2754-461c-af9c-4bbfe5078a44@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1434576039 18328 80.91.229.3 (17 Jun 2015 21:20:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Jun 2015 21:20:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jun 17 23:20:30 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z5Kks-0001EW-57 for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2015 23:20:18 +0200 Original-Received: from localhost ([::1]:49287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z5Kkr-000529-5M for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Jun 2015 17:20:17 -0400 X-Received: by 10.140.131.139 with SMTP id 133mr9753502qhd.10.1434575987780; Wed, 17 Jun 2015 14:19:47 -0700 (PDT) X-Received: by 10.140.95.109 with SMTP id h100mr120897qge.6.1434575987762; Wed, 17 Jun 2015 14:19:47 -0700 (PDT) Original-Path: usenet.stanford.edu!q107no1813743qgd.0!news-out.google.com!4ni2055qgh.1!nntp.google.com!z60no1812162qgd.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=82.13.129.22; posting-account=kRukCAoAAAANs-vsVh9dFwo5kp5pwnPz Original-NNTP-Posting-Host: 82.13.129.22 User-Agent: G2/1.0 Injection-Date: Wed, 17 Jun 2015 21:19:47 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:212738 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:105022 Archived-At: 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