49.4.1 Init File Syntax
The init file contains one or more Lisp expressions. Each of these consists of a function name followed by arguments, all surrounded by parentheses. For example, (setq fill-column 60)
calls the function setq
to set the variable fill-column
(see Filling) to 60.
You can set any Lisp variable with setq
, but with certain variables setq
wonβt do what you probably want in the init file. Some variables automatically become buffer-local when set with setq
; what you want in the init file is to set the default value, using setq-default
. Some customizable minor mode variables do special things to enable the mode when you set them with Customize, but ordinary setq
wonβt do that; to enable the mode in your init file, call the minor mode command. The following section has examples of both of these methods.
The second argument to setq
is an expression for the new value of the variable. This can be a constant, a variable, or a function call expression. In the init file, constants are used most of the time. They can be:
numbers
β
Numbers are written in decimal, with an optional initial minus sign.
strings
β
Lisp string syntax is the same as C string syntax with a few extra features. Use a double-quote character to begin and end a string constant.
In a string, you can include newlines and special characters literally. But often it is cleaner to use backslash sequences for them: β\n
β for newline, β\b
β for backspace, β\r
β for carriage return, β\t
β for tab, β\f
β for formfeed (control-L), β\e
β for escape, β\\
β for a backslash, β\"
β for a double-quote, or β\ooo
β for the character whose octal code is ooo
. Backslash and double-quote are the only characters for which backslash sequences are mandatory.
β\C-
β can be used as a prefix for a control character, as in β\C-s
β for ASCII control-S, and β\M-
β can be used as a prefix for a Meta character, as in β\M-a
β for Meta-A
or β\M-\C-a
β for Ctrl-Meta-A
.
See Init Non-ASCII, for information about including non-ASCII in your init file.
characters
β
Lisp character constant syntax consists of a β?
β followed by either a character or an escape sequence starting with β\
β. Examples: ?x
, ?\n
, ?\"
, ?\)
. Note that strings and characters are not interchangeable in Lisp; some contexts require one and some contexts require the other.
See Init Non-ASCII, for information about binding commands to keys which send non-ASCII characters.
true
β
t
stands for βtrue".
false
β
nil
stands for βfalse".
other lisp objects
β
Write a single-quote ('
) followed by the Lisp object you want.