aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/files.el25
1 files changed, 20 insertions, 5 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 5425626f82c..ea74261601e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2637,7 +2637,7 @@ Otherwise, return nil; point may be changed."
2637 2637
2638(defvar ignored-local-variables 2638(defvar ignored-local-variables
2639 '(ignored-local-variables safe-local-variable-values 2639 '(ignored-local-variables safe-local-variable-values
2640 file-local-variables-alist) 2640 file-local-variables-alist dir-local-variables-alist)
2641 "Variables to be ignored in a file's local variable spec.") 2641 "Variables to be ignored in a file's local variable spec.")
2642 2642
2643(defvar hack-local-variables-hook nil 2643(defvar hack-local-variables-hook nil
@@ -2760,6 +2760,15 @@ specified. The actual value in the buffer may differ from VALUE,
2760if it is changed by the major or minor modes, or by the user.") 2760if it is changed by the major or minor modes, or by the user.")
2761(make-variable-buffer-local 'file-local-variables-alist) 2761(make-variable-buffer-local 'file-local-variables-alist)
2762 2762
2763(defvar dir-local-variables-alist nil
2764 "Alist of directory-local variable settings in the current buffer.
2765Each element in this list has the form (VAR . VALUE), where VAR
2766is a directory-local variable (a symbol) and VALUE is the value
2767specified in .dir-locals.el. The actual value in the buffer
2768may differ from VALUE, if it is changed by the major or minor modes,
2769or by the user.")
2770(make-variable-buffer-local 'dir-local-variables-alist)
2771
2763(defvar before-hack-local-variables-hook nil 2772(defvar before-hack-local-variables-hook nil
2764 "Normal hook run before setting file-local variables. 2773 "Normal hook run before setting file-local variables.
2765It is called after checking for unsafe/risky variables and 2774It is called after checking for unsafe/risky variables and
@@ -2969,6 +2978,9 @@ DIR-NAME is a directory name if these settings come from
2969 risky-vars dir-name)) 2978 risky-vars dir-name))
2970 (dolist (elt all-vars) 2979 (dolist (elt all-vars)
2971 (unless (eq (car elt) 'eval) 2980 (unless (eq (car elt) 'eval)
2981 (unless dir-name
2982 (setq dir-local-variables-alist
2983 (assq-delete-all (car elt) dir-local-variables-alist)))
2972 (setq file-local-variables-alist 2984 (setq file-local-variables-alist
2973 (assq-delete-all (car elt) file-local-variables-alist))) 2985 (assq-delete-all (car elt) file-local-variables-alist)))
2974 (push elt file-local-variables-alist))))) 2986 (push elt file-local-variables-alist)))))
@@ -3364,12 +3376,10 @@ is found. Returns the new class name."
3364 (nth 5 (file-attributes file))) 3376 (nth 5 (file-attributes file)))
3365 class-name))) 3377 class-name)))
3366 3378
3367(declare-function c-postprocess-file-styles "cc-mode" ())
3368
3369(defun hack-dir-local-variables () 3379(defun hack-dir-local-variables ()
3370 "Read per-directory local variables for the current buffer. 3380 "Read per-directory local variables for the current buffer.
3371Store the directory-local variables in `file-local-variables-alist', 3381Store the directory-local variables in `dir-local-variables-alist'
3372without applying them." 3382and `file-local-variables-alist', without applying them."
3373 (when (and enable-local-variables 3383 (when (and enable-local-variables
3374 (buffer-file-name) 3384 (buffer-file-name)
3375 (not (file-remote-p (buffer-file-name)))) 3385 (not (file-remote-p (buffer-file-name))))
@@ -3389,6 +3399,11 @@ without applying them."
3389 (dir-locals-collect-variables 3399 (dir-locals-collect-variables
3390 (dir-locals-get-class-variables class) dir-name nil))) 3400 (dir-locals-get-class-variables class) dir-name nil)))
3391 (when variables 3401 (when variables
3402 (dolist (elt variables)
3403 (unless (eq (car elt) 'eval)
3404 (setq dir-local-variables-alist
3405 (assq-delete-all (car elt) dir-local-variables-alist)))
3406 (push elt dir-local-variables-alist))
3392 (hack-local-variables-filter variables dir-name))))))) 3407 (hack-local-variables-filter variables dir-name)))))))
3393 3408
3394 3409