summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-08-09 19:52:50 +0300
committerEli Zaretskii <eliz@gnu.org>2016-08-09 19:52:50 +0300
commitf785ff45d56b40f744a3d7138231d23dfd35dda4 (patch)
treefaa0aa796be882e666f4f04af70bc16eba8b9cce
parent3c9cb57c6fae57d3798298faecccd0402b4ddd9a (diff)
downloademacs-f785ff45d56b40f744a3d7138231d23dfd35dda4.tar.gz
Clarify documentation of before/after-change-functions
* doc/lispref/text.texi (Change Hooks): Clarify that the hooks are not called in balanced pairs.
-rw-r--r--doc/lispref/text.texi23
1 files changed, 15 insertions, 8 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 7791c261e3b..de0b00758a5 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -4676,10 +4676,10 @@ group you start for any given buffer should be the last one finished.
@cindex change hooks
@cindex hooks for text changes
- These hook variables let you arrange to take notice of all changes in
-all buffers (or in a particular buffer, if you make them buffer-local).
-See also @ref{Special Properties}, for how to detect changes to specific
-parts of the text.
+ These hook variables let you arrange to take notice of changes in
+buffers (or in a particular buffer, if you make them buffer-local).
+See also @ref{Special Properties}, for how to detect changes to
+specific parts of the text.
The functions you use in these hooks should save and restore the match
data if they do anything that uses regular expressions; otherwise, they
@@ -4687,8 +4687,8 @@ will interfere in bizarre ways with the editing operations that call
them.
@defvar before-change-functions
-This variable holds a list of functions to call before any buffer
-modification. Each function gets two arguments, the beginning and end
+This variable holds a list of functions to call before most buffer
+modifications. Each function gets two arguments, the beginning and end
of the region that is about to change, represented as integers. The
buffer that is about to change is always the current buffer.
@end defvar
@@ -4706,8 +4706,15 @@ for the changed text, its length is simply the difference between the
first two arguments.
@end defvar
- Output of messages into the @file{*Messages*} buffer does not
-call these functions.
+ Output of messages into the @file{*Messages*} buffer does not call
+these functions, and neither do certain internal buffer changes, such
+as changes in buffers created by Emacs internally for certain jobs,
+that should not be visible to Lisp programs.
+
+ Do @emph{not} expect the before-change hooks and the after-change
+hooks be called in balanced pairs around each buffer change. These
+hooks are provided on the assumption that Lisp programs will use
+either before- or the after-change hooks, but not both.
@defmac combine-after-change-calls body@dots{}
The macro executes @var{body} normally, but arranges to call the