From 964f2967bca800965da20ca22f182dba5135714c Mon Sep 17 00:00:00 2001 From: Reiner Steib Date: Wed, 15 Mar 2006 18:03:48 +0000 Subject: [PATCH] * 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. * message.el (message-make-tool-bar): Adjust to new API of `gmm-image-load-path-for-library'. * gnus-sum.el (gnus-summary-make-tool-bar): Ditto. * gnus-group.el (gnus-group-make-tool-bar): Ditto. --- lisp/ChangeLog | 14 ++++++++++++ lisp/gmm-utils.el | 54 ++++++++++++++++++++-------------------------- lisp/gnus-group.el | 9 ++++---- lisp/gnus-sum.el | 9 ++++---- lisp/message.el | 17 ++++++++------- 5 files changed, 56 insertions(+), 47 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 362c21711..6792afe54 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +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. + + * message.el (message-make-tool-bar): Adjust to new API of + `gmm-image-load-path-for-library'. + + * gnus-sum.el (gnus-summary-make-tool-bar): Ditto. + + * gnus-group.el (gnus-group-make-tool-bar): Ditto. + 2006-03-15 Andreas Seltenreich * gnus-art.el (gnus-article-only-boring-p): Bind diff --git a/lisp/gmm-utils.el b/lisp/gmm-utils.el index 4fe373697..ad05ffb9c 100644 --- a/lisp/gmm-utils.el +++ b/lisp/gmm-utils.el @@ -304,30 +304,32 @@ 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. -Images for LIBRARY are searched for in \"../../etc/images\" and -\"../etc/images\" relative to the files in \"lisp/LIBRARY\" as -well as in `image-load-path' and `load-path'. +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'. -This function returns the value of `load-path' augmented with the -path to IMAGE. If PATH is given, it is used instead of -`load-path'. If PATH is t, return a single image directory -instead of a path. +Then this function returns a list of directories which contains +first the directory in which IMAGE was found, followed by the +value of `load-path'. If PATH is given, it is used instead of +`load-path'. -If NO-ERROR is non-nil, don't signal an error if no suitable path -can be found. +If NO-ERROR is non-nil and a suitable path can't be found, don't +signal an error. Instead, return a list of directories as before, +except that nil appears in place of the image directory. Here is an example that uses a common idiom to provide compatibility with versions of Emacs that lack the variable `image-load-path': - (let ((load-path - (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) - (image-load-path - (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\" 'image-load-path))) - (mh-tool-bar-folder-buttons-init)) + ;; Shush compiler. + (defvar image-load-path) -This function is used by Emacs versions that don't have -`image-load-path-for-library'." + (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) + (mh-tool-bar-folder-buttons-init))" (unless library (error "No library specified")) (unless image (error "No image specified")) (let ((image-directory)) @@ -354,7 +356,7 @@ This function is used by Emacs versions that don't have ((let ((img image) (dir (or ;; Images in image-load-path. - (gmm-image-search-load-path image) + (gmm-image-search-load-path image) ;; "gmm-" prefix! ;; Images in load-path. (locate-library image))) parent) @@ -369,23 +371,13 @@ This function is used by Emacs versions that don't have dir (expand-file-name "../" dir))) (setq image-directory dir))))) (no-error - ;; In this case we will return a nil element - (gmm-message 1 "Could not find image %s for library %s" image library)) + (message "Could not find image %s for library %s" image library)) (t (error "Could not find image %s for library %s" image library))) - ;; Return augmented `image-load-path' or `load-path'. - (cond ((eq path t) - image-directory) - ((and path (symbolp path)) - (nconc (list image-directory) - (delete image-directory - (if (boundp path) - (copy-sequence (symbol-value path)) - nil)))) - (t - (nconc (list image-directory) - (delete image-directory (copy-sequence load-path))))))) + ;; Return an augmented `path' or `load-path'. + (nconc (list image-directory) + (delete image-directory (copy-sequence (or path load-path)))))) (defun gmm-customize-mode (&optional mode) "Customize customization group for MODE. diff --git a/lisp/gnus-group.el b/lisp/gnus-group.el index 14b5a9b07..486165517 100644 --- a/lisp/gnus-group.el +++ b/lisp/gnus-group.el @@ -1112,6 +1112,8 @@ See `gmm-tool-bar-from-list' for the format of the list." :set 'gnus-group-tool-bar-update :group 'gnus-group) +(defvar image-load-path) + (defun gnus-group-make-tool-bar (&optional force) "Make a group mode tool bar from `gnus-group-tool-bar'. When FORCE, rebuild the tool bar." @@ -1125,10 +1127,9 @@ When FORCE, rebuild the tool bar." (gmm-image-load-path-for-library "gnus" "gnus/toggle-subscription.xpm" nil t)) - (image-load-path - (gmm-image-load-path-for-library "gnus" - "gnus/toggle-subscription.xpm" - 'image-load-path t)) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path))) (map (gmm-tool-bar-from-list gnus-group-tool-bar gnus-group-tool-bar-zap-list 'gnus-group-mode-map))) diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el index 00d524a19..296c83261 100644 --- a/lisp/gnus-sum.el +++ b/lisp/gnus-sum.el @@ -2767,6 +2767,8 @@ See `gmm-tool-bar-from-list' for the format of the list." :set 'gnus-summary-tool-bar-update :group 'gnus-summary) +(defvar image-load-path) + (defun gnus-summary-make-tool-bar (&optional force) "Make a summary mode tool bar from `gnus-summary-tool-bar'. When FORCE, rebuild the tool bar." @@ -2778,10 +2780,9 @@ When FORCE, rebuild the tool bar." (gmm-image-load-path-for-library "gnus" "mail/save.xpm" nil t)) - (image-load-path - (gmm-image-load-path-for-library "gnus" - "mail/save.xpm" - 'image-load-path t)) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path))) (map (gmm-tool-bar-from-list gnus-summary-tool-bar gnus-summary-tool-bar-zap-list 'gnus-summary-mode-map))) diff --git a/lisp/message.el b/lisp/message.el index 13f1db2d9..aa39d0314 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -6796,6 +6796,8 @@ See `gmm-tool-bar-from-list' for the format of the list." :set 'message-tool-bar-update :group 'message) +(defvar image-load-path) + (defun message-make-tool-bar (&optional force) "Make a message mode tool bar from `message-tool-bar-list'. When FORCE, rebuild the tool bar." @@ -6804,14 +6806,13 @@ When FORCE, rebuild the tool bar." tool-bar-mode (or (not message-tool-bar-map) force)) (setq message-tool-bar-map - (let ((load-path - (gmm-image-load-path-for-library "message" - "mail/save-draft.xpm" - nil t)) - (image-load-path - (gmm-image-load-path-for-library "message" - "mail/save-draft.xpm" - 'image-load-path t))) + (let* ((load-path + (gmm-image-load-path-for-library "message" + "mail/save-draft.xpm" + nil t)) + (image-load-path (cons (car load-path) + (when (boundp 'image-load-path) + image-load-path)))) (gmm-tool-bar-from-list message-tool-bar message-tool-bar-zap-list 'message-mode-map)))) -- 2.25.1