From 1de77c4c0947a935ca80f88fdbdc9c334af51fc5 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Sat, 7 Jan 2012 16:12:27 +0800 Subject: [PATCH] * 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 --- doc/emacs/ChangeLog | 5 +++++ doc/emacs/custom.texi | 29 +++++++++++++++++++++++------ doc/emacs/files.texi | 19 +++++++++++++++++-- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 1fc59b01b7e..7b42f58c4f5 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,5 +1,10 @@ 2012-01-07 Chong Yidong + * 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". diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 69e74ffd50c..1d75be4dd8c 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -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 diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index e4c40837b28..f7837522c9c 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -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 -- 2.39.2