aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSatyaki Das2005-10-16 03:24:54 +0000
committerSatyaki Das2005-10-16 03:24:54 +0000
commit2416ec641247bc8d59cca8cac038cd00eba646f9 (patch)
tree0cce79d178a5ff030de21d10680e1761b03db1ac
parent2ef1363ecdecf66c6007eb4c0918713b13448923 (diff)
downloademacs-2416ec641247bc8d59cca8cac038cd00eba646f9.tar.gz
emacs-2416ec641247bc8d59cca8cac038cd00eba646f9.zip
* 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.
-rw-r--r--lisp/mh-e/ChangeLog12
-rw-r--r--lisp/mh-e/mh-customize.el1
-rw-r--r--lisp/mh-e/mh-e.el1
-rw-r--r--lisp/mh-e/mh-init.el57
4 files changed, 40 insertions, 31 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 93522331045..d69d36c10af 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,15 @@
12005-10-15 Satyaki Das <satyaki@theforce.stanford.edu>
2
3 * mh-init.el (mh-image-load-path-called-flag): New variable which
4 is used by mh-image-load-path so that it runs only once.
5 (mh-image-load-path): Modified so that it gets run only once. Also
6 flatten out heavily nested if statements to make it clearer.
7
8 * mh-e.el (mh-folder-mode): Call mh-image-load-path to allow Emacs
9 to find images used in the toolbar.
10
11 * mh-customize.el (:folder): Remove call to mh-image-load-path.
12
12005-10-14 Bill Wohler <wohler@newt.com> 132005-10-14 Bill Wohler <wohler@newt.com>
2 14
3 * mh-e.el (Version, mh-version): Added +cvs to version. 15 * mh-e.el (Version, mh-version): Added +cvs to version.
diff --git a/lisp/mh-e/mh-customize.el b/lisp/mh-e/mh-customize.el
index 4dcf0ad1be8..c1d81615f1e 100644
--- a/lisp/mh-e/mh-customize.el
+++ b/lisp/mh-e/mh-customize.el
@@ -1897,7 +1897,6 @@ where,
1897 for y in letter-docs 1897 for y in letter-docs
1898 collect `(const :tag ,y ,x))))))) 1898 collect `(const :tag ,y ,x)))))))
1899 1899
1900(mh-image-load-path)
1901(mh-tool-bar-define 1900(mh-tool-bar-define
1902 ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg 1901 ((:folder mh-inc-folder mh-mime-save-parts mh-previous-undeleted-msg
1903 mh-page-msg mh-next-undeleted-msg mh-delete-msg mh-refile-msg 1902 mh-page-msg mh-next-undeleted-msg mh-delete-msg mh-refile-msg
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 30ae10ef5e7..c0b57ee56ca 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -1561,6 +1561,7 @@ messages in that region.
1561 1561
1562\\{mh-folder-mode-map}" 1562\\{mh-folder-mode-map}"
1563 1563
1564 (mh-image-load-path)
1564 (make-local-variable 'font-lock-defaults) 1565 (make-local-variable 'font-lock-defaults)
1565 (setq font-lock-defaults '(mh-folder-font-lock-keywords t)) 1566 (setq font-lock-defaults '(mh-folder-font-lock-keywords t))
1566 (make-local-variable 'desktop-save-buffer) 1567 (make-local-variable 'desktop-save-buffer)
diff --git a/lisp/mh-e/mh-init.el b/lisp/mh-e/mh-init.el
index 7efbfd003d5..a0408172ed7 100644
--- a/lisp/mh-e/mh-init.el
+++ b/lisp/mh-e/mh-init.el
@@ -307,6 +307,9 @@ by the variable `mh-variants'."
307;;; to error have been changed to calls to message, and code following was 307;;; to error have been changed to calls to message, and code following was
308;;; inserted as an else clause. This is not robust, so if you can fix this, 308;;; inserted as an else clause. This is not robust, so if you can fix this,
309;;; please do! 309;;; please do!
310
311(defvar mh-image-load-path-called-flag nil)
312
310;;;###mh-autoload 313;;;###mh-autoload
311(defun mh-image-load-path () 314(defun mh-image-load-path ()
312 "Ensure that the MH-E images are accessible by `find-image'. 315 "Ensure that the MH-E images are accessible by `find-image'.
@@ -314,36 +317,30 @@ Images for MH-E are found in ../../etc/images relative to the files in
314`lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images 317`lisp/mh-e'. If `image-load-path' exists (since Emacs 22), then the images
315directory is added to it if isn't already there. Otherwise, the images 318directory is added to it if isn't already there. Otherwise, the images
316directory is added to the `load-path' if it isn't already there." 319directory is added to the `load-path' if it isn't already there."
317 (let (mh-load-path mh-image-load-path) 320 (message "mh-image-load-path called") ;XXX: for debugging
318 ;; First, find mh-e in the load-path. 321 (unless mh-image-load-path-called-flag
319 (let ((path load-path)) 322 (let (mh-load-path mh-image-load-path)
320 (while path 323 ;; First, find mh-e in the load-path.
321 (let* ((directory (directory-file-name (car path)))) 324 (setq mh-load-path
322 (setq mh-load-path 325 (loop for dir in load-path
323 (if (and (equal (file-name-nondirectory directory) "mh-e") 326 for dir-name = (directory-file-name dir)
324 (file-exists-p directory)) 327 when (and (equal (file-name-nondirectory dir-name) "mh-e")
325 directory 328 (file-exists-p dir-name))
326 nil)) 329 return dir-name))
327 (setq path (if mh-load-path nil (cdr path))))) 330 (if mh-load-path
328 (if (not mh-load-path) 331 (setq mh-image-load-path
329 ;; This message be error; there shouldn't be an else. Blame compiler. 332 (expand-file-name (concat (file-name-directory mh-load-path)
330 (message "Can not find mh-e in load-path (OK when compiling)") 333 "../etc/images")))
331 ;; Create the image path associated with this mh-e directory. 334 (error "Can not find mh-e in load-path"))
332 (setq mh-image-load-path (expand-file-name 335 (cond ((or (not mh-image-load-path)
333 (concat (file-name-directory mh-load-path) 336 (not (file-exists-p mh-image-load-path)))
334 "../etc/images"))))) 337 (error "Can not find image directory %s"
335 (if (or (not mh-image-load-path) 338 mh-image-load-path))
336 (not (file-exists-p mh-image-load-path))) 339 ((boundp 'image-load-path)
337 ;; This message be error; there shouldn't be an else. Blame compiler. 340 (pushnew mh-image-load-path image-load-path))
338 (message "Can not find image directory %s (OK when compiling)" 341 ((not (member mh-image-load-path load-path))
339 mh-image-load-path) 342 (push mh-image-load-path load-path))))
340 ;; If image-load-path exists, and the image path isn't there add it. 343 (setq mh-image-load-path-called-flag t)))
341 (if (boundp 'image-load-path)
342 (if (not (member mh-image-load-path image-load-path))
343 (push mh-image-load-path image-load-path))
344 ;; Otherwise, if the image path isn't in the load-path, add it there.
345 (if (not (member mh-image-load-path load-path))
346 (push mh-image-load-path load-path))))))
347 344
348(provide 'mh-init) 345(provide 'mh-init)
349 346