# HG changeset patch # User Chong Yidong # Date 1210701151 0 # Node ID f23487dcd0a836aab0fc5d0df88af83f7ab0d94e # Parent 3c3a05682534fec338c1c8c7110a83e0b824cc9d (tool-bar-make-keymap): Account for the optional KEY-BINDING-DATA field in menu-item list. diff -r 3c3a05682534 -r f23487dcd0a8 lisp/tool-bar.el --- a/lisp/tool-bar.el Tue May 13 16:41:32 2008 +0000 +++ b/lisp/tool-bar.el Tue May 13 17:52:31 2008 +0000 @@ -93,20 +93,26 @@ Its main job is to figure out which images to use based on the display's color capability and based on the available image libraries." (mapcar (lambda (bind) - (let (image-exp) + (let (image-exp plist) (when (and (eq (car-safe (cdr-safe bind)) 'menu-item) - (setq image-exp (plist-get bind :image)) - (consp image-exp) - (not (eq (car image-exp) 'image)) - (fboundp (car image-exp))) - (if (not (display-images-p)) - (setq bind nil) - (let ((image (eval image-exp))) - (unless (image-mask-p image) - (setq image (append image '(:mask heuristic)))) - (setq bind (copy-sequence bind)) - (plist-put bind :image image)))) - bind)) + ;; For the format of menu-items, see node + ;; `Extended Menu Items' in the Elisp manual. + (setq plist (nthcdr (if (consp (nth 4 bind)) 5 4) + bind)) + (setq image-exp (plist-get plist :image)) + (consp image-exp) + (not (eq (car image-exp) 'image)) + (fboundp (car image-exp))) + (if (not (display-images-p)) + (setq bind nil) + (let ((image (eval image-exp))) + (unless (image-mask-p image) + (setq image (append image '(:mask heuristic)))) + (setq bind (copy-sequence bind) + plist (nthcdr (if (consp (nth 4 bind)) 5 4) + bind)) + (plist-put plist :image image)))) + bind)) tool-bar-map)) (defconst tool-bar-find-image-cache (make-hash-table :weakness t :test 'equal))