APPROVE COMMIT 21.5
Byrel Mitchell writes:
Ben and I were playing around with the menu structure, and noticed a
discrepancy in the documentation. According to the lispref, the :active
keyword is only valid for leaf entries. According to current-menubar's
docstring, it's valid for submenus as well.
We tested it, and it turns out the syntax check function precludes using
the:active keyword. However, the functionality is implemented, and works
if you bypass the syntax check. Here's a patch to the syntax checker and
lispref that would enable it.
# HG changeset patch
# 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 <byrel.mitchell(a)gmail.com>
+
+ * menubar.el (check-menu-syntax): Implement :active in submenu specs.
+
2012-08-03 Stephen J. Turnbull <stephen(a)xemacs.org>
* 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 <byrel.mitchell(a)gmail.com>
+
+ * lispref/menus.texi (Menu Format):
+ Document use of :active in submenu specs.
+
2012-12-28 Stephen J. Turnbull <stephen(a)xemacs.org>
* 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:
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta