514 |
"In menu MENU try to look for menu item with name NAME. |
"In menu MENU try to look for menu item with name NAME. |
515 |
If a menu item is found, return (NAME . item), otherwise return nil. |
If a menu item is found, return (NAME . item), otherwise return nil. |
516 |
If item is an old format item, a new format item is returned." |
If item is an old format item, a new format item is returned." |
517 |
(let ((item (lookup-key menu (vector (intern name)))) |
(let ((item (lookup-key menu (vector (intern name))))b |
518 |
ret enable cache label) |
ret enable cache label) |
519 |
(cond |
(cond |
|
((or (keymapp item) (eq (car-safe item) 'menu-item)) |
|
|
(cons name item)) ; Keymap or new menu format |
|
520 |
((stringp (car-safe item)) |
((stringp (car-safe item)) |
521 |
;; This is the old menu format. Convert it to new format. |
;; This is the old menu format. Convert it to new format. |
522 |
(setq label (car item)) |
(setq label (car item)) |
530 |
(and (symbolp item) (setq enable (get item 'menu-enable)) ; Got enable |
(and (symbolp item) (setq enable (get item 'menu-enable)) ; Got enable |
531 |
(setq ret (cons :enable (cons enable ret)))) |
(setq ret (cons :enable (cons enable ret)))) |
532 |
(if cache (setq ret (cons cache ret))) |
(if cache (setq ret (cons cache ret))) |
533 |
(cons name (cons 'menu-enable (cons label (cons item ret)))))))) |
(cons name (cons 'menu-enable (cons label (cons item ret))))) |
534 |
|
(item ; (or (symbolp item) (keymapp item) (eq (car-safe item) 'menu-item)) |
535 |
|
(cons name item))))) |
536 |
|
|
537 |
(defun easy-menu-get-map-look-for-name (name submap) |
(defun easy-menu-get-map-look-for-name (name submap) |
538 |
(while (and submap (not (or (equal (car-safe (cdr-safe (car submap))) name) |
(while (and submap (not (or (equal (car-safe (cdr-safe (car submap))) name) |