]> git.eshelyaron.com Git - emacs.git/commitdiff
* doc/emacs/files.texi (Diff Mode): Discuss diff-auto-refine-mode.
authorChong Yidong <cyd@gnu.org>
Sat, 7 Jan 2012 08:12:27 +0000 (16:12 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 7 Jan 2012 08:12:27 +0000 (16:12 +0800)
* doc/emacs/custom.texi (Hooks): Discuss how to disable minor modes.

Fixes: debbugs:10309
doc/emacs/ChangeLog
doc/emacs/custom.texi
doc/emacs/files.texi

index 1fc59b01b7e0ba532ed225a6c64b39dccb2c062e..7b42f58c4f5f338ca88e996c8fc22a2db74be2c7 100644 (file)
@@ -1,5 +1,10 @@
 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".
index 69e74ffd50c22d2d46609aa5787499e0e8772d4e..1d75be4dd8cea1a6106cefbac88caaf59b2a71ff 100644 (file)
@@ -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
index e4c40837b28ef1696e05e228bb37da94c5b15a22..f7837522c9c5dc444b676c5abff48966df4d231d 100644 (file)
@@ -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