Clarify documentation of before/after-change-functions
* doc/lispref/text.texi (Change Hooks): Clarify that the hooks are not called in balanced pairs.
This commit is contained in:
parent
3c9cb57c6f
commit
f785ff45d5
1 changed files with 15 additions and 8 deletions
|
@ -4676,10 +4676,10 @@ group you start for any given buffer should be the last one finished.
|
||||||
@cindex change hooks
|
@cindex change hooks
|
||||||
@cindex hooks for text changes
|
@cindex hooks for text changes
|
||||||
|
|
||||||
These hook variables let you arrange to take notice of all changes in
|
These hook variables let you arrange to take notice of changes in
|
||||||
all buffers (or in a particular buffer, if you make them buffer-local).
|
buffers (or in a particular buffer, if you make them buffer-local).
|
||||||
See also @ref{Special Properties}, for how to detect changes to specific
|
See also @ref{Special Properties}, for how to detect changes to
|
||||||
parts of the text.
|
specific parts of the text.
|
||||||
|
|
||||||
The functions you use in these hooks should save and restore the match
|
The functions you use in these hooks should save and restore the match
|
||||||
data if they do anything that uses regular expressions; otherwise, they
|
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.
|
them.
|
||||||
|
|
||||||
@defvar before-change-functions
|
@defvar before-change-functions
|
||||||
This variable holds a list of functions to call before any buffer
|
This variable holds a list of functions to call before most buffer
|
||||||
modification. Each function gets two arguments, the beginning and end
|
modifications. Each function gets two arguments, the beginning and end
|
||||||
of the region that is about to change, represented as integers. The
|
of the region that is about to change, represented as integers. The
|
||||||
buffer that is about to change is always the current buffer.
|
buffer that is about to change is always the current buffer.
|
||||||
@end defvar
|
@end defvar
|
||||||
|
@ -4706,8 +4706,15 @@ for the changed text, its length is simply the difference between the
|
||||||
first two arguments.
|
first two arguments.
|
||||||
@end defvar
|
@end defvar
|
||||||
|
|
||||||
Output of messages into the @file{*Messages*} buffer does not
|
Output of messages into the @file{*Messages*} buffer does not call
|
||||||
call these functions.
|
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{}
|
@defmac combine-after-change-calls body@dots{}
|
||||||
The macro executes @var{body} normally, but arranges to call the
|
The macro executes @var{body} normally, but arranges to call the
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue