unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 46982@debbugs.gnu.org, Ihor Radchenko <yantar92@gmail.com>
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)
Date: Wed, 29 Jun 2022 11:19:37 -0400	[thread overview]
Message-ID: <jwvy1xfpkgr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83letpjugf.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jun 2022 05:36:00 +0300")

>> >> 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
 






  reply	other threads:[~2022-06-29 15:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07  4:36 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) Ihor Radchenko
2022-06-17  2:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-17  5:42   ` Eli Zaretskii
2022-06-17 13:29     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-17 15:28       ` Eli Zaretskii
2022-06-21 20:21       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-21 23:29         ` Ihor Radchenko
2022-06-22  2:36           ` Eli Zaretskii
2022-06-29 15:19             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-06-29 16:08               ` Eli Zaretskii
2022-06-29 17:16                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-29 17:30                   ` Eli Zaretskii
2022-06-29 17:42                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-22 23:52           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvy1xfpkgr.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=46982@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=yantar92@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).