From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs 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 Message-ID: References: <87h7lnk2by.fsf@localhost> <83pmj7q20m.fsf@gnu.org> <87sfnxppdq.fsf@localhost> <83letpjugf.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="891"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 46982@debbugs.gnu.org, Ihor Radchenko To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 29 17:20:23 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6ZUM-000AYg-Ha for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 17:20:22 +0200 Original-Received: from localhost ([::1]:47372 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6ZUK-0007LW-V4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jun 2022 11:20:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6ZU2-0007Kw-FF for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 11:20:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37738) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o6ZU2-0000OQ-6c for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 11:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o6ZU1-0006Iv-Vg for bug-gnu-emacs@gnu.org; Wed, 29 Jun 2022 11:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jun 2022 15:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46982 X-GNU-PR-Package: emacs Original-Received: via spool by 46982-submit@debbugs.gnu.org id=B46982.165651599524215 (code B ref 46982); Wed, 29 Jun 2022 15:20:01 +0000 Original-Received: (at 46982) by debbugs.gnu.org; 29 Jun 2022 15:19:55 +0000 Original-Received: from localhost ([127.0.0.1]:59868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6ZTu-0006IV-SN for submit@debbugs.gnu.org; Wed, 29 Jun 2022 11:19:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o6ZTq-0006IB-Sj for 46982@debbugs.gnu.org; Wed, 29 Jun 2022 11:19:53 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E7AE080625; Wed, 29 Jun 2022 11:19:44 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id E7E37805CE; Wed, 29 Jun 2022 11:19:42 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1656515982; bh=MEIKtMc6l4Al+izZPHcbVdxI2722tKPQtfY5D+pwPIM=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=b28306vJCG5AsUUffvItXGLcaAE0CuY+3ziD72nlHE8nH9OWIvDg/vjlbb2WeFiI7 7c5IANmZ4uYYny/2lThAiX3ue87iVdQW0PYj0rcqSXC5uV9gldw/tQMxVgXnzEuMuj 9DX81InQBbfIGhYPxZVq0gQtY2xsReCtOoCRjstec652R4red7yrEw89pFZ5iUfB0g 0Xn3dYIDgKHjqJxDdOWI/vx5vLD++CV3zIJ/ojiVyjrF4xYDdIzTbftbdKWcnHypZL +HeWsTC0433IZLXZKgcuTCCpplpS1IU+D1S2AQT/2uUt8OeTVliOS6caNSX+DFL6h6 Xs3LMwnuRu9ug== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id ACE7E1204B7; Wed, 29 Jun 2022 11:19:42 -0400 (EDT) In-Reply-To: <83letpjugf.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jun 2022 05:36:00 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:235644 Archived-At: >> >> 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