changeset 68869:443a9b04eefe

* files.el (hack-local-variables): Only set results if they exist.
author Chong Yidong <cyd@stupidchicken.com>
date Tue, 14 Feb 2006 03:47:00 +0000
parents 68b8fcd1410c
children 9cc0a5b4b6e7 d57ee9eab157
files lisp/files.el
diffstat 1 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/files.el	Tue Feb 14 01:22:05 2006 +0000
+++ b/lisp/files.el	Tue Feb 14 03:47:00 2006 +0000
@@ -2439,34 +2439,35 @@
       ;; variables (if MODE-ONLY is nil.)
       (if mode-only
 	  result
-	(setq result (nreverse result))
-	(dolist (ignored ignored-local-variables)
-	  (setq result (assq-delete-all ignored result)))
-	(if (null enable-local-eval)
-	    (setq result (assq-delete-all 'eval result)))
-	;; Find those variables that we may want to save to
-	;; `safe-local-variable-values'.
-	(let (risky-vars unsafe-vars)
-	  (dolist (elt result)
-	    (let ((var (car elt))
-		  (val (cdr elt)))
-	      (or (eq var 'mode)
-		  (and (eq var 'eval)
-		       (or (eq enable-local-eval t)
-			   (hack-one-local-variable-eval-safep
-			    (eval (quote val)))))
-		  (safe-local-variable-p var val)
-		  (and (risky-local-variable-p var val)
-		       (push elt risky-vars))
-		  (push elt unsafe-vars))))
-	  (if (or (and (eq enable-local-variables t)
-		       (null unsafe-vars)
-		       (null risky-vars))
-		  (hack-local-variables-confirm
-		   result unsafe-vars risky-vars))
-	      (dolist (elt result)
-		(hack-one-local-variable (car elt) (cdr elt)))))
-	(run-hooks 'hack-local-variables-hook)))))
+	(when result
+	  (setq result (nreverse result))
+	  (dolist (ignored ignored-local-variables)
+	    (setq result (assq-delete-all ignored result)))
+	  (if (null enable-local-eval)
+	      (setq result (assq-delete-all 'eval result)))
+	  ;; Find those variables that we may want to save to
+	  ;; `safe-local-variable-values'.
+	  (let (risky-vars unsafe-vars)
+	    (dolist (elt result)
+	      (let ((var (car elt))
+		    (val (cdr elt)))
+		(or (eq var 'mode)
+		    (and (eq var 'eval)
+			 (or (eq enable-local-eval t)
+			     (hack-one-local-variable-eval-safep
+			      (eval (quote val)))))
+		    (safe-local-variable-p var val)
+		    (and (risky-local-variable-p var val)
+			 (push elt risky-vars))
+		    (push elt unsafe-vars))))
+	    (if (or (and (eq enable-local-variables t)
+			 (null unsafe-vars)
+			 (null risky-vars))
+		    (hack-local-variables-confirm
+		     result unsafe-vars risky-vars))
+		(dolist (elt result)
+		  (hack-one-local-variable (car elt) (cdr elt)))))
+	  (run-hooks 'hack-local-variables-hook))))))
 
 (defvar ignored-local-variables
   '(ignored-local-variables safe-local-variable-values)