aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-08-16 20:46:34 +0000
committerStefan Monnier2007-08-16 20:46:34 +0000
commitb9c520997ee12e698739c3faca9bf7532a1076f7 (patch)
tree300987cdb7737ab37a8feb77291c30ef2e3b81b0
parent44a0e58612792466d9277b253ead9c398b7bf714 (diff)
downloademacs-b9c520997ee12e698739c3faca9bf7532a1076f7.tar.gz
emacs-b9c520997ee12e698739c3faca9bf7532a1076f7.zip
*** empty log message ***
-rw-r--r--etc/NEWS5
-rw-r--r--lispref/text.texi36
2 files changed, 12 insertions, 29 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 3022ad99d30..f0e00c99eba 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -175,6 +175,11 @@ supported on other platforms, but not on Windows due to using the winsock
175 175
176* Lisp Changes in Emacs 23.1 176* Lisp Changes in Emacs 23.1
177 177
178+++
179** inhibit-modification-hooks is bound to t while running modification hooks.
180As a happy consequence, after-change-functions and before-change-functions
181are not bound to nil any more while running an (after|before)-change-function.
182
178** Non-breaking space now acts as whitespace. 183** Non-breaking space now acts as whitespace.
179 184
180+++ 185+++
diff --git a/lispref/text.texi b/lispref/text.texi
index b3cd6cb4a92..430c48133ee 100644
--- a/lispref/text.texi
+++ b/lispref/text.texi
@@ -4278,35 +4278,6 @@ because it may lead to inefficient behavior for some change hook
4278functions. 4278functions.
4279@end defmac 4279@end defmac
4280 4280
4281The two variables above are temporarily bound to @code{nil} during the
4282time that any of these functions is running. This means that if one of
4283these functions changes the buffer, that change won't run these
4284functions. If you do want a hook function to make changes that run
4285these functions, make it bind these variables back to their usual
4286values.
4287
4288One inconvenient result of this protective feature is that you cannot
4289have a function in @code{after-change-functions} or
4290@code{before-change-functions} which changes the value of that variable.
4291But that's not a real limitation. If you want those functions to change
4292the list of functions to run, simply add one fixed function to the hook,
4293and code that function to look in another variable for other functions
4294to call. Here is an example:
4295
4296@example
4297(setq my-own-after-change-functions nil)
4298(defun indirect-after-change-function (beg end len)
4299 (let ((list my-own-after-change-functions))
4300 (while list
4301 (funcall (car list) beg end len)
4302 (setq list (cdr list)))))
4303
4304@group
4305(add-hooks 'after-change-functions
4306 'indirect-after-change-function)
4307@end group
4308@end example
4309
4310@defvar first-change-hook 4281@defvar first-change-hook
4311This variable is a normal hook that is run whenever a buffer is changed 4282This variable is a normal hook that is run whenever a buffer is changed
4312that was previously in the unmodified state. 4283that was previously in the unmodified state.
@@ -4318,6 +4289,13 @@ disabled; none of them run. This affects all the hook variables
4318described above in this section, as well as the hooks attached to 4289described above in this section, as well as the hooks attached to
4319certain special text properties (@pxref{Special Properties}) and overlay 4290certain special text properties (@pxref{Special Properties}) and overlay
4320properties (@pxref{Overlay Properties}). 4291properties (@pxref{Overlay Properties}).
4292
4293Also, this variable is bound to non-@code{nil} while running those
4294same hook variables, so that by default modifying the buffer from
4295a modification hook does not cause other modification hooks to be run.
4296If you do want modification hooks to be run in a particular piece of
4297code that is itself run from a modification hook, then rebind locally
4298@code{inhibit-modification-hooks} to @code{nil}.
4321@end defvar 4299@end defvar
4322 4300
4323@ignore 4301@ignore