Next: Command-Line Arguments, Previous: Init File, Up: Starting Up
Each terminal type can have its own Lisp library that Emacs loads when
run on that type of terminal. The library's name is constructed by
concatenating the value of the variable term-file-prefix and the
terminal type (specified by the environment variable TERM).
Normally, term-file-prefix has the value
"term/"; changing this is not recommended. Emacs finds the file
in the normal manner, by searching the load-path directories, and
trying the `.elc' and `.el' suffixes.
The usual function of a terminal-specific library is to enable
special keys to send sequences that Emacs can recognize. It may also
need to set or add to function-key-map if the Termcap or
Terminfo entry does not specify all the terminal's function keys.
See Terminal Input.
When the name of the terminal type contains a hyphen, and no library
is found whose name is identical to the terminal's name, Emacs strips
from the terminal's name the last hyphen and everything that follows
it, and tries again. This process is repeated until Emacs finds a
matching library or until there are no more hyphens in the name (the
latter means the terminal doesn't have any library specific to it).
Thus, for example, if there are no `aaa-48' and `aaa-30'
libraries, Emacs will try the same library term/aaa.el for
terminal types `aaa-48' and `aaa-30-rv'. If necessary, the
library can evaluate (getenv "TERM") to find the full name of
the terminal type.
Your init file can prevent the loading of the
terminal-specific library by setting the variable
term-file-prefix to nil. This feature is useful when
experimenting with your own peculiar customizations.
You can also arrange to override some of the actions of the
terminal-specific library by setting the variable
term-setup-hook. This is a normal hook which Emacs runs using
run-hooks at the end of Emacs initialization, after loading both
your init file and any terminal-specific libraries. You can
use this variable to define initializations for terminals that do not
have their own libraries. See Hooks.
If the
term-file-prefixvariable is non-nil, Emacs loads a terminal-specific initialization file as follows:(load (concat term-file-prefix (getenv "TERM")))You may set the
term-file-prefixvariable tonilin your init file if you do not wish to load the terminal-initialization file. To do this, put the following in your init file:(setq term-file-prefix nil).On MS-DOS, if the environment variable
TERMis not set, Emacs uses `internal' as the terminal type.
This variable is a normal hook that Emacs runs after loading your init file, the default initialization file (if any) and the terminal-specific Lisp file.
You can use
term-setup-hookto override the definitions made by a terminal-specific file.
See window-setup-hook in Window Systems, for a related
feature.
