diff options
| author | Alan Mackenzie | 2009-07-18 20:41:32 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2009-07-18 20:41:32 +0000 |
| commit | 982cbcabc07cd26ef17894547a40745c9231479c (patch) | |
| tree | 40949b5bf310e94b07eb9614c88f22e87adced54 /lisp | |
| parent | 10d37df7e232024b86622b57018ea1b5e14e3785 (diff) | |
| download | emacs-982cbcabc07cd26ef17894547a40745c9231479c.tar.gz emacs-982cbcabc07cd26ef17894547a40745c9231479c.zip | |
(hack-local-variables-filter): Remove entries with duplicate keys from
`file-local-variables-alist'.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/files.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el index 0c4edf63363..7568bd0492d 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -2960,7 +2960,11 @@ DIR-NAME is a directory name if these settings come from | |||
| 2960 | (dolist (elt variables) | 2960 | (dolist (elt variables) |
| 2961 | (unless (or (member elt unsafe-vars) | 2961 | (unless (or (member elt unsafe-vars) |
| 2962 | (member elt risky-vars)) | 2962 | (member elt risky-vars)) |
| 2963 | (push elt file-local-variables-alist))) | 2963 | (let ((var (car elt))) |
| 2964 | (unless (eq var 'eval) | ||
| 2965 | (setq file-local-variables-alist | ||
| 2966 | (assq-delete-all var file-local-variables-alist))) | ||
| 2967 | (push elt file-local-variables-alist)))) | ||
| 2964 | ;; Query, unless all are known safe or the user wants no | 2968 | ;; Query, unless all are known safe or the user wants no |
| 2965 | ;; querying. | 2969 | ;; querying. |
| 2966 | (if (or (and (eq enable-local-variables t) | 2970 | (if (or (and (eq enable-local-variables t) |
| @@ -2970,7 +2974,12 @@ DIR-NAME is a directory name if these settings come from | |||
| 2970 | (hack-local-variables-confirm | 2974 | (hack-local-variables-confirm |
| 2971 | variables unsafe-vars risky-vars dir-name)) | 2975 | variables unsafe-vars risky-vars dir-name)) |
| 2972 | (dolist (elt variables) | 2976 | (dolist (elt variables) |
| 2973 | (push elt file-local-variables-alist))))))) | 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 | |||
| 2974 | 2983 | ||
| 2975 | (defun hack-local-variables (&optional mode-only) | 2984 | (defun hack-local-variables (&optional mode-only) |
| 2976 | "Parse and put into effect this buffer's local variables spec. | 2985 | "Parse and put into effect this buffer's local variables spec. |
| @@ -3073,6 +3082,7 @@ is specified, returning t if it is specified." | |||
| 3073 | (enable-local-variables | 3082 | (enable-local-variables |
| 3074 | (hack-local-variables-filter result nil) | 3083 | (hack-local-variables-filter result nil) |
| 3075 | (when file-local-variables-alist | 3084 | (when file-local-variables-alist |
| 3085 | ;; Any 'evals must run in the Right sequence. | ||
| 3076 | (setq file-local-variables-alist | 3086 | (setq file-local-variables-alist |
| 3077 | (nreverse file-local-variables-alist)) | 3087 | (nreverse file-local-variables-alist)) |
| 3078 | (run-hooks 'before-hack-local-variables-hook) | 3088 | (run-hooks 'before-hack-local-variables-hook) |