[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-commit] emacs/lisp/mh-e mh-compat.el ChangeLog
From: |
Bill Wohler |
Subject: |
[Emacs-commit] emacs/lisp/mh-e mh-compat.el ChangeLog |
Date: |
Thu, 16 Mar 2006 17:00:02 +0000 |
CVSROOT: /cvsroot/emacs
Module name: emacs
Branch:
Changes by: Bill Wohler <address@hidden> 06/03/16 17:00:02
Modified files:
lisp/mh-e : mh-compat.el ChangeLog
Log message:
(mh-image-load-path-for-library): Prefer user's images.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/mh-compat.el.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/lisp/mh-e/ChangeLog.diff?tr1=1.182&tr2=1.183&r1=text&r2=text
Patches:
Index: emacs/lisp/mh-e/ChangeLog
diff -u emacs/lisp/mh-e/ChangeLog:1.182 emacs/lisp/mh-e/ChangeLog:1.183
--- emacs/lisp/mh-e/ChangeLog:1.182 Wed Mar 15 17:03:58 2006
+++ emacs/lisp/mh-e/ChangeLog Thu Mar 16 17:00:02 2006
@@ -1,3 +1,8 @@
+2006-03-16 Bill Wohler <address@hidden>
+
+ * mh-compat.el (mh-image-load-path-for-library): Prefer user's
+ images.
+
2006-03-15 Bill Wohler <address@hidden>
* mh-compat.el (mh-image-load-path-for-library): Fix example by
Index: emacs/lisp/mh-e/mh-compat.el
diff -u emacs/lisp/mh-e/mh-compat.el:1.13 emacs/lisp/mh-e/mh-compat.el:1.14
--- emacs/lisp/mh-e/mh-compat.el:1.13 Wed Mar 15 17:03:58 2006
+++ emacs/lisp/mh-e/mh-compat.el Thu Mar 16 17:00:00 2006
@@ -119,10 +119,11 @@
image-load-path-for-library (library image &optional path no-error)
"Return a suitable search path for images relative to LIBRARY.
-First it searches for IMAGE in a path suitable for LIBRARY, which
-includes \"../../etc/images\" and \"../etc/images\" relative to
-the library file itself, followed by `image-load-path' and
-`load-path'.
+First it searches for IMAGE in `image-load-path' (excluding
+\"`data-directory'/images\") and `load-path', followed by a path
+suitable for LIBRARY, which includes \"../../etc/images\" and
+\"../etc/images\" relative to the library file itself, and then
+in \"`data-directory'/images\".
Then this function returns a list of directories which contains
first the directory in which IMAGE was found, followed by the
@@ -147,8 +148,36 @@
(mh-tool-bar-folder-buttons-init))"
(unless library (error "No library specified"))
(unless image (error "No image specified"))
- (let ((image-directory))
+ (let (image-directory image-directory-load-path)
+ ;; Check for images in image-load-path or load-path.
+ (let ((img image)
+ (dir (or
+ ;; Images in image-load-path.
+ (mh-image-search-load-path image)
+ ;; Images in load-path.
+ (locate-library image)))
+ parent)
+ ;; Since the image might be in a nested directory (for
+ ;; example, mail/attach.pbm), adjust `image-directory'
+ ;; accordingly.
+ (when dir
+ (setq dir (file-name-directory dir))
+ (while (setq parent (file-name-directory img))
+ (setq img (directory-file-name parent)
+ dir (expand-file-name "../" dir))))
+ (setq image-directory-load-path dir))
+
+ ;; If `image-directory-load-path' isn't Emacs' image directory,
+ ;; it's probably a user preference, so use it. Then use a
+ ;; relative setting if possible; otherwise, use
+ ;; `image-directory-load-path'.
(cond
+ ;; User-modified image-load-path?
+ ((and image-directory-load-path
+ (not (equal image-directory-load-path
+ (file-name-as-directory
+ (expand-file-name "images" data-directory)))))
+ (setq image-directory image-directory-load-path))
;; Try relative setting.
((let (library-name d1ei d2ei)
;; First, find library in the load-path.
@@ -158,33 +187,20 @@
;; And then set image-directory relative to that.
(setq
;; Go down 2 levels.
- d2ei (expand-file-name
- (concat (file-name-directory library-name) "../../etc/images"))
+ d2ei (file-name-as-directory
+ (expand-file-name
+ (concat (file-name-directory library-name)
"../../etc/images")))
;; Go down 1 level.
- d1ei (expand-file-name
- (concat (file-name-directory library-name) "../etc/images")))
+ d1ei (file-name-as-directory
+ (expand-file-name
+ (concat (file-name-directory library-name) "../etc/images"))))
(setq image-directory
;; Set it to nil if image is not found.
(cond ((file-exists-p (expand-file-name image d2ei)) d2ei)
((file-exists-p (expand-file-name image d1ei)) d1ei)))))
- ;; Check for images in image-load-path or load-path.
- ((let ((img image)
- (dir (or
- ;; Images in image-load-path.
- (mh-image-search-load-path image)
- ;; Images in load-path.
- (locate-library image)))
- parent)
- ;; Since the image might be in a nested directory (for
- ;; example, mail/attach.pbm), adjust `image-directory'
- ;; accordingly.
- (and dir
- (setq dir (file-name-directory dir))
- (progn
- (while (setq parent (file-name-directory img))
- (setq img (directory-file-name parent)
- dir (expand-file-name "../" dir)))
- (setq image-directory dir)))))
+ ;; Use Emacs' image directory.
+ (image-directory-load-path
+ (setq image-directory image-directory-load-path))
(no-error
(message "Could not find image %s for library %s" image library))
(t