Function: easy-menu-filter-return

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

Signature

(easy-menu-filter-return MENU &optional NAME)

Documentation

Convert MENU to the right thing to return from a menu filter.

MENU is a menu as computed by easy-menu-define or easy-menu-create-menu or a symbol whose value is such a menu. In Emacs a menu filter must return a menu (a keymap), in XEmacs a filter must return a menu items list (without menu name and keywords). This function returns the right thing in the two cases. If NAME is provided, it is used for the keymap.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/easymenu.el.gz
(defun easy-menu-filter-return (menu &optional name)
 "Convert MENU to the right thing to return from a menu filter.
MENU is a menu as computed by `easy-menu-define' or `easy-menu-create-menu' or
a symbol whose value is such a menu.
In Emacs a menu filter must return a menu (a keymap), in XEmacs a filter must
return a menu items list (without menu name and keywords).
This function returns the right thing in the two cases.
If NAME is provided, it is used for the keymap."
 (cond
  ((and (not (keymapp menu)) (consp menu))
   ;; If it's a cons but not a keymap, then it can't be right
   ;; unless it's an XEmacs menu.
   (setq menu (easy-menu-create-menu (or name "") menu)))
  ((vectorp menu)
   ;; It's just a menu entry.
   (setq menu (cdr (easy-menu-convert-item menu)))))
 menu)