]> git.eshelyaron.com Git - emacs.git/commitdiff
mh-compat.el (mh-image-search-load-path): Compatibility code. Emacs 21 and
authorPeter Galbraith <galbraith@mixing.qc.dfo.ca>
Thu, 16 Feb 2006 02:14:40 +0000 (02:14 +0000)
committerPeter Galbraith <galbraith@mixing.qc.dfo.ca>
Thu, 16 Feb 2006 02:14:40 +0000 (02:14 +0000)
XEmacs don't have `image-search-load-path'.

mh-utils.el (mh-image-load-path): Don't bail out on error if the images are
already found.

lisp/mh-e/ChangeLog
lisp/mh-e/mh-compat.el
lisp/mh-e/mh-utils.el

index 349bae9f07297adf1f63a9cf7d888d4ec9c98f27..3dcf689767a98617e683c3ef07fce2322d4d0d00 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-15  Peter S Galbraith  <psg@debian.org>
+
+       * mh-compat.el (mh-image-search-load-path): Compatibility code.
+       Emacs 21 and XEmacs don't have `image-search-load-path'.
+
+       * mh-utils.el (mh-image-load-path): Don't bail out on error if the
+       images are already found.
+
 2006-02-10  Bill Wohler  <wohler@newt.com>
 
        * mh-search.el (mh-search): Wrap code in (block mh-search ...)
index 090ee51c5fc35250b3d7c50c696436c310961838..4bc5fdf36f75a8a2c326a3c906f6e56e2bf7c315 100644 (file)
@@ -115,6 +115,12 @@ introduced in Emacs 22."
       `(face-background ,face ,frame)
     `(face-background ,face ,frame ,inherit)))
 
+(mh-defun-compat mh-image-search-load-path
+  image-search-load-path (file &optional path)
+  "Emacs 21 and XEmacs don't have `image-search-load-path'.
+This function returns nil on those systems."
+  nil)
+
 ;; For XEmacs.
 (defalias 'mh-line-beginning-position
   (if (fboundp 'line-beginning-position)
@@ -131,7 +137,7 @@ introduced in Emacs 22."
 (mh-defun-compat mh-mail-abbrev-make-syntax-table
   mail-abbrev-make-syntax-table ()
   "Emacs 21 and XEmacs don't have `mail-abbrev-make-syntax-table'.
-This function does nothing on those systems."
+This function returns nil on those systems."
   nil)
 
 (mh-defun-compat mh-match-string-no-properties
index dc86d19ae77ad105475d864349a01582c76e6a75..bf0d29fd2a7de1bbee975b718dd493d924486c24 100644 (file)
@@ -109,21 +109,41 @@ already there.
 
 See also variable `mh-image-load-path-called-flag'."
   (unless mh-image-load-path-called-flag
-    (if (or (not mh-image-load-path)
-            (not (file-exists-p mh-image-load-path)))
-        (let (mh-library-name)
-          ;; First, find mh-e in the load-path.
-          (setq mh-library-name (locate-library "mh-e"))
-          (if (not mh-library-name)
-              (error "Can not find MH-E in load-path"))
-          (setq mh-image-load-path
-                (expand-file-name (concat (file-name-directory mh-library-name)
-                                          "../../etc/images")))))
-    (if (not (file-exists-p mh-image-load-path))
-        (error "Can not find image directory %s" mh-image-load-path))
-    (if (boundp 'image-load-path)
-        (add-to-list 'image-load-path mh-image-load-path)
-      (add-to-list 'load-path mh-image-load-path))
+    (cond
+     ((and mh-image-load-path
+           (file-exists-p (expand-file-name "mh-logo.xpm"
+                                            mh-image-load-path))))
+      ;; User setting exists. We're done.
+     ((and mh-image-load-path
+           (not (file-exists-p (expand-file-name "mh-logo.xpm"
+                                                 mh-image-load-path))))
+      ;; User setting does not exist.
+      (message "Variable mh-image-load-path %s does not contain MH-E images"
+               mh-image-load-path))
+     ((mh-image-search-load-path "mh-logo.xpm")
+      ;; Emacs 22 already knows where the images are.
+      (setq mh-image-load-path
+           (file-name-directory (mh-image-search-load-path "mh-logo.xpm"))))
+     ((locate-library "mh-logo.xpm")
+      ;; Other Emacs already knows where the images are...
+      (setq mh-image-load-path
+           (file-name-directory (locate-library "mh-logo.xpm"))))
+     (t      
+      ;; Guess `mh-image-load-path' if it wasn't provided by the user.
+      (let (mh-library-name)
+        ;; First, find mh-e in the load-path.
+        (setq mh-library-name (locate-library "mh-e"))
+        (if (not mh-library-name)
+            (error "Can not find MH-E in load-path"))
+        (setq mh-image-load-path
+              (expand-file-name (concat
+                                 (file-name-directory mh-library-name)
+                                 "../../etc/images"))))
+      (if (not (file-exists-p mh-image-load-path))
+         (error "Can not find image directory %s" mh-image-load-path))
+      (if (boundp 'image-load-path)
+         (add-to-list 'image-load-path mh-image-load-path)
+       (add-to-list 'load-path mh-image-load-path))))
     (setq mh-image-load-path-called-flag t)))
 
 ;;;###mh-autoload