From 70b838b729e26d195308b1ed3c72594a1daaf6aa Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 22 Nov 2007 08:42:12 +0000 Subject: [PATCH] (x-gtk-map-stock): Check if FILE is a string. --- lisp/ChangeLog | 4 ++++ lisp/term/x-win.el | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b050d2a5faa..565975fa008 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2007-11-22 Jan Dj,Ad(Brv + + * term/x-win.el (x-gtk-map-stock): Check if FILE is a string. + 2007-11-21 Juanma Barranquero * textmodes/paragraphs.el (forward-sentence): Doc fix. diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 8de5b902e18..cdb4c9711f8 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -2603,15 +2603,18 @@ The list elements are either the symbol name for the alist or the alist itself." (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)) ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 ;;; x-win.el ends here -- 2.39.2