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: Mon, 8 Aug 2016 20:16:13 +0000 Message-ID: <20160808201613.GE7208@acm.fritz.box> References: <20160731121642.GB2205@acm.fritz.box> <20160802101549.GA2328@acm.fritz.box> <83r3a7md69.fsf@gnu.org> <20160802165545.GD2328@acm.fritz.box> <83fuqnm6og.fsf@gnu.org> <20160802190024.GE2328@acm.fritz.box> <83d1lrm0qu.fsf@gnu.org> <20160807211626.GA3690@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1470687426 2875 195.159.176.226 (8 Aug 2016 20:17:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 8 Aug 2016 20:17:06 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 08 22:17:02 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 1bWqys-0000bJ-II for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2016 22:17:02 +0200 Original-Received: from localhost ([::1]:59542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWqyp-0002Sf-GI for ged-emacs-devel@m.gmane.org; Mon, 08 Aug 2016 16:16:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWqyk-0002Sa-5x for emacs-devel@gnu.org; Mon, 08 Aug 2016 16:16:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bWqyf-0002yF-Sk for emacs-devel@gnu.org; Mon, 08 Aug 2016 16:16:53 -0400 Original-Received: from mail.muc.de ([193.149.48.3]:41875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bWqyf-0002yB-J1 for emacs-devel@gnu.org; Mon, 08 Aug 2016 16:16:49 -0400 Original-Received: (qmail 52520 invoked by uid 3782); 8 Aug 2016 20:16:47 -0000 Original-Received: from acm.muc.de (p4FC46EDC.dip0.t-ipconnect.de [79.196.110.220]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 08 Aug 2016 22:16:45 +0200 Original-Received: (qmail 10610 invoked by uid 1000); 8 Aug 2016 20:16:13 -0000 Content-Disposition: inline In-Reply-To: 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:206498 Archived-At: Hello, Stefan On Mon, Aug 08, 2016 at 03:56:24PM -0400, Stefan Monnier wrote: > > If it is indeed the case, then a solution to the problem would be to > > check that before- and after-c-f are called alternately. Any time > > after-c-f is called twice in a row, we could reverse the change just made > > (using the undo list), invoke before-c-f, redo the change, then let > > after-c-f continue to completion. If necessary, we can temporarily > Sounds like piling up workarounds to make up for a mistake in the > underlying design. I couldn't agree more! Anyway, we've now got what is surely a satisfactory solution: in the event of a missing call to before-change-functions, assume that the entirety of the buffer has changed (which is not far from the truth, given that it happens on a `revert-buffer') and run c-{before,after}-change on this basis. See the patch in my latest post to Eli. This switches off some of the optimisations intended for revert-buffer, but these seem no longer quite so pressing, given that reverting xdisp.c, even with my latest patch, takes less than 0.2s on my 7 y.o. machine; 20 years ago, things would have been different. > Stefan -- Alan Mackenzie (Nuremberg, Germany).