|Version 2 (modified by rme, 9 years ago) (diff)|
5. The Current Environment
5.1. Different Scopes
In Hemlock the values of variables (page 23), key-bindings (page 29) and character-attributes (page 37) may depend on the current-buffer (page 9) and the modes active in it. There are three possible scopes for Hemlock values:
- buffer local
- The value is present only if the buffer it is local to is the current-buffer.
- mode local
- The value is present only when the mode it is local to is active in the current-buffer.
- The value is always present unless shadowed by a buffer or mode local value.
It is possible for there to be a conflict between different values for the same thing in different scopes. For example, there be might a global binding for a given variable and also a local binding in the current buffer. Whenever there is a conflict shadowing occurs, permitting only one of the values to be visible in the current environment.
The process of resolving such a conflict can be described as a search down a list of places where the value might be defined, returning the first value found. The order for the search is as follows:
- Local values in the current buffer.
- Mode local values in the minor modes of the current buffer, in order from the highest precedence mode to the lowest precedence mode. The order of minor modes with equal precedences is undefined.
- Mode local values in the current buffer's major mode.
- Global values.