Back to Table of Contents

5. The Current Environment

5.1. Different Scopes

In Hemlock the "current" values of variables, key bindings and character-attributes depend on the current buffer 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.

5.2. Shadowing

It is possible that there are different values for the same thing in 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:

  1. Local values in the current buffer.
  2. 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.
  3. Mode local values in the current buffer's major mode.
  4. Global values.

Back to Table of Contents

Last modified 13 years ago Last modified on Jan 15, 2008, 12:15:06 AM