Function: org-mouse-keyword-menu
org-mouse-keyword-menu is a byte-compiled function defined in
org-mouse.el.gz.
Signature
(org-mouse-keyword-menu KEYWORDS FUNCTION &optional SELECTED ITEMFORMAT)
Documentation
A helper function.
Returns a menu fragment consisting of KEYWORDS. When a keyword is selected by the user, FUNCTION is called with the selected keyword as the only argument.
If SELECTED is nil, then all items are normal menu items. If
SELECTED is a function, then each item is a checkbox, which is
enabled for a given keyword if (funcall SELECTED keyword) return
non-nil. If SELECTED is neither nil nor a function, then the
items are radio buttons. A radio button is enabled for the
keyword equal to SELECTED.
ITEMFORMAT governs formatting of the elements of KEYWORDS. If it is a function, it is invoked with the keyword as the only argument. If it is a string, it is interpreted as the format string to (format ITEMFORMAT keyword). If it is neither a string nor a function, elements of KEYWORDS are used directly.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-mouse.el.gz
(defun org-mouse-keyword-menu (keywords function &optional selected itemformat)
"A helper function.
Returns a menu fragment consisting of KEYWORDS. When a keyword
is selected by the user, FUNCTION is called with the selected
keyword as the only argument.
If SELECTED is nil, then all items are normal menu items. If
SELECTED is a function, then each item is a checkbox, which is
enabled for a given keyword if (funcall SELECTED keyword) return
non-nil. If SELECTED is neither nil nor a function, then the
items are radio buttons. A radio button is enabled for the
keyword `equal' to SELECTED.
ITEMFORMAT governs formatting of the elements of KEYWORDS. If it
is a function, it is invoked with the keyword as the only
argument. If it is a string, it is interpreted as the format
string to (format ITEMFORMAT keyword). If it is neither a string
nor a function, elements of KEYWORDS are used directly."
(mapcar
(lambda (keyword)
(vector (cond
((functionp itemformat) (funcall itemformat keyword))
((stringp itemformat) (format itemformat keyword))
(t keyword))
`(funcall #',function ,keyword)
:style (cond
((null selected) t)
((functionp selected) 'toggle)
(t 'radio))
:selected (if (functionp selected)
(and (funcall selected keyword) t)
(equal selected keyword))))
keywords))