83 |
These minor-mode variables provide a good way for Lisp programs to turn |
These minor-mode variables provide a good way for Lisp programs to turn |
84 |
minor modes on and off; they are also useful in a file's local variables |
minor modes on and off; they are also useful in a file's local variables |
85 |
list. But please think twice before setting minor modes with a local |
list. But please think twice before setting minor modes with a local |
86 |
variables list, because most minor modes are matter of user |
variables list, because most minor modes are a matter of user |
87 |
preference---other users editing the same file might not want the same |
preference---other users editing the same file might not want the same |
88 |
minor modes you prefer. |
minor modes you prefer. |
89 |
|
|
198 |
the active fields and other features. |
the active fields and other features. |
199 |
|
|
200 |
@menu |
@menu |
201 |
* Groups: Customization Groups. |
* Groups: Customization Groups. How options are classified in a structure. |
|
How options are classified in a structure. |
|
202 |
* Changing a Variable:: How to edit a value and set an option. |
* Changing a Variable:: How to edit a value and set an option. |
203 |
* Saving Customizations:: Details of saving customizations. |
* Saving Customizations:: Details of saving customizations. |
204 |
* Face Customization:: How to edit the attributes of a face. |
* Face Customization:: How to edit the attributes of a face. |
686 |
buffer is (if it is not a face) in fact a Lisp variable. Emacs does |
buffer is (if it is not a face) in fact a Lisp variable. Emacs does |
687 |
not (usually) change the values of these variables; instead, you set |
not (usually) change the values of these variables; instead, you set |
688 |
the values, and thereby alter and control the behavior of certain |
the values, and thereby alter and control the behavior of certain |
689 |
Emacs commands. Use of the customization buffer is explained above; |
Emacs commands. Use of the customization buffer is explained above |
690 |
here we describe other aspects of Emacs variables. |
(@pxref{Easy Customization}); here we describe other aspects of Emacs |
691 |
|
variables. |
692 |
|
|
693 |
@menu |
@menu |
694 |
* Examining:: Examining or setting one variable's value. |
* Examining:: Examining or setting one variable's value. |
761 |
Interaction}. |
Interaction}. |
762 |
|
|
763 |
Setting variables, like all means of customizing Emacs except where |
Setting variables, like all means of customizing Emacs except where |
764 |
otherwise stated, affects only the current Emacs session. |
otherwise stated, affects only the current Emacs session. The only |
765 |
|
way to alter the variable in future sessions is to put something in |
766 |
|
the @file{~/.emacs} file to set it those sessions (@pxref{Init File}). |
767 |
|
|
768 |
@node Hooks |
@node Hooks |
769 |
@subsection Hooks |
@subsection Hooks |
1181 |
Function keys send input events just as character keys do, and keymaps |
Function keys send input events just as character keys do, and keymaps |
1182 |
can have bindings for them. |
can have bindings for them. |
1183 |
|
|
1184 |
On many terminals, typing a function key actually sends the computer a |
On text terminals, typing a function key actually sends the computer a |
1185 |
sequence of characters; the precise details of the sequence depends on |
sequence of characters; the precise details of the sequence depends on |
1186 |
which function key and on the model of terminal you are using. (Often |
which function key and on the model of terminal you are using. (Often |
1187 |
the sequence starts with @kbd{@key{ESC} [}.) If Emacs understands your |
the sequence starts with @kbd{@key{ESC} [}.) If Emacs understands your |
1466 |
@end example |
@end example |
1467 |
|
|
1468 |
@noindent |
@noindent |
1469 |
This example uses a string constant containing one character, @kbd{C-z}. |
This example uses a string constant containing one character, |
1470 |
The single-quote before the command name, @code{shell}, marks it as a |
@kbd{C-z}. (@samp{\C-} is string syntax for a control character.) The |
1471 |
|
single-quote before the command name, @code{shell}, marks it as a |
1472 |
constant symbol rather than a variable. If you omit the quote, Emacs |
constant symbol rather than a variable. If you omit the quote, Emacs |
1473 |
would try to evaluate @code{shell} immediately as a variable. This |
would try to evaluate @code{shell} immediately as a variable. This |
1474 |
probably causes an error; it certainly isn't what you want. |
probably causes an error; it certainly isn't what you want. |
1475 |
|
|
1476 |
Here is another example that binds a key sequence two characters long: |
Here is another example that binds the key sequence @kbd{C-x M-l}: |
1477 |
|
|
1478 |
@example |
@example |
1479 |
(global-set-key "\C-xl" 'make-symbolic-link) |
(global-set-key "\C-x\M-l" 'make-symbolic-link) |
1480 |
@end example |
@end example |
1481 |
|
|
1482 |
To put @key{TAB}, @key{RET}, @key{ESC}, or @key{DEL} in the |
To put @key{TAB}, @key{RET}, @key{ESC}, or @key{DEL} in the |
1524 |
@end example |
@end example |
1525 |
|
|
1526 |
You can use a vector for the simple cases too. Here's how to |
You can use a vector for the simple cases too. Here's how to |
1527 |
rewrite the first three examples above, using vectors to bind |
rewrite the first six examples above to use vectors: |
|
@kbd{C-z}, @kbd{C-x l}, and @kbd{C-x @key{TAB}}: |
|
1528 |
|
|
1529 |
@example |
@example |
1530 |
(global-set-key [?\C-z] 'shell) |
(global-set-key [?\C-z] 'shell) |
1537 |
|
|
1538 |
@noindent |
@noindent |
1539 |
As you see, you represent a multi-character key sequence with a vector |
As you see, you represent a multi-character key sequence with a vector |
1540 |
by listing each of the characters within the square brackets that |
by listing all of the characters in order within the square brackets that |
1541 |
delimit the vector. |
delimit the vector. |
1542 |
|
|
1543 |
Language and coding systems can cause problems with key bindings |
Language and coding systems can cause problems with key bindings |
1586 |
key. |
key. |
1587 |
|
|
1588 |
A key sequence which contains function key symbols (or anything but |
A key sequence which contains function key symbols (or anything but |
1589 |
@acronym{ASCII} characters) must be a vector rather than a string. The vector |
@acronym{ASCII} characters) must be a vector rather than a string. |
1590 |
syntax uses spaces between the elements, and square brackets around the |
Thus, to bind function key @samp{f1} to the command @code{rmail}, |
1591 |
whole vector. Thus, to bind function key @samp{f1} to the command |
write the following: |
|
@code{rmail}, write the following: |
|
1592 |
|
|
1593 |
@example |
@example |
1594 |
(global-set-key [f1] 'rmail) |
(global-set-key [f1] 'rmail) |
1636 |
@subsection Named @acronym{ASCII} Control Characters |
@subsection Named @acronym{ASCII} Control Characters |
1637 |
|
|
1638 |
@key{TAB}, @key{RET}, @key{BS}, @key{LFD}, @key{ESC} and @key{DEL} |
@key{TAB}, @key{RET}, @key{BS}, @key{LFD}, @key{ESC} and @key{DEL} |
1639 |
started out as names for certain @acronym{ASCII} control characters, used so often |
started out as names for certain @acronym{ASCII} control characters, |
1640 |
that they have special keys of their own. Later, users found it |
used so often that they have special keys of their own. For instance, |
1641 |
|
@key{TAB} was another name for @kbd{C-i}. Later, users found it |
1642 |
convenient to distinguish in Emacs between these keys and the ``same'' |
convenient to distinguish in Emacs between these keys and the ``same'' |
1643 |
control characters typed with the @key{CTRL} key. |
control characters typed with the @key{CTRL} key. Therefore, on most |
1644 |
|
modern terminals, they are no longer the same, and @key{TAB} is |
1645 |
Emacs distinguishes these two kinds of input, when the keyboard |
distinguishable from @kbd{C-i}. |
1646 |
reports these keys to Emacs. It treats the ``special'' keys as function |
|
1647 |
keys named @code{tab}, @code{return}, @code{backspace}, @code{linefeed}, |
Emacs can distinguish these two kinds of input if the keyboard does. |
1648 |
@code{escape}, and @code{delete}. These function keys translate |
It treats the ``special'' keys as function keys named @code{tab}, |
1649 |
automatically into the corresponding @acronym{ASCII} characters @emph{if} they |
@code{return}, @code{backspace}, @code{linefeed}, @code{escape}, and |
1650 |
have no bindings of their own. As a result, neither users nor Lisp |
@code{delete}. These function keys translate automatically into the |
1651 |
programs need to pay attention to the distinction unless they care to. |
corresponding @acronym{ASCII} characters @emph{if} they have no |
1652 |
|
bindings of their own. As a result, neither users nor Lisp programs |
1653 |
|
need to pay attention to the distinction unless they care to. |
1654 |
|
|
1655 |
If you do not want to distinguish between (for example) @key{TAB} and |
If you do not want to distinguish between (for example) @key{TAB} and |
1656 |
@kbd{C-i}, make just one binding, for the @acronym{ASCII} character @key{TAB} |
@kbd{C-i}, make just one binding, for the @acronym{ASCII} character @key{TAB} |
1954 |
@cindex rebinding keys, permanently |
@cindex rebinding keys, permanently |
1955 |
@cindex startup (init file) |
@cindex startup (init file) |
1956 |
|
|
1957 |
When Emacs is started, it normally loads a Lisp program from the file |
When Emacs is started, it normally loads a Lisp program from the |
1958 |
@file{.emacs} or @file{.emacs.el} in your home directory. We call this |
file @file{.emacs} or @file{.emacs.el} in your home directory. (You |
1959 |
file your @dfn{init file} because it specifies how to initialize Emacs |
can also put it in a subdirectory @file{~/.emacs.d} and Emacs will |
1960 |
for you. You can use the command line switch @samp{-q} to prevent |
still find it.) We call this file your @dfn{init file} because it |
1961 |
loading your init file, and @samp{-u} (or @samp{--user}) to specify a |
specifies how to initialize Emacs for you. You can use the command |
1962 |
different user's init file (@pxref{Initial Options}). |
line switch @samp{-q} to prevent loading your init file, and @samp{-u} |
1963 |
|
(or @samp{--user}) to specify a different user's init file |
1964 |
|
(@pxref{Initial Options}). |
1965 |
|
|
1966 |
@cindex @file{default.el}, the default init file |
@cindex @file{default.el}, the default init file |
1967 |
There can also be a @dfn{default init file}, which is the library |
There can also be a @dfn{default init file}, which is the library |
2229 |
@code{nil}. |
@code{nil}. |
2230 |
|
|
2231 |
@item |
@item |
2232 |
Rebind the key @kbd{C-x l} to run the function @code{make-symbolic-link}. |
Rebind the key @kbd{C-x l} to run the function @code{make-symbolic-link} |
2233 |
|
(@xref{Init Rebinding}). |
2234 |
|
|
2235 |
@example |
@example |
2236 |
(global-set-key "\C-xl" 'make-symbolic-link) |
(global-set-key "\C-xl" 'make-symbolic-link) |
2333 |
@subsection How Emacs Finds Your Init File |
@subsection How Emacs Finds Your Init File |
2334 |
|
|
2335 |
Normally Emacs uses the environment variable @env{HOME} to find |
Normally Emacs uses the environment variable @env{HOME} to find |
2336 |
@file{.emacs}; that's what @samp{~} means in a file name. But if you |
@file{.emacs}; that's what @samp{~} means in a file name. If @file{.emacs} |
2337 |
run Emacs from a shell started by @code{su}, Emacs tries to find your |
is not found directly inside @file{~/}, Emacs looks for it in |
2338 |
own @file{.emacs}, not that of the user you are currently pretending |
@file{~/.emacs.d/}. |
2339 |
to be. The idea is that you should get your own editor customizations |
|
2340 |
even if you are running as the super user. |
However, if you run Emacs from a shell started by @code{su}, Emacs |
2341 |
|
tries to find your own @file{.emacs}, not that of the user you are |
2342 |
|
currently pretending to be. The idea is that you should get your own |
2343 |
|
editor customizations even if you are running as the super user. |
2344 |
|
|
2345 |
More precisely, Emacs first determines which user's init file to use. |
More precisely, Emacs first determines which user's init file to use. |
2346 |
It gets the user name from the environment variables @env{LOGNAME} and |
It gets the user name from the environment variables @env{LOGNAME} and |