From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Unbalanced change hooks (part 2) Date: Tue, 9 Aug 2016 15:01:32 +0000 Message-ID: <20160809150132.GB4893@acm.fritz.box> References: <20160731121642.GB2205@acm.fritz.box> <83a8gxq288.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1470754951 18709 195.159.176.226 (9 Aug 2016 15:02:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 Aug 2016 15:02:31 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: ofv@wanadoo.es, rcopley@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 09 17:02:24 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 1bX8Xv-0004eX-Je for ged-emacs-devel@m.gmane.org; Tue, 09 Aug 2016 17:02:23 +0200 Original-Received: from localhost ([::1]:36075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX8Xs-0003KG-D6 for ged-emacs-devel@m.gmane.org; Tue, 09 Aug 2016 11:02:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX8Xl-0003K9-CD for emacs-devel@gnu.org; Tue, 09 Aug 2016 11:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bX8Xg-0005Wm-GS for emacs-devel@gnu.org; Tue, 09 Aug 2016 11:02:12 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:44162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX8Xg-0005WU-70 for emacs-devel@gnu.org; Tue, 09 Aug 2016 11:02:08 -0400 Original-Received: (qmail 877 invoked by uid 3782); 9 Aug 2016 15:02:06 -0000 Original-Received: from acm.muc.de (p4FC46C02.dip0.t-ipconnect.de [79.196.108.2]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 09 Aug 2016 17:02:04 +0200 Original-Received: (qmail 6235 invoked by uid 1000); 9 Aug 2016 15:01:32 -0000 Content-Disposition: inline In-Reply-To: <83a8gxq288.fsf@gnu.org> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x X-Received-From: 193.149.48.3 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:206504 Archived-At: Hello, Eli. On Sun, Jul 31, 2016 at 06:03:19PM +0300, Eli Zaretskii wrote: > > Date: Sun, 31 Jul 2016 12:16:42 +0000 > > From: Alan Mackenzie > > Cc: Óscar Fuentes , > > Richard Copley > > I propose that the call to signal_before_change should be removed from > > prepare_to_modify_buffer, and that it should be called explicitly from > > the places it is needed. This would allow bug #240[79]4 to be fixed. > > Comments? > Some. > First, I don't agree with your conclusion that calls to > before-change-functions and after-change-functions must always be > balanced. For starters, they aren't, and never have been. I don't think this is true. A data point is that in XEmacs's insdel.c (which is quite a bit simpler than Emacs's) the calls to b-c-f and a-c-f are balanced. Bug #24049 doesn't trigger on XEmacs. I think it's likely this balance existed in Emacs until some time after the Lucid Emacs fork. My guess is that originally these hooks were _intended_ to be balanced (as they still are, at least to a very great extent, on XEmacs). At some stage (probably in the late 1990s/early 2000s) optimisations were made in insdel.c and elsewhere, and the strict pairing of b-c-f and a-c-f got lost in the wash. At that time, very little, if anything, used b-c-f, hence there was nothing to signal alarm bells during the testing of the optimisations. As I said, that's my guess. I've tried searching the emacs-devel archive for early discussions on the topic, but not found anything. [ .... ] -- Alan Mackenzie (Nuremberg, Germany).