+2006-03-15 Reiner Steib <Reiner.Steib@gmx.de>
+
+ * 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 <uwi7@rz.uni-karlsruhe.de>
* gnus-art.el (gnus-article-only-boring-p): Bind
(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))
((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)
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.
: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."
(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)))
: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."
(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)))
: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."
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))))