aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/files.el35
1 files changed, 25 insertions, 10 deletions
diff --git a/lisp/files.el b/lisp/files.el
index e953a174448..92135d94714 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -326,9 +326,12 @@ See also `write-file-hooks'.")
326The value can be t, nil or something else. 326The value can be t, nil or something else.
327A value of t means file local variables specifications are obeyed; 327A value of t means file local variables specifications are obeyed;
328nil means they are ignored; anything else means query. 328nil means they are ignored; anything else means query.
329This variable also controls use of major modes specified in
330a -*- line.
329 331
330The command \\[normal-mode] always obeys file local variable 332The command \\[normal-mode], when used interactively,
331specifications and ignores this variable." 333always obeys file local variable specifications and the -*- line,
334and ignores this variable."
332 :type '(choice (const :tag "Obey" t) 335 :type '(choice (const :tag "Obey" t)
333 (const :tag "Ignore" nil) 336 (const :tag "Ignore" nil)
334 (other :tag "Query" other)) 337 (other :tag "Query" other))
@@ -336,8 +339,12 @@ specifications and ignores this variable."
336 339
337(defvar local-enable-local-variables t 340(defvar local-enable-local-variables t
338 "Like `enable-local-variables' but meant for buffer-local bindings. 341 "Like `enable-local-variables' but meant for buffer-local bindings.
342The meaningful values are nil and non-nil. The default is non-nil.
339If a major mode sets this to nil, buffer-locally, then any local 343If a major mode sets this to nil, buffer-locally, then any local
340variables list in the file will be ignored.") 344variables list in the file will be ignored.
345
346This variable does not affect the use of major modes
347specified in a -*- line.")
341 348
342(defcustom enable-local-eval 'maybe 349(defcustom enable-local-eval 'maybe
343 "*Control processing of the \"variable\" `eval' in a file's local variables. 350 "*Control processing of the \"variable\" `eval' in a file's local variables.
@@ -1168,10 +1175,15 @@ Also sets up any specified local variables of the file.
1168Uses the visited file name, the -*- line, and the local variables spec. 1175Uses the visited file name, the -*- line, and the local variables spec.
1169 1176
1170This function is called automatically from `find-file'. In that case, 1177This function is called automatically from `find-file'. In that case,
1171we may set up specified local variables depending on the value of 1178we may set up the file-specified mode and local variables,
1172`enable-local-variables': if it is t, we do; if it is nil, we don't; 1179depending on the value of `enable-local-variables': if it is t, we do;
1173otherwise, we query. `enable-local-variables' is ignored if you 1180if it is nil, we don't; otherwise, we query.
1174run `normal-mode' explicitly." 1181In addition, if `local-enable-local-variables' is nil, we do
1182not set local variables (though we do notice a mode specified with -*-.)
1183
1184`enable-local-variables' is ignored if you run `normal-mode' interactively,
1185or from Lisp without specifying the optional argument FIND-FILE;
1186in that case, this function acts as if `enable-local-variables' were t."
1175 (interactive) 1187 (interactive)
1176 (or find-file (funcall (or default-major-mode 'fundamental-mode))) 1188 (or find-file (funcall (or default-major-mode 'fundamental-mode)))
1177 (condition-case err 1189 (condition-case err
@@ -1391,7 +1403,6 @@ and we don't even do that unless it would come from the file name."
1391 (goto-char (point-min)) 1403 (goto-char (point-min))
1392 (skip-chars-forward " \t\n") 1404 (skip-chars-forward " \t\n")
1393 (and enable-local-variables 1405 (and enable-local-variables
1394 local-enable-local-variables
1395 ;; Don't look for -*- if this file name matches any 1406 ;; Don't look for -*- if this file name matches any
1396 ;; of the regexps in inhibit-first-line-modes-regexps. 1407 ;; of the regexps in inhibit-first-line-modes-regexps.
1397 (let ((temp inhibit-first-line-modes-regexps) 1408 (let ((temp inhibit-first-line-modes-regexps)
@@ -1512,7 +1523,9 @@ and we don't even do that unless it would come from the file name."
1512 (save-excursion 1523 (save-excursion
1513 (goto-char (point-min)) 1524 (goto-char (point-min))
1514 (let ((result nil) 1525 (let ((result nil)
1515 (end (save-excursion (end-of-line (and (looking-at "^#!") 2)) (point)))) 1526 (end (save-excursion (end-of-line (and (looking-at "^#!") 2)) (point)))
1527 (enable-local-variables
1528 (and local-enable-local-variables enable-local-variables)))
1516 ;; Parse the -*- line into the `result' alist. 1529 ;; Parse the -*- line into the `result' alist.
1517 (cond ((not (search-forward "-*-" end t)) 1530 (cond ((not (search-forward "-*-" end t))
1518 ;; doesn't have one. 1531 ;; doesn't have one.
@@ -1584,7 +1597,9 @@ is specified, returning t if it is specified."
1584 (unless mode-only 1597 (unless mode-only
1585 (hack-local-variables-prop-line)) 1598 (hack-local-variables-prop-line))
1586 ;; Look for "Local variables:" line in last page. 1599 ;; Look for "Local variables:" line in last page.
1587 (let (mode-specified) 1600 (let (mode-specified
1601 (enable-local-variables
1602 (and local-enable-local-variables enable-local-variables)))
1588 (save-excursion 1603 (save-excursion
1589 (goto-char (point-max)) 1604 (goto-char (point-max))
1590 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) 1605 (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move)