Subject: bug#910: leim-list.el is looked up in too many places at startup

From: Glenn Morris <[email-masked]>
Date: Tue, 09 Sep 2008 22:04:05 -0400

Dan Nicolaescu wrote:

> strace emacs -Q
>
> shows that leim-list.el is looked up in 32 locations at startup. We
> only have it in a single place.  Is this a leftover from the time
> when leim was distributed separately from emacs?
>
> It would be good if this redundant work would be avoided.

It does seem superfluous. This works for me:

*** startup.el	23 Aug 2008 16:59:19 -0000	1.503
--- startup.el	10 Sep 2008 02:03:52 -0000
***************
*** 478,496 ****
      ;; Look in each dir in load-path for a subdirs.el file.
      ;; If we find one, load it, which will add the appropriate subdirs
      ;; of that dir into load-path,
-     ;; Look for a leim-list.el file too.  Loading it will register
-     ;; available input methods.
      (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))))
      ;; If the PWD environment variable isn't accurate, delete it.
      (let ((pwd (getenv "PWD")))
        (and (stringp pwd)
--- 478,501 ----
      ;; Look in each dir in load-path for a subdirs.el file.
      ;; If we find one, load it, which will add the appropriate subdirs
      ;; of that dir into load-path,
      (let ((tail load-path) dir)
        (while tail
          (setq dir (car tail))
          (let ((default-directory dir))
            (load (expand-file-name "subdirs.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))))
+     ;; Look for a leim-list.el file.  Loading it will register
+     ;; available input methods.
+     (let ((leim (expand-file-name "../leim/leim-list.el" data-directory)))
+       (condition-case nil
+ 	  (load leim nil t t)
+ 	(error
+ 	 (display-warning 'initialization
+ 			  (format "Unable to load LEIM file `%s'" leim)
+ 			  :error))))
      ;; If the PWD environment variable isn't accurate, delete it.
      (let ((pwd (getenv "PWD")))
        (and (stringp pwd)