summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/files.el11
-rw-r--r--lisp/tutorial.el10
3 files changed, 19 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 5b80c1dbdbe..979c0808b7b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
2013-02-11 Glenn Morris <rgm@gnu.org>
+ * files.el (enable-dir-local-variables): New variable.
+ (hack-dir-local-variables): Respect enable-dir-local-variables.
+ * tutorial.el (help-with-tutorial):
+ Ignore directory-local variables. (Bug#11127)
+
* vc/vc-svn.el (vc-svn-command): Move --non-interactive from here...
(vc-svn-global-switches): ... to here. (Bug#13513)
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)))))
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 011461119fc..39eb9e8b9aa 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -829,10 +829,9 @@ Run the Viper tutorial? "))
(progn
(insert-file-contents (tutorial--saved-file))
(let ((enable-local-variables :safe)
- (enable-local-eval nil))
+ (enable-local-eval nil)
+ (enable-dir-local-variables nil)) ; bug#11127
(hack-local-variables))
- ;; FIXME? What we actually want is to ignore dir-locals (?).
- (setq buffer-read-only nil) ; bug#11118
(goto-char (point-min))
(setq old-tut-point
(string-to-number
@@ -849,10 +848,9 @@ Run the Viper tutorial? "))
(setq tutorial--point-before-chkeys (point-marker)))
(insert-file-contents (expand-file-name filename tutorial-directory))
(let ((enable-local-variables :safe)
- (enable-local-eval nil))
+ (enable-local-eval nil)
+ (enable-dir-local-variables nil)) ; bug#11127
(hack-local-variables))
- ;; FIXME? What we actually want is to ignore dir-locals (?).
- (setq buffer-read-only nil) ; bug#11118
(forward-line)
(setq tutorial--point-before-chkeys (point-marker)))