changeset 103965:73a2130eb104

(hack-local-variables-filter): Remove entries with duplicate keys from `file-local-variables-alist'.
author Alan Mackenzie <acm@muc.de>
date Sat, 18 Jul 2009 20:41:32 +0000
parents 484bf5aa1964
children e1f250fc8519
files lisp/files.el
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Sat Jul 18 20:40:39 2009 +0000
+++ b/lisp/files.el	Sat Jul 18 20:41:32 2009 +0000
@@ -2960,7 +2960,11 @@
 	  (dolist (elt variables)
 	    (unless (or (member elt unsafe-vars)
 			(member elt risky-vars))
-	      (push elt file-local-variables-alist)))
+	      (let ((var (car elt)))
+		(unless (eq var 'eval)
+		  (setq file-local-variables-alist
+			(assq-delete-all var file-local-variables-alist)))
+		(push elt file-local-variables-alist))))
 	;; Query, unless all are known safe or the user wants no
 	;; querying.
 	(if (or (and (eq enable-local-variables t)
@@ -2970,7 +2974,12 @@
 		(hack-local-variables-confirm
 		 variables unsafe-vars risky-vars dir-name))
 	    (dolist (elt variables)
-	      (push elt file-local-variables-alist)))))))
+	      (let ((var (car elt)))
+		(unless (eq var 'eval)
+		  (setq file-local-variables-alist
+			(assq-delete-all var file-local-variables-alist)))
+		(push elt file-local-variables-alist))))))))
+
 
 (defun hack-local-variables (&optional mode-only)
   "Parse and put into effect this buffer's local variables spec.
@@ -3073,6 +3082,7 @@
 	  (enable-local-variables
 	   (hack-local-variables-filter result nil)
 	   (when file-local-variables-alist
+	     ;; Any 'evals must run in the Right sequence.
 	     (setq file-local-variables-alist
 		   (nreverse file-local-variables-alist))
 	     (run-hooks 'before-hack-local-variables-hook)