# HG changeset patch # User Jerry James # Date 1358966926 25200 # Node ID 68f8d295be49fb1f37b708c368bb1b2b06dd75c9 # Parent 489e76b8582868ac588551ea0565ef43e695da54 Support :visible in menu specifications. diff -r 489e76b85828 -r 68f8d295be49 lisp/ChangeLog --- a/lisp/ChangeLog Mon Jan 21 10:17:55 2013 -0700 +++ b/lisp/ChangeLog Wed Jan 23 11:48:46 2013 -0700 @@ -1,3 +1,9 @@ +2013-01-22 Jerry James + + * glyphs.el (make-image-specifier): Document that :visible is a + widget keyword. + * menubar.el (check-menu-syntax): Allow :visible in menu specs. + 2013-01-04 Stephen J. Turnbull * XEmacs 21.5.33 "horseradish" is released. diff -r 489e76b85828 -r 68f8d295be49 lisp/glyphs.el --- a/lisp/glyphs.el Mon Jan 21 10:17:55 2013 -0700 +++ b/lisp/glyphs.el Wed Jan 23 11:48:46 2013 -0700 @@ -266,7 +266,7 @@ \[WIDGET-KEYWORDS] stands for the standard keywords accepted by widgets: These are `:selected', `:active', `:suffix', `:keys', `:style', `:filter', `:config', `:included', `:key-sequence', `:accelerator', -`:label', `:callback', `:initial-focus', and `:descriptor'. +`:label', `:callback', `:initial-focus', `:descriptor', and `:visible'. #### Document me. \[GUI-KEYWORDS] stands for keywords accepted by many widgets. diff -r 489e76b85828 -r 68f8d295be49 lisp/menubar.el --- a/lisp/menubar.el Mon Jan 21 10:17:55 2013 -0700 +++ b/lisp/menubar.el Wed Jan 23 11:48:46 2013 -0700 @@ -79,9 +79,9 @@ (setq menu (cdr menu))) (let (menuitem item) (while (keywordp (setq item (car menu))) - (or (memq item '(:config :included :filter :accelerator :active)) + (or (memq item '(:config :included :visible :filter :accelerator :active)) (signal 'error - (list "menu keyword must be :config, :included, :accelerator, :active or :filter" + (list "menu keyword must be :config, :included, :visible, :accelerator, :active or :filter" item))) (if (or (not (cdr menu)) (vectorp (nth 1 menu)) @@ -135,7 +135,7 @@ (setq item (aref menuitem i)) (cond ((not (memq item '(:active :suffix :keys :style :full :included :selected - :accelerator))) + :visible :accelerator))) (signal 'error (list (if (keywordp item) "unknown menu item keyword" diff -r 489e76b85828 -r 68f8d295be49 man/ChangeLog --- a/man/ChangeLog Mon Jan 21 10:17:55 2013 -0700 +++ b/man/ChangeLog Wed Jan 23 11:48:46 2013 -0700 @@ -1,3 +1,10 @@ +2013-01-22 Jerry James + + * lispref/glyphs.texi (Image Instantiators): Add :visible to the + list of allowed menu keywords. + * lispref/menus.tex (Menu Format): Document that :visible is an + alias for :included. + 2013-01-04 Stephen J. Turnbull * XEmacs 21.5.33 "horseradish" is released. diff -r 489e76b85828 -r 68f8d295be49 man/lispref/glyphs.texi --- a/man/lispref/glyphs.texi Mon Jan 21 10:17:55 2013 -0700 +++ b/man/lispref/glyphs.texi Wed Jan 23 11:48:46 2013 -0700 @@ -299,6 +299,7 @@ @itemx :filter @itemx :config @itemx :included +@itemx :visible @itemx :key-sequence @itemx :accelerator @itemx :label diff -r 489e76b85828 -r 68f8d295be49 man/lispref/menus.texi --- a/man/lispref/menus.texi Mon Jan 21 10:17:55 2013 -0700 +++ b/man/lispref/menus.texi Wed Jan 23 11:48:46 2013 -0700 @@ -45,6 +45,7 @@ @item :included @var{form} This can be used to control the visibility of a menu. The form is evaluated and the menu will be omitted if the result is @code{nil}. +The keyword @code{:visible} is an alias for @code{:included}. @item :config @var{symbol} This is an efficient shorthand for @code{:included (memq @var{symbol} @@ -224,7 +225,8 @@ non-@code{nil}. Note that this is different from @code{:active}: If @code{:active} evaluates to @code{nil}, the item will be displayed grayed out, while if @code{:included} evaluates to @code{nil}, the item -will be omitted entirely. +will be omitted entirely. The keyword @code{:visible} is an alias for +@code{:included}. @item :config @var{symbol} This is an efficient shorthand for @code{:included (memq @var{symbol} diff -r 489e76b85828 -r 68f8d295be49 src/ChangeLog --- a/src/ChangeLog Mon Jan 21 10:17:55 2013 -0700 +++ b/src/ChangeLog Wed Jan 23 11:48:46 2013 -0700 @@ -1,3 +1,13 @@ +2013-01-22 Jerry James + + * general-slots.h: Add Q_visible. + * gui.c (gui_item_add_keyval_pair): Add :visible as an alias to + :included. + * menubar.c (vars_of_menubar): Document that :visible is an alias + to :included. + * menubar-gtk.c (menu_convert): Ditto. + * menubar-x.c (menu_item_descriptor_to_widget_value_1): Ditto. + 2013-01-16 Jerry James * menubar-x.c (set_frame_menubar): when a menubar specification has an diff -r 489e76b85828 -r 68f8d295be49 src/general-slots.h --- a/src/general-slots.h Mon Jan 21 10:17:55 2013 -0700 +++ b/src/general-slots.h Wed Jan 23 11:48:46 2013 -0700 @@ -312,6 +312,7 @@ SYMBOL_KEYWORD (Q_value); SYMBOL (Qvalue_assoc); SYMBOL (Qvertical); +SYMBOL_KEYWORD (Q_visible); SYMBOL (Qwarning); SYMBOL (Qwidget); SYMBOL (Qwidth); diff -r 489e76b85828 -r 68f8d295be49 src/gui.c --- a/src/gui.c Mon Jan 21 10:17:55 2013 -0700 +++ b/src/gui.c Wed Jan 23 11:48:46 2013 -0700 @@ -144,7 +144,6 @@ } FROB (suffix) FROB (active) - FROB (included) FROB (config) FROB (filter) FROB (style) @@ -154,6 +153,14 @@ FROB (callback_ex) FROB (value) #undef FROB + else if (EQ (key, Q_included) || EQ (key, Q_visible)) + { + if (!EQ (pgui_item->included, val)) + { + retval = 1; + pgui_item->included = val; + } + } else if (EQ (key, Q_key_sequence)) ; /* ignored for FSF compatibility */ else if (EQ (key, Q_label)) ; /* ignored for 21.0 implement in 21.2 */ else if (EQ (key, Q_accelerator)) diff -r 489e76b85828 -r 68f8d295be49 src/menubar-gtk.c --- a/src/menubar-gtk.c Mon Jan 21 10:17:55 2013 -0700 +++ b/src/menubar-gtk.c Wed Jan 23 11:48:46 2013 -0700 @@ -631,7 +631,7 @@ cascade); val = Fcar (desc); desc = Fcdr (desc); - if (EQ (key, Q_included)) + if (EQ (key, Q_included) || EQ(key, Q_visible)) include_p = val, included_spec = 1; else if (EQ (key, Q_config)) config_tag = val; diff -r 489e76b85828 -r 68f8d295be49 src/menubar-x.c --- a/src/menubar-x.c Mon Jan 21 10:17:55 2013 -0700 +++ b/src/menubar-x.c Wed Jan 23 11:48:46 2013 -0700 @@ -172,7 +172,7 @@ sferror ("Keyword in menu lacks a value", cascade); val = Fcar (desc); desc = Fcdr (desc); - if (EQ (key, Q_included)) + if (EQ (key, Q_included) || EQ (key, Q_visible)) include_p = val, included_spec = 1; else if (EQ (key, Q_config)) config_tag = val; diff -r 489e76b85828 -r 68f8d295be49 src/menubar.c --- a/src/menubar.c Mon Jan 21 10:17:55 2013 -0700 +++ b/src/menubar.c Wed Jan 23 11:48:46 2013 -0700 @@ -495,7 +495,7 @@ Immediately following the name string of the menu, various optional keyword-value pairs are permitted: currently, :filter, :active, :included, -and :config. (See below.) +:visible, and :config. (See below.) If an element of a menu (or menubar) is a string, then that string will be presented as unselectable text. @@ -597,7 +597,8 @@ :included
This can be used to control the visibility of a menu or menu item. The form is evaluated and the menu or menu - item is only displayed if the result is non-nil. + item is only displayed if the result is non-nil. The + keyword :visible is an alias for :included. :config This is an efficient shorthand for :included (memq symbol menubar-configuration)