aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-07-19 01:05:17 +0000
committerChong Yidong2009-07-19 01:05:17 +0000
commit89bf83cdc3abaf5f31fcc17f1ec3b649f0526af1 (patch)
tree0b4bce953fc7b55aeda8aeeaef61a1c4dd3303d2
parentd9e8a01896a4306b5d6e65d5f3008a4cc152712e (diff)
downloademacs-89bf83cdc3abaf5f31fcc17f1ec3b649f0526af1.tar.gz
emacs-89bf83cdc3abaf5f31fcc17f1ec3b649f0526af1.zip
* files.el (hack-local-variables-filter): Rewrite.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/files.el90
2 files changed, 45 insertions, 49 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 04a93dfe596..2d5465a3d4f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12009-07-19 Chong Yidong <cyd@stupidchicken.com>
2
3 * files.el (hack-local-variables-filter): Rewrite.
4
12009-07-19 Glenn Morris <rgm@gnu.org> 52009-07-19 Glenn Morris <rgm@gnu.org>
2 6
3 * progmodes/verilog-mode.el (verilog-error-regexp-add-xemacs): 7 * progmodes/verilog-mode.el (verilog-error-regexp-add-xemacs):
diff --git a/lisp/files.el b/lisp/files.el
index 7568bd0492d..5425626f82c 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2931,55 +2931,47 @@ VARIABLES is the alist of variable-value settings. This alist is
2931 `file-local-variables-alist', without applying them. 2931 `file-local-variables-alist', without applying them.
2932DIR-NAME is a directory name if these settings come from 2932DIR-NAME is a directory name if these settings come from
2933 directory-local variables, or nil otherwise." 2933 directory-local variables, or nil otherwise."
2934 ;; Strip any variables that are in `ignored-local-variables'. 2934 ;; Find those variables that we may want to save to
2935 (dolist (ignored ignored-local-variables) 2935 ;; `safe-local-variable-values'.
2936 (setq variables (assq-delete-all ignored variables))) 2936 (let (all-vars risky-vars unsafe-vars)
2937 ;; If `enable-local-eval' is nil, strip eval "variables". 2937 (dolist (elt variables)
2938 (if (null enable-local-eval) 2938 (let ((var (car elt))
2939 (setq variables (assq-delete-all 'eval variables))) 2939 (val (cdr elt)))
2940 (setq variables (nreverse variables)) 2940 (cond ((memq var ignored-local-variables)
2941 (when variables 2941 ;; Ignore any variable in `ignored-local-variables'.
2942 ;; Find those variables that we may want to save to 2942 nil)
2943 ;; `safe-local-variable-values'. 2943 ;; Obey `enable-local-eval'.
2944 (let (risky-vars unsafe-vars) 2944 ((eq var 'eval)
2945 (dolist (elt variables) 2945 (when enable-local-eval
2946 (let ((var (car elt)) 2946 (push elt all-vars)
2947 (val (cdr elt))) 2947 (or (eq enable-local-eval t)
2948 ;; Don't query about the fake variables. 2948 (hack-one-local-variable-eval-safep (eval (quote val)))
2949 (or (memq var '(mode unibyte coding)) 2949 (push elt unsafe-vars))))
2950 (and (eq var 'eval) 2950 ;; Ignore duplicates in the present list.
2951 (or (eq enable-local-eval t) 2951 ((assq var all-vars) nil)
2952 (hack-one-local-variable-eval-safep 2952 ;; Accept known-safe variables.
2953 (eval (quote val))))) 2953 ((or (memq var '(mode unibyte coding))
2954 (safe-local-variable-p var val) 2954 (safe-local-variable-p var val))
2955 (and (risky-local-variable-p var val) 2955 (push elt all-vars))
2956 (push elt risky-vars)) 2956 ;; The variable is either risky or unsafe:
2957 (push elt unsafe-vars)))) 2957 ((not (eq enable-local-variables :safe))
2958 (if (eq enable-local-variables :safe) 2958 (push elt all-vars)
2959 ;; If caller wants only safe variables, store only these. 2959 (if (risky-local-variable-p var val)
2960 (dolist (elt variables) 2960 (push elt risky-vars)
2961 (unless (or (member elt unsafe-vars) 2961 (push elt unsafe-vars))))))
2962 (member elt risky-vars)) 2962 (and all-vars
2963 (let ((var (car elt))) 2963 ;; Query, unless all vars are safe or user wants no querying.
2964 (unless (eq var 'eval) 2964 (or (and (eq enable-local-variables t)
2965 (setq file-local-variables-alist 2965 (null unsafe-vars)
2966 (assq-delete-all var file-local-variables-alist))) 2966 (null risky-vars))
2967 (push elt file-local-variables-alist)))) 2967 (eq enable-local-variables :all)
2968 ;; Query, unless all are known safe or the user wants no 2968 (hack-local-variables-confirm all-vars unsafe-vars
2969 ;; querying. 2969 risky-vars dir-name))
2970 (if (or (and (eq enable-local-variables t) 2970 (dolist (elt all-vars)
2971 (null unsafe-vars) 2971 (unless (eq (car elt) 'eval)
2972 (null risky-vars)) 2972 (setq file-local-variables-alist
2973 (eq enable-local-variables :all) 2973 (assq-delete-all (car elt) file-local-variables-alist)))
2974 (hack-local-variables-confirm 2974 (push elt file-local-variables-alist)))))
2975 variables unsafe-vars risky-vars dir-name))
2976 (dolist (elt variables)
2977 (let ((var (car elt)))
2978 (unless (eq var 'eval)
2979 (setq file-local-variables-alist
2980 (assq-delete-all var file-local-variables-alist)))
2981 (push elt file-local-variables-alist))))))))
2982
2983 2975
2984(defun hack-local-variables (&optional mode-only) 2976(defun hack-local-variables (&optional mode-only)
2985 "Parse and put into effect this buffer's local variables spec. 2977 "Parse and put into effect this buffer's local variables spec.