emacs-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-commit] emacs/lisp/mh-e ChangeLog mh-customize.el mh-e....


From: Satyaki Das
Subject: [Emacs-commit] emacs/lisp/mh-e ChangeLog mh-customize.el mh-e....
Date: Sat, 15 Oct 2005 23:24:55 -0400

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         
Changes by:     Satyaki Das <address@hidden>    05/10/16 03:24:55

Modified files:
        lisp/mh-e      : ChangeLog mh-customize.el mh-e.el mh-init.el 

Log message:
        * mh-init.el (mh-image-load-path-called-flag): New variable which
        is used by mh-image-load-path so that it runs only once.
        (mh-image-load-path): Modified so that it gets run only once. Also
        flatten out heavily nested if statements to make it clearer.
        
        * mh-e.el (mh-folder-mode): Call mh-image-load-path to allow Emacs
        to find images used in the toolbar.
        
        * mh-customize.el (:folder): Remove call to mh-image-load-path.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-customize.el.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-e.el.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/emacs/emacs/lisp/mh-e/mh-init.el.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.38 emacs/lisp/mh-e/ChangeLog:1.39
--- emacs/lisp/mh-e/ChangeLog:1.38      Sat Oct 15 00:49:23 2005
+++ emacs/lisp/mh-e/ChangeLog   Sun Oct 16 03:24:54 2005
@@ -1,3 +1,15 @@
+2005-10-15  Satyaki Das  <address@hidden>
+
+       * mh-init.el (mh-image-load-path-called-flag): New variable which
+       is used by mh-image-load-path so that it runs only once.
+       (mh-image-load-path): Modified so that it gets run only once. Also
+       flatten out heavily nested if statements to make it clearer.
+
+       * mh-e.el (mh-folder-mode): Call mh-image-load-path to allow Emacs
+       to find images used in the toolbar.
+
+       * mh-customize.el (:folder): Remove call to mh-image-load-path.
+
 2005-10-14  Bill Wohler  <address@hidden>
 
        * mh-e.el (Version, mh-version): Added +cvs to version.
Index: emacs/lisp/mh-e/mh-customize.el
diff -u emacs/lisp/mh-e/mh-customize.el:1.19 
emacs/lisp/mh-e/mh-customize.el:1.20
--- emacs/lisp/mh-e/mh-customize.el:1.19        Mon Oct 10 16:37:53 2005
+++ emacs/lisp/mh-e/mh-customize.el     Sun Oct 16 03:24:54 2005
@@ -1897,7 +1897,6 @@
                             for y in letter-docs
                             collect `(const :tag ,y ,x)))))))
 
-(mh-image-load-path)
 (mh-tool-bar-define
     ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg
               mh-page-msg  mh-next-undeleted-msg mh-delete-msg mh-refile-msg
Index: emacs/lisp/mh-e/mh-e.el
diff -u emacs/lisp/mh-e/mh-e.el:1.27 emacs/lisp/mh-e/mh-e.el:1.28
--- emacs/lisp/mh-e/mh-e.el:1.27        Sat Oct 15 00:49:23 2005
+++ emacs/lisp/mh-e/mh-e.el     Sun Oct 16 03:24:54 2005
@@ -1561,6 +1561,7 @@
 
 \\{mh-folder-mode-map}"
 
+  (mh-image-load-path)
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(mh-folder-font-lock-keywords t))
   (make-local-variable 'desktop-save-buffer)
Index: emacs/lisp/mh-e/mh-init.el
diff -u emacs/lisp/mh-e/mh-init.el:1.9 emacs/lisp/mh-e/mh-init.el:1.10
--- emacs/lisp/mh-e/mh-init.el:1.9      Fri Oct 14 17:15:40 2005
+++ emacs/lisp/mh-e/mh-init.el  Sun Oct 16 03:24:54 2005
@@ -307,6 +307,9 @@
 ;;; to error have been changed to calls to message, and code following was
 ;;; inserted as an else clause. This is not robust, so if you can fix this,
 ;;; please do!
+
+(defvar mh-image-load-path-called-flag nil)
+
 ;;;###mh-autoload
 (defun mh-image-load-path ()
   "Ensure that the MH-E images are accessible by `find-image'.
@@ -314,36 +317,30 @@
 `lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images
 directory is added to it if isn't already there. Otherwise, the images
 directory is added to the `load-path' if it isn't already there."
-  (let (mh-load-path mh-image-load-path)
-    ;; First, find mh-e in the load-path.
-    (let ((path load-path))
-      (while path
-        (let* ((directory (directory-file-name (car path))))
-          (setq mh-load-path
-                (if (and (equal (file-name-nondirectory directory) "mh-e")
-                         (file-exists-p directory))
-                    directory
-                  nil))
-          (setq path (if mh-load-path nil (cdr path)))))
-      (if (not mh-load-path)
-          ;; This message be error; there shouldn't be an else. Blame compiler.
-          (message "Can not find mh-e in load-path (OK when compiling)")
-        ;; Create the image path associated with this mh-e directory.
-        (setq mh-image-load-path (expand-file-name
-                                  (concat (file-name-directory mh-load-path)
-                                          "../etc/images")))))
-    (if (or (not mh-image-load-path)
-            (not (file-exists-p mh-image-load-path)))
-        ;; This message be error; there shouldn't be an else. Blame compiler.
-        (message "Can not find image directory %s (OK when compiling)"
-                 mh-image-load-path)
-      ;; If image-load-path exists, and the image path isn't there add it.
-      (if (boundp 'image-load-path)
-          (if (not (member mh-image-load-path image-load-path))
-              (push mh-image-load-path image-load-path))
-        ;; Otherwise, if the image path isn't in the load-path, add it there.
-        (if (not (member mh-image-load-path load-path))
-            (push mh-image-load-path load-path))))))
+  (message "mh-image-load-path called") ;XXX: for debugging
+  (unless mh-image-load-path-called-flag
+    (let (mh-load-path mh-image-load-path)
+      ;; First, find mh-e in the load-path.
+      (setq mh-load-path
+            (loop for dir in load-path
+                  for dir-name = (directory-file-name dir)
+                  when (and (equal (file-name-nondirectory dir-name) "mh-e")
+                            (file-exists-p dir-name))
+                  return dir-name))
+      (if mh-load-path
+          (setq mh-image-load-path
+                (expand-file-name (concat (file-name-directory mh-load-path)
+                                          "../etc/images")))
+        (error "Can not find mh-e in load-path"))
+      (cond ((or (not mh-image-load-path)
+                 (not (file-exists-p mh-image-load-path)))
+             (error "Can not find image directory %s"
+                    mh-image-load-path))
+            ((boundp 'image-load-path)
+             (pushnew mh-image-load-path image-load-path))
+            ((not (member mh-image-load-path load-path))
+             (push mh-image-load-path load-path))))
+    (setq mh-image-load-path-called-flag t)))
 
 (provide 'mh-init)
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]