aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorChong Yidong2012-01-07 16:12:27 +0800
committerChong Yidong2012-01-07 16:12:27 +0800
commit1de77c4c0947a935ca80f88fdbdc9c334af51fc5 (patch)
tree226f3b3455450747466ff03518810b18b16d11d2 /doc
parent75bf0d333960bf6f60af0005194fb21dec5b4485 (diff)
downloademacs-1de77c4c0947a935ca80f88fdbdc9c334af51fc5.tar.gz
emacs-1de77c4c0947a935ca80f88fdbdc9c334af51fc5.zip
* 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
Diffstat (limited to 'doc')
-rw-r--r--doc/emacs/ChangeLog5
-rw-r--r--doc/emacs/custom.texi29
-rw-r--r--doc/emacs/files.texi19
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 @@
12012-01-07 Chong Yidong <cyd@gnu.org> 12012-01-07 Chong Yidong <cyd@gnu.org>
2 2
3 * custom.texi (Hooks): Discuss how to disable minor modes.
4
5 * files.texi (Diff Mode): Discuss diff-auto-refine-mode
6 (Bug#10309).
7
3 * trouble.texi (Lossage): Refer to Bugs node for problems. 8 * trouble.texi (Lossage): Refer to Bugs node for problems.
4 (DEL Does Not Delete): Don't use "usual erasure key" teminology. 9 (DEL Does Not Delete): Don't use "usual erasure key" teminology.
5 (Screen Garbled): Don't refer to terminal "manufacturers". 10 (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.
857 Most major modes run one or more @dfn{mode hooks} as the last step 857 Most major modes run one or more @dfn{mode hooks} as the last step
858of initialization. Mode hooks are a convenient way to customize the 858of initialization. Mode hooks are a convenient way to customize the
859behavior of individual modes; they are always normal. For example, 859behavior of individual modes; they are always normal. For example,
860here's how to set up a hook to turn on Auto Fill mode when entering 860here's how to set up a hook to turn on Auto Fill mode in Text mode and
861Text mode and other modes based on Text mode: 861other modes based on Text mode:
862 862
863@example 863@example
864(add-hook 'text-mode-hook 'auto-fill-mode) 864(add-hook 'text-mode-hook 'auto-fill-mode)
865@end example 865@end example
866 866
867 Here is another example, showing how to use a hook to customize the 867@noindent
868indentation of C code. The hook function uses an anonymous lambda 868This works by calling @code{auto-fill-mode}, which enables the minor
869expression (@pxref{Lambda Expressions,,, elisp, The Emacs Lisp 869mode when no argument is supplied (@pxref{Minor Modes}). Next,
870Reference Manual}). 870suppose you don't want Auto Fill mode turned on in La@TeX{} mode,
871which is one of the modes based on Text mode. You can do this with
872the following additional line:
873
874@example
875(add-hook 'latex-mode-hook (lambda () (auto-fill-mode -1)))
876@end example
877
878@noindent
879Here we have used the special macro @code{lambda} to construct an
880anonymous function (@pxref{Lambda Expressions,,, elisp, The Emacs Lisp
881Reference Manual}), which calls @code{auto-fill-mode} with an argument
882of @code{-1} to disable the minor mode. Because La@TeX{} mode runs
883@code{latex-mode-hook} after running @code{text-mode-hook}, the result
884leaves Auto Fill mode disabled.
885
886 Here is a more complex example, showing how to use a hook to
887customize the indentation of C code:
871 888
872@example 889@example
873@group 890@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:
1352@findex diff-hunk-next 1352@findex diff-hunk-next
1353Move to the next hunk-start (@code{diff-hunk-next}). 1353Move to the next hunk-start (@code{diff-hunk-next}).
1354 1354
1355@findex diff-auto-refine-mode
1356@cindex mode, Diff Auto-Refine
1357@cindex Diff Auto-Refine mode
1358This command has a side effect: it @dfn{refines} the hunk you move to,
1359highlighting its changes with better granularity. To disable this
1360feature, type @kbd{M-x diff-auto-refine-mode} to toggle off the minor
1361mode Diff Auto-Refine mode. To disable Diff Auto Refine mode by
1362default, add this to your init file (@pxref{Hooks}):
1363
1364@example
1365(add-hook 'diff-mode-hook
1366 (lambda () (diff-auto-refine-hook -1)))
1367@end example
1368
1355@item M-p 1369@item M-p
1356@findex diff-hunk-prev 1370@findex diff-hunk-prev
1357Move to the previous hunk-start (@code{diff-hunk-prev}). 1371Move to the previous hunk-start (@code{diff-hunk-prev}). Like
1372@kbd{M-n}, this has the side-effect of refining the hunk you move to,
1373unless you disable Diff Auto-Refine mode.
1358 1374
1359@item M-@} 1375@item M-@}
1360@findex diff-file-next 1376@findex diff-file-next
@@ -1454,7 +1470,6 @@ Highlight trailing whitespace characters, except for those used by the
1454patch syntax (@pxref{Useless Whitespace}). 1470patch syntax (@pxref{Useless Whitespace}).
1455@end table 1471@end table
1456 1472
1457
1458@node Misc File Ops 1473@node Misc File Ops
1459@section Miscellaneous File Operations 1474@section Miscellaneous File Operations
1460 1475