(x-gtk-map-stock): Check if FILE is a string.

This commit is contained in:
Jan Djärv 2007-11-22 08:35:31 +00:00
parent 8b6f8091d7
commit d2ea686304
2 changed files with 16 additions and 9 deletions

View file

@ -1,3 +1,7 @@
2007-11-22 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
* term/x-win.el (x-gtk-map-stock): Check if FILE is a string.
2007-11-22 Glenn Morris <rgm@gnu.org>
* dos-fns.el (int86):

View file

@ -2672,15 +2672,18 @@ If you don't want stock icons, set the variable to nil."
(defun x-gtk-map-stock (file)
"Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'."
(let* ((file-sans (file-name-sans-extension file))
(key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
(match-string 1 file-sans)))
(value))
(mapc (lambda (elem)
(let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
(or value (setq value (assoc-string (or key file-sans) assoc)))))
icon-map-list)
(and value (cdr value))))
(if (stringp file)
(let* ((file-sans (file-name-sans-extension file))
(key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans)
(match-string 1 file-sans)))
(value))
(mapc (lambda (elem)
(let ((assoc (if (symbolp elem) (symbol-value elem) elem)))
(or value (setq value (assoc-string (or key file-sans)
assoc)))))
icon-map-list)
(and value (cdr value)))
nil))
(provide 'x-win)