summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2008-05-13 17:52:31 +0000
committerChong Yidong <cyd@stupidchicken.com>2008-05-13 17:52:31 +0000
commit71928058cc76e7de2aa5e59c1f36dfee088a6cbd (patch)
tree1e6cd5ca0138f0c8e701de33f4331d0f7246fe9a /lisp
parent6c4999321b6cd68e8ae3764c3f75fa6d72c0ae83 (diff)
downloademacs-71928058cc76e7de2aa5e59c1f36dfee088a6cbd.tar.gz
(tool-bar-make-keymap): Account for the optional KEY-BINDING-DATA
field in menu-item list.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/tool-bar.el32
1 files changed, 19 insertions, 13 deletions
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index f0f2ff1f234..48ad887ddd1 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -93,20 +93,26 @@ Define this locally to override the global tool bar.")
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))