Subject: bug#46982: 28.0.50; after-change-functions in an indirect buffer are not called if the change is done while base buffer is active (and vice versa)

From: Stefan Monnier <[email-masked]>
Date: Wed, 29 Jun 2022 11:19:37 -0400

>> >> It might be a good thing to mention somewhere around
>> >> `clone-buffer`, yes.  I'll see what I can come up with.
>> > Hmm... we don't document `clone-buffer` anywhere that I can see.
>> > Any suggestion where I could put that kind of info?
>> `clone-indirect-buffer' I think. For example, in 19.6 Indirect Buffers
>> section of the manual.
> Yes, there, please.

How does the patch below sound to you?

        Stefan

diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 94e9d2760ec..c07f3990ee8 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -616,10 +616,11 @@ Indirect Buffers
 
   The text of the indirect buffer is always identical to the text of its
 base buffer; changes made by editing either one are visible immediately
-in the other.  But in all other respects, the indirect buffer and its
+in the other.  ``Text'' here includes both the characters and their text
+properties.  But in all other respects, the indirect buffer and its
 base buffer are completely separate.  They can have different names,
 different values of point, different narrowing, different markers,
-different major modes, and different local variables.
+different overlays, different major modes, and different local variables.
 
   An indirect buffer cannot visit a file, but its base buffer can.  If
 you try to save the indirect buffer, that actually works by saving the
@@ -649,6 +650,14 @@ Indirect Buffers
 When this hook runs, the newly created indirect buffer is the current
 buffer.
 
+Note: When a modification is made to the text of a buffer, the
+modification hooks are only run in the base buffer, because most of
+the functions on those hooks are not prepared to work correctly in
+indirect buffers.  So if you need a modification hook function in an
+indirect buffer, you need to manually add that function to the hook
+@emph{in the base buffer} and then make the function operate in the
+desired indirect buffer.
+
 @node Buffer Convenience
 @section Convenience Features and Customization of Buffer Handling