Previous Section Next Section Table of Contents Glossary Index

Chapter 6. Hemlock Programming

6.5. The Current Environment

6.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.

global

The value is always present unless shadowed by a buffer or mode local value.

6.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.


Previous Section Next Section Table of Contents Glossary Index