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: Sun, 31 Jul 2016 22:26:34 +0300 Message-ID: <83vazlobh1.fsf@gnu.org> References: <20160731121642.GB2205@acm.fritz.box> <83a8gxq288.fsf@gnu.org> <20160731172804.GD2205@acm.fritz.box> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1469993276 18859 80.91.229.8 (31 Jul 2016 19:27:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 31 Jul 2016 19:27:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 31 21:27:42 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 1bTwOk-0004rY-1A for ged-emacs-devel@m.gmane.org; Sun, 31 Jul 2016 21:27:42 +0200 Original-Received: from localhost ([::1]:40594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTwOg-0003jr-0s for ged-emacs-devel@m.gmane.org; Sun, 31 Jul 2016 15:27:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40251) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTwO7-0003ji-TB for emacs-devel@gnu.org; Sun, 31 Jul 2016 15:27:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bTwO1-0008W6-T1 for emacs-devel@gnu.org; Sun, 31 Jul 2016 15:27:02 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60992) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bTwO1-0008Vu-Px; Sun, 31 Jul 2016 15:26:57 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:3916 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bTwNx-0004if-Mj; Sun, 31 Jul 2016 15:26:56 -0400 In-reply-to: (message from Stefan Monnier on Sun, 31 Jul 2016 14:55: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:206285 Archived-At: > From: Stefan Monnier > Date: Sun, 31 Jul 2016 14:55:32 -0400 > > > These hook variables let you arrange to take notice of ALL changes > > in ALL buffers. [My emphasis] > > > > Your interpretation of that seems to be that each buffer change will > > call _at least_ one of before-... and after-..., but not necessarily > > both. That doesn't seem sensible to me. > > 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"? We currently do the latter, i.e. call them only once. If you think that's incorrect, please explain why.