From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions ... Date: Sun, 1 Mar 2020 12:49:39 +0100 Message-ID: References: <20200223194642.5362.21709@vcs0.savannah.gnu.org> <20200223194643.A9A05206ED@vcs0.savannah.gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="11952"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Glenn Morris , emacs-devel To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 01 13:10:58 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 1j8NQv-00030q-SP for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Mar 2020 13:10:57 +0100 Original-Received: from localhost ([::1]:48040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8NQu-0006rq-V5 for ged-emacs-devel@m.gmane-mx.org; Sun, 01 Mar 2020 07:10:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60238) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8NQK-0006Ia-Mz for emacs-devel@gnu.org; Sun, 01 Mar 2020 07:10:21 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j8NQJ-00054T-7J for emacs-devel@gnu.org; Sun, 01 Mar 2020 07:10:20 -0500 Original-Received: from mail1448c50.megamailservers.eu ([91.136.14.48]:40706 helo=mail265c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j8NQI-00054M-Mf; Sun, 01 Mar 2020 07:10:19 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1583063382; bh=51bOvgY2Q6uMH2oktys9Oe/kHqjmERkjHv9Up2j4qQY=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=XcfPsUsF/fMrBR2a461cKZTxwQL/Y6lsU8M4yuFcKk2qWGXIT1O10WnAbSHtW+TMi xkiQvpjGHZgg9+GjdlnVtQ3pqIbiAuoYIEvodMnZHUef0BsKeUnUtUHI3qLPFt69SW jdv3YtPN41S7QLMBK1bCxWkuJIvlQkWZZyhVh9C8= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 021BndOP030946; Sun, 1 Mar 2020 11:49:41 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A782F28.5E5BA153.002F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=YIzhNiOx c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=QB_9JKoXlqa0V6Vs3cUA:9 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] X-Received-From: 91.136.14.48 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:245139 Archived-At: 28 feb. 2020 kl. 17.54 skrev Glenn Morris : >> CC Mode: Protect against consecutive calls to = before-change-functions ... >=20 > 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. --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el @@ -2006,7 +2006,8 @@ c-after-change =20 ;; (c-new-BEG c-new-END) will be the region to fontify. It may = become ;; larger than (beg end). - (setq c-new-END (- (+ c-new-END (- end beg)) old-len)) + (setq c-new-END (min (- (+ c-new-END (- end beg)) old-len) + (point-max))) =20 (unless (c-called-from-text-property-change-p) (setq c-just-done-before-change nil)