From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions ... Date: Sun, 1 Mar 2020 21:26:57 +0000 Message-ID: <20200301212657.GA5543@ACM> References: <20200223194642.5362.21709@vcs0.savannah.gnu.org> <20200223194643.A9A05206ED@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="38825"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: emacs-devel To: Mattias =?iso-8859-1?Q?Engdeg=E5rd?= , Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 01 22:27:35 2020 Return-path: Envelope-to: ged-emacs-devel@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 1j8W7Z-0009zH-K7 for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Mar 2020 22:27:33 +0100 Original-Received: from localhost ([::1]:51954 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8W7Y-0003Qe-N1 for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Mar 2020 16:27:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54946) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8W76-00031E-FH for emacs-devel@gnu.org; Sun, 01 Mar 2020 16:27:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j8W74-0007Iv-Bm for emacs-devel@gnu.org; Sun, 01 Mar 2020 16:27:04 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:51655 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1j8W74-0007Id-29 for emacs-devel@gnu.org; Sun, 01 Mar 2020 16:27:02 -0500 Original-Received: (qmail 39562 invoked by uid 3782); 1 Mar 2020 21:27:00 -0000 Original-Received: from acm.muc.de (p2E5D5E9B.dip0.t-ipconnect.de [46.93.94.155]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Mar 2020 22:26:57 +0100 Original-Received: (qmail 5555 invoked by uid 1000); 1 Mar 2020 21:26:57 -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 [fuzzy] X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245143 Archived-At: Hello, Mattias and Glenn. On Sun, Mar 01, 2020 at 12:49:39 +0100, Mattias Engdegård wrote: > 28 feb. 2020 kl. 17.54 skrev Glenn Morris : > >> CC Mode: Protect against consecutive calls to before-change-functions ... > > This causes srecode-utest-getset-output in > > test/lisp/cedet/srecode-utest-getset.el to fail: > Indeed, and so does electric-tests. Condensed reproduction: > (with-temp-buffer > (c-mode) > (insert "a") > (comment-region (point-min) (point-max))) > Alan, it looks like the code has lost control over c-new-END. > c-after-change over-adjusts it to a value beyond the buffer size. The > problem seems to go away with the expedient below but it is unlikely > to be the right solution. The cause of this bug is a bug in combine-change-calls-1 which shows itself when buffer-undo-list is t (as I presume it is for the with-temp-buffer). In this circumstance, the routine fails to bind before/after-change-functions to nil (or something close to it) before invoking combine-change-call's ,@body. So, we get two invocations of before-change-functions in a row, which fouls things up. I have tried a fix to combine-change-calls-1, and it appears to work. I will tidy it up and post it here soon (?tomorrow). -- Alan Mackenzie (Nuremberg, Germany).