From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) Date: Mon, 01 Aug 2016 16:09:58 +0300 Message-ID: <83r3a8oct5.fsf@gnu.org> References: <20160731121642.GB2205@acm.fritz.box> <83a8gxq288.fsf@gnu.org> <20160731172804.GD2205@acm.fritz.box> <83vazlobh1.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1470057052 8353 80.91.229.8 (1 Aug 2016 13:10:52 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2016 13:10:52 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 01 15:10:37 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUCzM-0001m6-Mf for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2016 15:10:36 +0200 Original-Received: from localhost ([::1]:50200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUCzI-00029K-PZ for ged-emacs-devel@m.gmane.org; Mon, 01 Aug 2016 09:10:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35743) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUCz5-00020X-Ic for emacs-devel@gnu.org; Mon, 01 Aug 2016 09:10:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUCz0-0005Nm-Ka for emacs-devel@gnu.org; Mon, 01 Aug 2016 09:10:18 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUCz0-0005NT-IE; Mon, 01 Aug 2016 09:10:14 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4733 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bUCyy-0008CW-Ka; Mon, 01 Aug 2016 09:10:13 -0400 In-reply-to: (message from Stefan Monnier on Sun, 31 Jul 2016 17:59:32 -0400) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:206304 Archived-At: > From: Stefan Monnier > Cc: emacs-devel@gnu.org > Date: Sun, 31 Jul 2016 17:59:32 -0400 > > >> I fully agree that if you only use before-change-functions (or only use > >> after-change-functions), your hook function should see *all* changes. > > The change in question is a replacement. Emacs implements > > replacements by a deletion followed by an insertion. The question is: > > do we need to call the before-change-functions for both the deletion > > and the insertion, or do we need to call them only once for the > > "replacement"? > > Either way is fine, according to my interpretation of "should see *all* > changes". Then I think we are fine, give or take a couple of minor changes that might be needed in insert-file-contents. Btw, it looks like insert-file-contents deliberately doesn't call before-change-functions if nothing was inserted, even if some text was deleted. I wonder why. The way the code is written, it cannot be a coincidence.