From: Richard Copley <rcopley@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: "Óscar Fuentes" <ofv@wanadoo.es>, "Alan Mackenzie" <acm@muc.de>,
"Emacs Development" <emacs-devel@gnu.org>
Subject: Re: Unbalanced change hooks (part 1)
Date: Tue, 2 Aug 2016 10:19:47 +0100 [thread overview]
Message-ID: <CAPM58og2kvbUKjZ3imCb-rbCGqKyghwAq2YpdCeQX=t2FrqFbg@mail.gmail.com> (raw)
In-Reply-To: <8337mnoq4x.fsf@gnu.org>
On 2 August 2016 at 03:34, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Richard Copley <rcopley@gmail.com>
>> Date: Mon, 1 Aug 2016 21:13:01 +0100
>> Cc: Óscar Fuentes <ofv@wanadoo.es>,
>> Emacs Development <emacs-devel@gnu.org>
>>
>> > diff --git a/src/fileio.c b/src/fileio.c
>> > index b1f9d3c..0431cbc 100644
>> > --- a/src/fileio.c
>> > +++ b/src/fileio.c
>> > @@ -3440,6 +3440,7 @@ by calling `format-decode', which see. */)
>> > /* SAME_AT_END_CHARPOS counts characters, because
>> > restore_window_points needs the old character count. */
>> > ptrdiff_t same_at_end_charpos = ZV;
>> > + bool run_change_hooks;
>> >
>> > if (current_buffer->base_buffer && ! NILP (visit))
>> > error ("Cannot do file visiting in an indirect buffer");
>> > @@ -4077,7 +4078,9 @@ by calling `format-decode', which see. */)
>> > /* For a special file, all we can do is guess. */
>> > total = READ_BUF_SIZE;
>> >
>> > - if (NILP (visit) && total > 0)
>> > + run_change_hooks = ((NILP (visit) || !NILP (replace))
>> > + && total > 0);
>> > + if (run_change_hooks)
>> > {
>> > if (!NILP (BVAR (current_buffer, file_truename))
>> > /* Make binding buffer-file-name to nil effective. */
>> > @@ -4313,8 +4316,7 @@ by calling `format-decode', which see. */)
>> > /* Call after-change hooks for the inserted text, aside from the case
>> > of normal visiting (not with REPLACE), which is done in a new buffer
>> > "before" the buffer is changed. */
>> > - if (inserted > 0 && total > 0
>> > - && (NILP (visit) || !NILP (replace)))
>> > + if (run_change_hooks)
>> > {
>> > signal_after_change (PT, 0, inserted);
>> > update_compositions (PT, PT, CHECK_BORDER);
>> >
>> >
>> > Unfortunately, this amendment, by itself, doesn't fix #240[79]4, since
>> > there are other causes for the change hooks being improperly invoked.
>> >
>> > --
>> > Alan Mackenzie (Nuremberg, Germany).
>>
>> LGTM. It's hard to imagine anyone relying on the before-change hooks
>> _not_ being run, so it should be safe, at least, to make this change.
>
> That code is almost never run when REPLACE is non-nil, so doing that
> won't help. See an earlier message that explained why.
Thanks Eli, I saw it. It's not the sort of discussion I care to get involved in.
prev parent reply other threads:[~2016-08-02 9:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-31 10:16 Unbalanced change hooks (part 1) Alan Mackenzie
2016-08-01 20:13 ` Richard Copley
2016-08-02 2:34 ` Eli Zaretskii
2016-08-02 9:19 ` Richard Copley [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAPM58og2kvbUKjZ3imCb-rbCGqKyghwAq2YpdCeQX=t2FrqFbg@mail.gmail.com' \
--to=rcopley@gmail.com \
--cc=acm@muc.de \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=ofv@wanadoo.es \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.