From 61086eb66b6a222124f302c197e14021711d29d3 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Fri, 20 Jan 2012 19:15:07 -0800 Subject: [PATCH] Document inhibit-local-variables-regexps in the lispref. * doc/lispref/modes.texi (Auto Major Mode): * doc/lispref/variables.texi (File Local Variables): Mention inhibit-local-variables-regexps. * etc/NEWS: Markup. --- doc/lispref/ChangeLog | 6 ++++++ doc/lispref/modes.texi | 12 ++++++++++++ doc/lispref/variables.texi | 7 +++++++ etc/NEWS | 3 +-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 44467d5f51b..872c4f564ac 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,9 @@ +2012-01-21 Glenn Morris + + * modes.texi (Auto Major Mode): + * variables.texi (File Local Variables): + Mention inhibit-local-variables-regexps. + 2012-01-19 Martin Rudalics * windows.texi (Window Configurations): Rewrite references to diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 5d09b79748e..b3aac231d5b 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -588,6 +588,18 @@ Chosen, emacs, The GNU Emacs Manual}. If @code{enable-local-variables} is @code{nil}, @code{set-auto-mode} does not check the @w{@samp{-*-}} line, or near the end of the file, for any mode tag. +@vindex inhibit-local-variables-regexps +There are some file types where it is not appropriate to scan the file +contents for a mode specifier. For example, a tar archive may happen to +contain, near the end of the file, a member file that has a local +variables section specifying a mode for that particular file. This +should not be applied to the containing tar file. Similarly, a tiff +image file might just happen to contain a first line that seems to +match the @w{@samp{-*-}} pattern. For these reasons, both these file +extensions are members of the list @var{inhibit-local-variables-regexps}. +Add patterns to this list to prevent Emacs searching them for local +variables of any kind (not just mode specifiers). + If @var{keep-mode-if-same} is non-@code{nil}, this function does not call the mode command if the buffer is already in the proper major mode. For instance, @code{set-visited-file-name} sets this to diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index b0a6795021b..a8f75f5a160 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1660,6 +1660,13 @@ Query (once) about all the variables. @end table @end defopt +@defvar inhibit-local-variables-regexps +This is a list of regular expressions. If a file has a name +matching an element of this list, then it is not scanned for +any form of file-local variable. For examples of why you might want +to use this, @pxref{Auto Major Mode}. +@end defvar + @defun hack-local-variables &optional mode-only This function parses, and binds or evaluates as appropriate, any local variables specified by the contents of the current buffer. The variable diff --git a/etc/NEWS b/etc/NEWS index 743e3ce2e7b..b22f79225d5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -369,8 +369,7 @@ turn on `whitespace-mode' for *vc-diff* buffers. Modes should call *** Using "mode: MINOR-MODE" to enable a minor mode is deprecated. Instead, use "eval: (minor-mode 1)". -FIXME: inhibit-first-line-modes-regexps was not mentioned in lispref, -but this probably should be. ++++ *** The variable `inhibit-first-line-modes-regexps' has been renamed to `inhibit-local-variables-regexps'. As the name suggests, it now applies to ALL file local variables, not just -*- mode ones. -- 2.11.4.GIT