785 |
are not called at all. The documentation of each abnormal hook variable |
are not called at all. The documentation of each abnormal hook variable |
786 |
explains in detail what is peculiar about it. |
explains in detail what is peculiar about it. |
787 |
|
|
788 |
The recommended way to add a hook function to a hook (either normal or |
You can set a hook variable with @code{setq} like any other Lisp |
789 |
abnormal) is by calling @code{add-hook}. You can use any valid Lisp |
variable, but the recommended way to add a hook function to a hook |
790 |
function as the hook function, provided it can handle the proper number |
(either normal or abnormal) is by calling @code{add-hook}. You can |
791 |
of arguments (zero arguments, in the case of a normal hook). Of course, |
specify any valid Lisp function as the hook function, provided it can |
792 |
not every Lisp function is @emph{useful} in any particular hook. |
handle the proper number of arguments (zero arguments, in the case of |
793 |
|
a normal hook). Of course, not every Lisp function is @emph{useful} |
794 |
|
in any particular hook. |
795 |
|
|
796 |
For example, here's how to set up a hook to turn on Auto Fill mode |
For example, here's how to set up a hook to turn on Auto Fill mode |
797 |
when entering Text mode and other modes based on Text mode: |
when entering Text mode and other modes based on Text mode: |
832 |
``asking for trouble.'' However, the order is predictable: the most |
``asking for trouble.'' However, the order is predictable: the most |
833 |
recently added hook functions are executed first. |
recently added hook functions are executed first. |
834 |
|
|
835 |
|
If you play with adding various different versions of a hook |
836 |
|
function by calling @code{add-hook} over and over, remember that all |
837 |
|
the versions you added will remain in the hook variable together. |
838 |
|
To clear them out, you can do @code{(setq @var{hook-variable} nil)}. |
839 |
|
|
840 |
@node Locals |
@node Locals |
841 |
@subsection Local Variables |
@subsection Local Variables |
842 |
|
|
1005 |
that the file is intended as input for. The example above is for a |
that the file is intended as input for. The example above is for a |
1006 |
language where comment lines start with @samp{;;; } and end with |
language where comment lines start with @samp{;;; } and end with |
1007 |
@samp{***}; the local values for @code{comment-start} and |
@samp{***}; the local values for @code{comment-start} and |
1008 |
@code{comment-end} customize the rest of Emacs for this unusual syntax. |
@code{comment-end} customize the rest of Emacs for this unusual |
1009 |
Don't use a prefix (or a suffix) if you don't need one. |
syntax. Don't use a prefix (or a suffix) if you don't need one. |
1010 |
|
|
1011 |
|
If you write a multi-line string value, you should put the prefix |
1012 |
|
and suffix on each line, even lines that start or end within the |
1013 |
|
string. They will be stripped off for processing the list. If you |
1014 |
|
want to split a long string across multiple lines of the file, you can |
1015 |
|
use backslash-newline, which is ignored in Lisp string constants. |
1016 |
|
Here's an example of doing this: |
1017 |
|
|
1018 |
|
@example |
1019 |
|
# Local Variables: |
1020 |
|
# compile-command: "cc foo.c -Dfoo=bar -Dhack=whatever \ |
1021 |
|
# -Dmumble=blaah" |
1022 |
|
# End: |
1023 |
|
@end example |
1024 |
|
|
1025 |
Two ``variable names'' have special meanings in a local variables |
Two ``variable names'' have special meanings in a local variables |
1026 |
list: a value for the variable @code{mode} really sets the major mode, |
list: a value for the variable @code{mode} really sets the major mode, |
1656 |
Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. |
Type @kbd{C-q} followed by the key you want to bind, to insert @var{char}. |
1657 |
|
|
1658 |
Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, |
Since this puts a non-@acronym{ASCII} character in the @file{.emacs}, |
1659 |
you should specify for that file a coding system that supports |
you should specify a coding system for that file that supports the |
1660 |
that character. @xref{Init Syntax}. |
character in question. @xref{Init Syntax}. |
|
|
|
|
@strong{Warning:} if you change the keyboard encoding, such that the code that |
|
|
@kbd{C-q} inserts becomes different, you'll need to edit the |
|
|
Lisp expression accordingly. |
|
1661 |
|
|
1662 |
@strong{Warning:} @kbd{C-q} will insert the wrong code if you visit |
@strong{Warning:} if you change the keyboard encoding, or change |
1663 |
the file @file{.emacs} in a unibyte buffer, so don't do that. |
between multibyte and unibyte mode, or anything that would alter which |
1664 |
|
code @kbd{C-q} would insert for that character, you'll need to edit |
1665 |
|
the Lisp expression accordingly, to use the character code generated |
1666 |
|
by @kbd{C-q} in the new mode. |
1667 |
|
|
1668 |
@node Mouse Buttons |
@node Mouse Buttons |
1669 |
@subsection Rebinding Mouse Buttons |
@subsection Rebinding Mouse Buttons |