Previous: , Up: Variables   [Index]


C.3 Local Variables

Almost any variable can be made “local” to a specific Emacs buffer. This means that its value in that buffer is independent of its value in other buffers. A few variables are always local in every buffer. Every other Emacs variable has a “global” value which is in effect in all buffers that have not made the variable local. A few variables cannot be local to a buffer because they are always local to each display instead.

make-local-variable

reads the name of a variable and makes it local to the current buffer.

make-variable-buffer-local

marks a variable so it will become local automatically whenever it is set. once a variable has been marked in this way, the usual ways of setting the variable automatically do ‘make-local-variable’ first. We call such variables “per-buffer” variables. The per-buffer’s global value is the initial value of the variable for each new buffer.

kill-local-variable

makes a specified variable cease to be local to the current buffer. The global value of the variable henceforth is in effect in this buffer.

setq-default

set the global value of a variable, regardless of whether the variable has a local value in the current buffer. This is is the only way to set the global value of a variable that has been marked with ‘make-variable-buffer-local’.

default-value

This function takes a symbol as argument and returns its default value. The argument is evaluated; usually you must quote it explicitly.


Previous: Directory Variables, Up: Variables   [Index]