summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-02-10 17:50:45 -0800
committerGlenn Morris <rgm@gnu.org>2013-02-10 17:50:45 -0800
commit97a1cd9d27e7d95263b475d03ce39c20a2ff4512 (patch)
tree6ccbcec387797f9e1407c19169d7d4747a741784 /lisp/files.el
parentc57b2d76277b678431d2926a542003e1275927a9 (diff)
downloademacs-97a1cd9d27e7d95263b475d03ce39c20a2ff4512.tar.gz
emacs-97a1cd9d27e7d95263b475d03ce39c20a2ff4512.tar.bz2
emacs-97a1cd9d27e7d95263b475d03ce39c20a2ff4512.zip
Add `enable-dir-local-variables'
* lisp/files.el (enable-dir-local-variables): New variable. (hack-dir-local-variables): Respect enable-dir-local-variables. * lisp/tutorial.el (help-with-tutorial): Ignore directory-local variables. Fixes: debbugs:11127
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el
index c9e5d2763fe..890834d4af0 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -507,6 +507,11 @@ and ignores this variable."
(other :tag "Query" other))
:group 'find-file)
+(defvar enable-dir-local-variables t
+ "Non-nil means enable use of directory-local variables.
+Some modes may wish to set this to nil to prevent directory-local
+settings being applied, but still respect file-local ones.")
+
;; This is an odd variable IMO.
;; You might wonder why it is needed, when we could just do:
;; (set (make-local-variable 'enable-local-variables) nil)
@@ -3659,8 +3664,12 @@ is found. Returns the new class name."
(defun hack-dir-local-variables ()
"Read per-directory local variables for the current buffer.
Store the directory-local variables in `dir-local-variables-alist'
-and `file-local-variables-alist', without applying them."
+and `file-local-variables-alist', without applying them.
+
+This does nothing if either `enable-local-variables' or
+`enable-dir-local-variables' are nil."
(when (and enable-local-variables
+ enable-dir-local-variables
(or enable-remote-dir-locals
(not (file-remote-p (or (buffer-file-name)
default-directory)))))