# HG changeset patch # User Stephen J. Turnbull # Date 1356683005 -32400 # Node ID 44b0b4ea5cae688779874a40c659eaef1940567c # Parent 9c9b07d40f20fe3a2d115f6e789082426032931d Implement and document :active keyword for submenu specs. diff -r 9c9b07d40f20 -r 44b0b4ea5cae lisp/ChangeLog --- a/lisp/ChangeLog Fri Dec 28 13:03:15 2012 +0900 +++ b/lisp/ChangeLog Fri Dec 28 17:23:25 2012 +0900 @@ -1,3 +1,7 @@ +2012-12-28 Byrel Mitchell + + * menubar.el (check-menu-syntax): Implement :active in submenu specs. + 2012-08-03 Stephen J. Turnbull * menubar-items.el (default-menubar): Reorganize. diff -r 9c9b07d40f20 -r 44b0b4ea5cae lisp/menubar.el --- a/lisp/menubar.el Fri Dec 28 13:03:15 2012 +0900 +++ b/lisp/menubar.el Fri Dec 28 17:23:25 2012 +0900 @@ -79,9 +79,9 @@ (setq menu (cdr menu))) (let (menuitem item) (while (keywordp (setq item (car menu))) - (or (memq item '(:config :included :filter :accelerator)) + (or (memq item '(:config :included :filter :accelerator :active)) (signal 'error - (list "menu keyword must be :config, :included, :accelerator or :filter" + (list "menu keyword must be :config, :included, :accelerator, :active or :filter" item))) (if (or (not (cdr menu)) (vectorp (nth 1 menu)) diff -r 9c9b07d40f20 -r 44b0b4ea5cae man/ChangeLog --- a/man/ChangeLog Fri Dec 28 13:03:15 2012 +0900 +++ b/man/ChangeLog Fri Dec 28 17:23:25 2012 +0900 @@ -1,3 +1,8 @@ +2012-12-28 Byrel Mitchell + + * lispref/menus.texi (Menu Format): + Document use of :active in submenu specs. + 2012-12-28 Stephen J. Turnbull * internals/internals.texi (Mercurial Basics): diff -r 9c9b07d40f20 -r 44b0b4ea5cae man/lispref/menus.texi --- a/man/lispref/menus.texi Fri Dec 28 13:03:15 2012 +0900 +++ b/man/lispref/menus.texi Fri Dec 28 17:23:25 2012 +0900 @@ -39,7 +39,7 @@ menu if @code{popup-menu-titles} is non-@code{nil}. Immediately following the first element there may optionally be up -to four keyword-value pairs, as follows: +to five keyword-value pairs, as follows: @table @code @item :included @var{form} @@ -64,7 +64,13 @@ @item :accelerator @var{key} A menu accelerator is a keystroke which can be pressed while the menu is visible which will immediately activate the item. @var{key} must be a char -or the symbol name of a key. @xref{Menu Accelerators}. +or the symbol name of a key. + +@item :active @var{form} +@var{form} will be evaluated when the submenu is about to be displayed, +and the menu contents will be displayed only if the result is non-@code{nil}. +If the submenu is inactive, it will display the word "Invalid", grayed-out. +@xref{Menu Accelerators}. @end table The rest of the menu consists of elements as follows: