Function: keymap--menu-item-with-binding

keymap--menu-item-with-binding is a byte-compiled function defined in subr.el.gz.

Signature

(keymap--menu-item-with-binding ITEM BINDING)

Documentation

Build a menu-item like ITEM but with its binding changed to BINDING.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
   (t val)))                            ;Not a menu-item either.

(defun keymap--menu-item-with-binding (item binding)
  "Build a menu-item like ITEM but with its binding changed to BINDING."
  (cond
   ((not (consp item)) binding)		;Not a menu-item.
   ((eq 'menu-item (car item))
    (setq item (copy-sequence item))
    (let ((tail (nthcdr 2 item)))
      (setcar tail binding)
      ;; Remove any potential filter.
      (if (plist-get (cdr tail) :filter)
          (setcdr tail (plist-put (cdr tail) :filter nil))))
    item)
   ((and (consp (cdr item)) (stringp (cadr item)))
    (cons (car item) (cons (cadr item) binding)))
   (t (cons (car item) binding))))