On Fri, Dec 28, 2012 at 11:19 PM, Stephen J. Turnbull
<stephen(a)xemacs.org> wrote:
So the algorithm would go something like
(1) process a command item spec as currently done
(2) if no :included keyword was present, check for commandp of the
specified "command".
if this test succeeds, add the item to the menu being built
otherwise, if menu-developer-p is non-nil, log a warning,
and do not add the item to the menu
This much can be done with current infrastructure. It occurred to me
that this could also be done at insertion time into the menu. Just add
an actual :included to items (vectors) with symbol callbacks. That
way, it's obvious to anyone hacking the menu that default :included
values are now being inserted.
I did this (patch attached), though it turned out to be a bit more
complicated than that. Items in the deprecated ["Name" callback
active-p suffix] form (without keys) won't accept additional keywords.
So I also added a preprocessing step to add keywords to such items.
This insertion-time modification might break something, if it depended
on the internal format of menu-items it had already added to the menu.
I don't know of anything that does this, and it seems to work fine so
far here, but it's a possibility. I'm not sure if this, or implicitly
doing it at menu-load time is better.
(3) if no :active keyword was present, check whether any of the
active
modes provided the command
if this test succeeds, activate the command in the menu
otherwise, if menu-developer-p is non-nil, log a warning,
and deactivate the item
...
The test in (3) probably requires additional infrastructure.
This would be quite nice, but would require all modes to declare their
commands. Maybe this could be grabbed from the auto-load cookies? I
expect commands are usually autoloaded. But using autoload cookies
would require assuming that all commands in a file are specifically
meaningful in the mode defined in that file.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta