From ad88e267477f50ca6887b0babdeea9f6b16e0ae5 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 16 Mar 2006 22:07:54 +0000 Subject: [PATCH] Synch to No Gnus 200603161959. --- lisp/ChangeLog | 20 +++++++++------ lisp/gmm-utils.el | 70 ++++++++++++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cdcfe89..f42a2c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,9 +1,15 @@ +2006-03-16 Reiner Steib + + * gmm-utils.el (gmm-image-load-path-for-library): Prefer user's + images in image-load-path. [Sync with image.el, revision 1.60, in + Emacs.] + 2006-03-15 Reiner Steib - * gmm-utils.el (gmm-image-load-path-for-library): Sync with - image.el, revision 1.59, in Emacs. Pass value of path rather than - symbol. Always return list of directories. Guarantee that image - directory comes first. + * gmm-utils.el (gmm-image-load-path-for-library): Pass value of + path rather than symbol. Always return list of directories. + Guarantee that image directory comes first. [Sync with image.el, + revision 1.59, in Emacs.] * message.el (message-make-tool-bar): Adjust to new API of `gmm-image-load-path-for-library'. @@ -3375,7 +3381,7 @@ (mm-display-inline-fontify): Rewrite for decoding and decompressing parts. -2004-10-15 TSUCHIYA Masatoshi +2005-02-07 TSUCHIYA Masatoshi * mm-view.el (mm-display-inline-fontify): Decode a part according to the charset parameter. @@ -3390,12 +3396,12 @@ * nntp.el (nntp-marks-changed-p): Use time-less-p to compare the timestamps. -2005-01-29 Jari Aalto +2005-02-02 Jari Aalto * gnus-sum.el (gnus-list-of-unread-articles): Improve active groups error checking and notify user. -2004-09-04 Jari Aalto +2005-02-02 Jari Aalto * message.el (message-send-mail-function): Check existence of sendmail-program first before using default value diff --git a/lisp/gmm-utils.el b/lisp/gmm-utils.el index 5b6e049..6e8ad69 100644 --- a/lisp/gmm-utils.el +++ b/lisp/gmm-utils.el @@ -304,10 +304,11 @@ This function returns nil on those systems." (defun gmm-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 @@ -332,8 +333,36 @@ compatibility with versions of Emacs that lack the variable (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. + (gmm-image-search-load-path image) ;; "gmm-" prefix! + ;; 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. @@ -343,33 +372,20 @@ compatibility with versions of Emacs that lack the variable ;; 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. - (gmm-image-search-load-path image) ;; "gmm-" prefix! - ;; 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 -- 1.7.10.4