Commit 97a1cd9d authored by Glenn Morris's avatar Glenn Morris
Browse files

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
parent c57b2d76
......@@ -45,6 +45,10 @@ non-nil, they output the same results.
** `eval-defun' on an already defined defcustom calls the :set function,
if there is one.
** If the new variable `enable-dir-local-variables' is nil,
directory local variables are ignored. May be useful for some modes
that want to ignore directory-locals while still respecting file-locals.
** The option `set-mark-default-inactive' has been deleted.
This unfinished feature was introduced by accident in Emacs 23.1;
simply disabling Transient Mark mode does the same thing.
......@@ -228,7 +232,7 @@ alist of extended attributes as returned by the new function
file using `set-file-extended-attributes'.
* Lisp changes in Emacs 24.4
* Lisp Changes in Emacs 24.4
** Support for filesystem notifications.
Emacs now supports notifications of filesystem changes, such as
......@@ -273,7 +277,7 @@ used in place of the 9th element of `file-attributes'.
and ACL entries.
* Changes in Emacs 24.4 on non-free operating systems
* Changes in Emacs 24.4 on Non-Free Operating Systems
+++
** The "generate a backtrace on fatal error" feature now works on MS Windows.
......
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)
......
......@@ -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)))))
......
......@@ -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)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment