* gmm-utils.el (gmm-image-load-path-for-library): Sync with
authorReiner Steib <Reiner.Steib@gmx.de>
Wed, 15 Mar 2006 18:03:48 +0000 (18:03 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Wed, 15 Mar 2006 18:03:48 +0000 (18:03 +0000)
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
lisp/gmm-utils.el
lisp/gnus-group.el
lisp/gnus-sum.el
lisp/message.el

index 362c217..6792afe 100644 (file)
@@ -1,3 +1,17 @@
+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
index 4fe3736..ad05ffb 100644 (file)
@@ -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.
index 14b5a9b..4861655 100644 (file)
@@ -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)))
index 00d524a..296c832 100644 (file)
@@ -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)))
index 13f1db2..aa39d03 100644 (file)
@@ -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))))