Function: easy-menu-binding

easy-menu-binding is a byte-compiled function defined in easymenu.el.gz.

Signature

(easy-menu-binding MENU &optional ITEM-NAME)

Documentation

Return a binding suitable to pass to define-key.

This is expected to be bound to a mouse event.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/easymenu.el.gz
(defun easy-menu-binding (menu &optional item-name)
  "Return a binding suitable to pass to `define-key'.
This is expected to be bound to a mouse event."
  ;; Under Emacs this is almost trivial, whereas under XEmacs this may
  ;; involve defining a function that calls popup-menu.
  (let ((props (if (symbolp menu)
                   (prog1 (get menu 'menu-prop)
                     (setq menu (symbol-function menu))))))
    (cons 'menu-item
          (cons (if (eq :label (car props))
                    (prog1 (cadr props)
                      (setq props (cddr props)))
                  (or item-name
                      (if (keymapp menu)
                          (keymap-prompt menu))
                      ""))
                (cons menu props)))))