Appendix A. Emacs Variables
This appendix lists some Emacs variables. We chose them for their
general usefulness and for their applicability to subjects in this
book.
The variables below are grouped by category, and their default values
are shown (where practical to do so). For more details on specific
variables, see the chapters referred to at the beginning of each
table. For
information on variables used in
programming language modes, see Chapter 9.
Table A-1. Backups, auto-save, and versioning (Chapter 2, Chapter 12)|
Variable
|
Default
|
Description
|
|---|
|
make-backup-files
|
t
|
If t, create a backup version of the
current file before saving it for the first time.
| |
backup-by-copying
|
nil
|
If t, create backup files by
copying rather than
renaming the file being saved to a backup
version. The default is renaming, which is more efficient. Copying
can yield different results, especially when you're
editing files owned by another user, and in operating systems that
allow "hard links" to files
(alternate names that are associated with the physical file). There
are a raft of variables that can tweak this behavior based on
context; check the online help for make-backup-files for the details.
| |
version-control
|
nil
|
If t, create numbered versions of
files as backups (with names of the form
filename~N~). If nil, only do this for files that have numbered
versions already. If 'never (note
the leading single quote), never make numbered versions.
| |
kept-new-versions
|
2
|
Number of latest versions of a file to keep when a new numbered
backup is made.
| |
kept-old-versions
|
2
|
Number of oldest versions of a file to keep when a new numbered
backup is made.
| |
delete-old-versions
|
nil
|
If t, delete excess versions (not
those kept according to the above variables) without asking for
confirmation first. If nil, ask for
confirmation first. If any other value, don't delete
excess versions.
| |
auto-save-default
|
t
|
If t, do auto-saving of every file
visited.
| |
auto-save-visited-file-name
|
nil
|
If t, auto-save to the file being
visited rather than to a special auto-save file.
| |
auto-save-interval
|
300
|
Number of keystrokes between auto-saving; if 0, turn off auto-saving.
| |
auto-save-timeout
|
30
|
Length of time of inactivity after which Emacs auto-saves. If
nil or 0, turn off this feature.
| |
delete-auto-save-files
|
t
|
Non-nil means delete auto-save files
whenever the "real" file is saved.
| |
buffer-offer-save
|
nil
|
Non-nil means offer to save the
current buffer when exiting Emacs, even if the buffer is not a file.
| |
vc-handled-backends
|
(RCS CVS SVN SCCS Arch MCVS)
|
Version control systems used with the vc package. The order in which they appear in
this list controls the order in which they will be attempted when
working with a new file.
| |
vc-display-status
|
t
|
If non-nil, display the version
number and the locked state in the mode line.
| |
vc-keep-workfiles
|
t
|
If non-nil, do not delete work files
after you register changes with the version control system.
| |
vc-mistrust-permissions
|
nil
|
If non-nil, do not assume that a
file's owner ID and permission flags reflect version
control system's idea of file's
ownership and permission; get this information directly from version
control system.
| |
vc-suppress-confirm
|
nil
|
If non-nil, do not ask for
confirmation before performing version control actions.
| |
vc-initial-comment
|
nil
|
If non-nil, prompt for an initial
comment when registering a file with version control system.
| |
vc-make-backup-files
|
nil
|
If non-nil, make standard Emacs
backups of files registered with version control.
| |
diff-switches
|
-c
|
Command-line switches used to control the format of change reports by
VC as well as diff.el.
|
Table A-2. Searching and replacing (Chapter 3)|
Variable
|
Default
|
Description
|
|---|
|
case-fold-search
|
t
|
If non-nil, treat upper- and
lowercase letters as the same when searching.
| |
case-replace
|
t
|
If non-nil, preserve the original
case of letters when doing replaces (even if case-fold-search is on).
| |
search-upper-case
|
'not-yanks
|
If non-nil, uppercase letters in
search strings defeat case-fold-search (i.e., force search to be
case-sensitive). The symbol 'not-yanks means convert uppercase letters in
yanked text to lowercase.
| |
search-exit-option
|
t
|
If non-nil, any control character
other than those defined in incremental search (Del, C-j,
C-q, C-r, C-s,
C-w, C-y) exits search.
| |
search-highlight
|
t
|
If non-nil, highlight partial search
matches.
| |
query-replace-highlight
|
t
|
If non-nil, highlight matches in
query-replace mode.
|
|
Variable
|
Default
|
Description
|
|---|
|
next-screen-context-lines
|
2
|
Retain this many lines when scrolling forward or backward by
C-v or M-v.
| |
scroll-step
|
0
|
When moving the cursor vertically out of the current window, scroll
this many lines forward or backward. If 0, scroll enough lines to
place the cursor at the center of the window after scrolling.
| |
hscroll-step
|
0
|
When moving the cursor horizontally out of the current window, scroll
this many columns left or right. If 0, scroll enough lines to place
the cursor at the center of the window after scrolling.
| |
tab-width
|
8
|
Width of tab stops; when set, it becomes local to the current buffer.
| |
left-margin
|
0
|
Number of columns to indent when typing C-j in fundamental mode and text mode.
| |
standard-indent
|
4
|
The number of columns to indent when using commands that increase or
decrease margins.
| |
truncate-lines
|
nil
|
If non-nil, do not wrap long lines;
instead, truncate them and use arrows to show that the line continues
off-screen. (Nongraphical versions of Emacs use $ instead to show where the line extends.)
| |
truncate-partial-width-windows
|
t
|
If non-nil, truncate long lines (as
above) in all windows that are not the full width of the display.
| |
window-min-height
|
4
|
Minimum allowable height of windows (in lines).
| |
window-min-width
|
10
|
Minimum allowable width of vertically split windows (in columns).
| |
ctl-arrow
|
t
|
Non-nil means display control
characters using ^X, where
X is the letter being
"controlled." Otherwise, use octal
(base 8) ASCII notation for display—for example, C-h appears as \010 in octal.
| |
display-time-day-and-date
|
nil
|
If non-nil, M-x display-time Enter will also show the day
and date.
| |
line-number-mode
|
t
|
If non-nil, display the line number
on the mode line.
| |
line-number-display-limit
|
nil
|
Maximum size of buffer (in characters) for which line numbers should
be displayed. A value of nil means
no limit.
| |
column-number-mode
|
nil
|
If non-nil, display the column
number on the mode line.
| |
visible-bell
|
nil
|
If non-nil,
"flash" the screen instead of
beeping when necessary.
| |
track-eol
|
nil
|
If non-nil, whenever the cursor is
at the end of the line, "stick" to
the end of the line when moving the cursor up or down; otherwise,
stay in the column where the cursor is.
| |
blink-matching-paren
|
t
|
If non-nil, blink matching open
parenthesis-type character when a corresponding close parenthesis is
typed.
| |
blink-matching-paren-distance
|
25600
|
Maximum number of characters to search through to find a matching
open parenthesis character when a close parenthesis is typed.
| |
blink-matching-delay
|
1
|
Number of seconds to pause when blinking a matching parenthesis.
| |
echo-keystrokes
|
1
|
Echo prefixes for unfinished commands (e.g., C-) in minibuffer after user pauses for this
many seconds; 0 means don't do echoing at all.
| |
insert-default-directory
|
t
|
If non-nil, insert the current
directory in the minibuffer when asking for a filename.
| |
highlight-nonselected-windows
|
nil
|
If non-nil, highlight regions in
windows other than the one currently selected; applies to GUI
displays and others that support highlighting.
| |
mouse-scroll-delay
|
0.25
|
Delay, in seconds, between screen scrolls when mouse is clicked and
dragged from inside a window to beyond its borders. 0 means scroll as
fast as possible.
| |
mouse-scroll-min-lines
|
1
|
Scroll at least this many lines when mouse is clicked and dragged up
or down beyond a window.
|
|
Variable
|
Default
|
Description
|
|---|
|
major-mode
|
fundamental-mode
|
Default mode for new buffers, unless set by virtue of the filename;
when setting this variable, remember to precede the mode name with a
single quote (the value is a symbol).
| |
default-major-mode
|
fundamental-mode
|
The major mode for new buffers.
| |
auto-mode-alist
|
(see Chapter 10)
|
List of associations between filenames and major modes.
| |
interpreter-mode-alist
|
(see Chapter 9)
|
A list similar to auto-mode-alist,
but for interpreted languages like Perl and Python.
| |
indent-tabs-mode
|
t
|
If non-nil, allow the use of tab
characters (as well as spaces) when indenting with C-j. This can really drive other developers
mad, so you should probably disable this if you are working on a
team.
| |
dired-kept-versions
|
2
|
When cleaning a directory in Dired, keep this many versions of files.
| |
dired-garbage-files-regexp
|
"\\.\\(?:aux\\|bak\\|dvi\\|log\\|orig\\|rej\\|toc\\)\\'"
|
Defines what file types are marked when selecting garbage files in
Dired.
| |
dired-listing-switches
|
"-al"
|
Options passed to the ls command for
generating dired listings; should
contain at least "-l".
| |
dired-view-command-alist
|
(see Chapter 10)
|
Defines helper applications for Dired to invoke when opening certain
types of files.
| |
shell-file-name
|
varies
|
Filename of shell to run with functions that use one, such as
list-directory, dired, and compile; taken from value of the Unix
environment variable SHELL.
| |
load-path
| |
List of directories to search for Lisp packages to load (see Chapter 11); often set to lisp
subdirectory of directory where Emacs source code is installed on
your system.
| |
lpr-switches
|
nil
|
Defines command-line options to pass to lpr
| |
calendar-week-start-day
|
0
|
Day defined as first day of the week. 0 is Sunday, 1 is Monday and so
on.
| |
picture-tab-characters
|
"!-~"
|
Characters interpreted as tab stops in picture mode if they appear on
a line of their own.
|
|
Variable
|
Default
|
Description
|
|---|
|
sentence-end
|
(see Chapter 13)
|
Regular expression that matches ends of sentences.
| |
sentence-end-double-space
|
t
|
If non-nil, do not treat single
spaces after periods as ends of sentences.
| |
paragraph-separate
|
"[ \t\f]*$"
|
Regular expression that matches beginnings of lines that separate
paragraphs.
| |
paragraph-start
|
"\f\\|[ \t]*$"
|
Regular expression that matches beginnings of lines that start or
separate paragraphs.
| |
page-delimiter
|
"^\f"
|
Regular expression that matches page breaks.
| |
tex-default-mode
|
'latex-mode
|
Mode to invoke when creating a file that could be either TEX or LATEX.
| |
tex-run-command
|
"tex"
|
Character string used as a command to run in a subprocess on a file
in mode.
| |
latex-run-command
|
"latex"
|
String used as a command to run LATEX in a subprocess.
| |
slitex-run-command
|
"slitex"
|
String used as a command to run SliTEX in a subprocess.
| |
tex-dvi-print-command
|
"lpr -d"
|
Character string used as a command to print a file in tex mode with
C-c C-p.
| |
tex-alt-dvi-print-command
|
"lpr -d"
|
Command to direct .dvi files to a secondary
printer.
| |
tex-dvi-view-command
|
(if (eq window-system 'x) "xdvi" "dvi2tty * |
cat -s")
|
Character string used as command to view a .dvi
output file with C-c C-v; this
expression yields xdvi on X Window systems, and
a terminal-based alternative on others. This will only work if a
Unix-like operating environment is present (such as Mac OS X, or
Cygwin under Windows).
| |
tex-offer-save
|
t
|
If non-nil, offer to save any
unsaved buffers before running TEX.
| |
tex-show-queue-command
|
"lpq"
|
Character string used as command to show the print queue with
C-c C-q in Tex mode.
| |
tex-directory
|
"."
|
Directory for TEX to put temporary files in; default is the current
directory.
| |
outline-regexp
|
"[*\f]+"
|
Regular expression that matches heading lines in outline mode.
| |
outline-heading-end-regexp
|
"\n"
|
Regular expression that matches ends of heading lines in outline mode.
| |
selective-display-ellipses
|
t
|
If t, display "..." in place of
hidden text in outline mode; otherwise don't display
anything.
|
Table A-6. Programming (Chapter 9)|
Variable
|
Default
|
Description
|
|---|
|
compile-command
|
"make -k"
|
Default compilation command to use when compiling files via Emacs
language modes. For example, to set ant as the default compilation
tool, set this to "ant -emacs".
| |
compilation-error-regexp-alist
|
(very long regular expression)
|
Regular expression designed to match error messages from all the
compilers supported by Emacs.
| |
comment-column
|
32
|
The column at which Emacs should insert comments. If code reaches
this column, inserts comment one space beyond code.
| |
comment-multi-line
|
nil
|
If t, continue comment on the next
line. If nil, start a new comment on
the next line.
| |
c-style-alist
|
(see Chapter 9)
|
The code indentation style to use. Many are available; see Chapter 9.
| |
debug-on-error
|
nil
|
If non-nil, emacs will go into debug
mode when an error occurs in evaluating Lisp code. This can be handy
when you're trying out a new function, but you
probably want to read the debugger's help first to
learn your way around.
| |
c-macro-preprocessor
|
"/lib/cpp -C"
|
Defines which command is used to invoke C preprocessor when you type
C-c C-e.
| |
stack-trace-on-error
|
nil
|
If non-nil, Emacs displays a stack
trace when an error occurs in evaluating Lisp code. This is useful in
similar situations as debug-on-error
and might give you enough information without having to learn the
debugger interface.
|
Table A-7. Completion (Chapter 14)|
Variable
|
Default
|
Description
|
|---|
|
completion-auto-help
|
t
|
If non-nil, provide help if a
completion (via Tab or Enter in minibuffer) is invalid or ambiguous.
| |
completion-ignored-extensions
|
(see Chapter 14)
|
List of filename suffixes Emacs ignores when completing filenames
(for example, ~).
| |
completion-ignore-case
|
nil
|
If non-nil, ignore case distinctions
when doing completion.
|
Table A-8. Miscellaneous|
Variable
|
Default
|
Description
|
|---|
|
kill-ring-max
|
60
|
Keep n pieces of deleted text in the kill ring
before deleting oldest kills.
| |
require-final-newline
|
nil
|
If a file being saved is missing a final newline: nil means don't add one;
t means add one automatically;
otherwise ask whether to add a newline.
| |
next-line-add-newlines
|
nil
|
If non-nil, next-line (C-n or down arrow) inserts newlines when at
the end of the buffer, rather than signaling an error.
| |
undo-limit, undo-strong-limit
|
20000, 30000
|
These two variables jointly control how much space Emacs is willing
to allocate to supporting the undo
command. If you ever find yourself wanting to undo more than past
what Emacs remembers, you might want to investigate increasing these
limits; with today's memory sizes they can probably
comfortably be much larger.
| |
mac-command-key-is-meta
|
t
|
If t, the Mac Command key is used for Meta; if nil,
the Option key is Meta instead.
|
|