Commit 1de77c4c authored by Chong Yidong's avatar Chong Yidong
Browse files

* doc/emacs/files.texi (Diff Mode): Discuss diff-auto-refine-mode.

* doc/emacs/custom.texi (Hooks): Discuss how to disable minor modes.

Fixes: debbugs:10309
parent 75bf0d33
2012-01-07 Chong Yidong <cyd@gnu.org>
* custom.texi (Hooks): Discuss how to disable minor modes.
* files.texi (Diff Mode): Discuss diff-auto-refine-mode
(Bug#10309).
* trouble.texi (Lossage): Refer to Bugs node for problems.
(DEL Does Not Delete): Don't use "usual erasure key" teminology.
(Screen Garbled): Don't refer to terminal "manufacturers".
......
......@@ -857,17 +857,34 @@ Manual}, for details.
Most major modes run one or more @dfn{mode hooks} as the last step
of initialization. Mode hooks are a convenient way to customize the
behavior of individual modes; they are always normal. For example,
here's how to set up a hook to turn on Auto Fill mode when entering
Text mode and other modes based on Text mode:
here's how to set up a hook to turn on Auto Fill mode in Text mode and
other modes based on Text mode:
@example
(add-hook 'text-mode-hook 'auto-fill-mode)
@end example
Here is another example, showing how to use a hook to customize the
indentation of C code. The hook function uses an anonymous lambda
expression (@pxref{Lambda Expressions,,, elisp, The Emacs Lisp
Reference Manual}).
@noindent
This works by calling @code{auto-fill-mode}, which enables the minor
mode when no argument is supplied (@pxref{Minor Modes}). Next,
suppose you don't want Auto Fill mode turned on in La@TeX{} mode,
which is one of the modes based on Text mode. You can do this with
the following additional line:
@example
(add-hook 'latex-mode-hook (lambda () (auto-fill-mode -1)))
@end example
@noindent
Here we have used the special macro @code{lambda} to construct an
anonymous function (@pxref{Lambda Expressions,,, elisp, The Emacs Lisp
Reference Manual}), which calls @code{auto-fill-mode} with an argument
of @code{-1} to disable the minor mode. Because La@TeX{} mode runs
@code{latex-mode-hook} after running @code{text-mode-hook}, the result
leaves Auto Fill mode disabled.
Here is a more complex example, showing how to use a hook to
customize the indentation of C code:
@example
@group
......
......@@ -1352,9 +1352,25 @@ manipulate and apply parts of patches:
@findex diff-hunk-next
Move to the next hunk-start (@code{diff-hunk-next}).
@findex diff-auto-refine-mode
@cindex mode, Diff Auto-Refine
@cindex Diff Auto-Refine mode
This command has a side effect: it @dfn{refines} the hunk you move to,
highlighting its changes with better granularity. To disable this
feature, type @kbd{M-x diff-auto-refine-mode} to toggle off the minor
mode Diff Auto-Refine mode. To disable Diff Auto Refine mode by
default, add this to your init file (@pxref{Hooks}):
@example
(add-hook 'diff-mode-hook
(lambda () (diff-auto-refine-hook -1)))
@end example
@item M-p
@findex diff-hunk-prev
Move to the previous hunk-start (@code{diff-hunk-prev}).
Move to the previous hunk-start (@code{diff-hunk-prev}). Like
@kbd{M-n}, this has the side-effect of refining the hunk you move to,
unless you disable Diff Auto-Refine mode.
@item M-@}
@findex diff-file-next
......@@ -1454,7 +1470,6 @@ Highlight trailing whitespace characters, except for those used by the
patch syntax (@pxref{Useless Whitespace}).
@end table
@node Misc File Ops
@section Miscellaneous File Operations
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment