unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: "Mattias Engdegård" <mattiase@acm.org>, "Glenn Morris" <rgm@gnu.org>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions ...
Date: Sun, 1 Mar 2020 21:26:57 +0000	[thread overview]
Message-ID: <20200301212657.GA5543@ACM> (raw)
In-Reply-To: <BDEB82C9-EE97-4C36-83A8-BBFA7425C90B@acm.org>

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 <rgm@gnu.org>:

> >>   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).



  reply	other threads:[~2020-03-01 21:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200223194642.5362.21709@vcs0.savannah.gnu.org>
     [not found] ` <20200223194643.A9A05206ED@vcs0.savannah.gnu.org>
2020-02-28 16:54   ` emacs-27 3bce7ec: CC Mode: Protect against consecutive calls to before-change-functions Glenn Morris
2020-03-01 11:49     ` Mattias Engdegård
2020-03-01 21:26       ` Alan Mackenzie [this message]
2020-03-04 21:30       ` Alan Mackenzie
2020-03-04 21:24     ` Alan Mackenzie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200301212657.GA5543@ACM \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=mattiase@acm.org \
    --cc=rgm@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).