Function: tool-bar-make-keymap-1

tool-bar-make-keymap-1 is a byte-compiled function defined in tool-bar.el.gz.

Signature

(tool-bar-make-keymap-1 &optional MAP)

Documentation

Generate an actual keymap from tool-bar-map, without caching.

MAP is either a keymap to use as a source for menu items, or nil, in which case the value of tool-bar-map is used instead.

Source Code

;; Defined in /usr/src/emacs/lisp/tool-bar.el.gz
;; This function should return binds even if images can not be
;; displayed so the tool bar can still be displayed on terminals.
(defun tool-bar-make-keymap-1 (&optional map)
  "Generate an actual keymap from `tool-bar-map', without caching.
MAP is either a keymap to use as a source for menu items, or nil,
in which case the value of `tool-bar-map' is used instead."
  (mapcar (lambda (bind)
            (let (image-exp plist)
              (when (and (eq (car-safe (cdr-safe bind)) 'menu-item)
			 ;; 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)))
		(let ((image (and (display-images-p)
                                  (eval image-exp))))
		  (unless (and image (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))
	  (or map
              (if tool-bar-always-show-default (default-value 'tool-bar-map)
                tool-bar-map))))