>>> David Ponce <david@...> seems to think that:
>After looking at your code in semantic-fw.el to handle mode variables,
>I noticed that its semantic is very close of the override mechanism
>one. Mainly it is the implementation that differs.
>IMO it would be nice to unify these two mechanisms in a general
>purpose one. This is what I tried to achieve in the implementation
>you will find attached.
>Mainly I generalized the `semantic-override-table' usage and renamed
>it to `semantic-symbol-table'. Binding things into that symbol table
>is the purpose of the function `semantic-bind' directly inspired by
>`semantic-install-function-overrides'. I also renamed the functions
>`semantic-current-overrides' and `semantic-new-overrides' to
>respectively `semantic-current-bindings' and `semantic-new-bindings'.
>The general function `semantic-symbol-value' return a variable value
>from the specified environment (mode or buffer local).
>To distinguish between mode variables and function overrides I simply
>used symbol properties.
>Finally, I wrote compatibility code for the current functions used to
>manage mode variables and override functions.
>It would be nice if you could have a look at my code and tell me your
>opinion on the principle ;-)
[ ... ]
I like the idea of having one mechanism for this, and I think the
code looks good.
>(defun semantic-bind (bindings &optional plist mode)
> "Define BINDINGS in the specified environment.
>BINDINGS is a list of (VARIABLE . VALUE).
>Optional argument PLIST is a property list each VARIABLE symbol will
>be set to. The following properties have special meaning:
>- `constant' if non-nil, prevent to rebind variables.
>- `mode-var' if non-nil, define mode variables.
>- `override' if non-nil, define override functions.
I think it would make sense for an error to be thrown if 'mode-var'
is specified, but MODE is nil. The other behavior is not very useful.
[ ... ]
The only compatibility functions that should stick around (after
fixing core code, obviously) is `semantic-fetch-overload' and
`semantic-install-function-overrides', as these were advertised in
1.4. Some of the functionality in some of these functions should
stick around, such as `semantic-symbol-value-mode-assign' which may
need a name more like those in the new binding API.
For `semantic-setq-major-mode', it is unclear if `semantic-bind' is
clear enough when associating assigned values to a variable. Perhaps
This is great stuff. Check it in when you are comfortable with it.
Eric Ludlam: zappo@..., eric@...
Home: http://www.ultranet.com/~zappo Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org