diff lisp/startup.el @ 62696:84252cd99187

(normal-top-level): Allow modification of load-path while iterating over it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 25 May 2005 14:18:45 +0000
parents a7e02ef1e3d6
children 977d18df13bb 63b7247f4be6 5b029ff3b08d
line wrap: on
line diff
--- a/lisp/startup.el	Wed May 25 14:17:42 2005 +0000
+++ b/lisp/startup.el	Wed May 25 14:18:45 2005 +0000
@@ -368,11 +368,17 @@
     ;; of that dir into load-path,
     ;; Look for a leim-list.el file too.  Loading it will register
     ;; available input methods.
-    (dolist (dir load-path)
-      (let ((default-directory dir))
-	(load (expand-file-name "subdirs.el") t t t))
-      (let ((default-directory dir))
-	(load (expand-file-name "leim-list.el") t t t)))
+    (let ((tail load-path) dir)
+      (while tail
+        (setq dir (car tail))
+        (let ((default-directory dir))
+          (load (expand-file-name "subdirs.el") t t t))
+        (let ((default-directory dir))
+          (load (expand-file-name "leim-list.el") t t t))
+        ;; We don't use a dolist loop and we put this "setq-cdr" command at
+        ;; the end, because the subdirs.el files may add elements to the end
+        ;; of load-path and we want to take it into account.
+        (setq tail (cdr tail))))
     (unless (eq system-type 'vax-vms)
       ;; If the PWD environment variable isn't accurate, delete it.
       (let ((pwd (getenv "PWD")))