From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] emacs-26 671dc5a: Fix calls to buffer modification hooks from replace-buffer-contents
Date: Sat, 21 Jul 2018 16:46:47 -0400 [thread overview]
Message-ID: <jwvo9f0nwws.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <836018xvux.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 21 Jul 2018 21:54:46 +0300")
>> >> I don't understand enough of the code to have an opinion on it, but the
>> >> comments describe a behavior which would be wrong: both before-c-f and
>> >> after-c-f- need to be run for any buffer change, even if it's only an
>> >> insertion or only a deletion.
>> > What if there's no change at all, i.e. no deletions and no insertions?
>> Then you can either run neither of the hooks, or both.
> How can we determine whether to run neither or not?
You can roll a dice.
> I can easily run both, but is that TRT? It was you who requested not
> to run the hooks on a range that is larger than we can determine by
> looking at the results of compareseq.
Running both would not be a bug: it would be sub-optimal but not
incorrect (just like your original choice of running the hooks over the
whole buffer).
If it's easy to do the better choice is to do nothing.
> The recipe describes a case where "foo" is replaced by "foo", and the
> code in compareseq tells us not to change anything. There are no
> deletions and no insertions. Do we call the modification hooks in
> this case?
If we can refrain from calling them, it's better to do that.
But this thread is not about the case described in the bug-report, where
there's been no change.
It's about the text in the two comments you introduced: they say (or at
least can be interpreted to say) that the code may run only one of the
two hooks in some cases. If that text is a correct description of the
code, it means we have a bug in the code, and if not it means those
comments should be improved.
Stefan
next prev parent reply other threads:[~2018-07-21 20:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20180721180616.6608.26581@vcs0.savannah.gnu.org>
[not found] ` <20180721180618.5CEA9208D4@vcs0.savannah.gnu.org>
2018-07-21 18:16 ` [Emacs-diffs] emacs-26 671dc5a: Fix calls to buffer modification hooks from replace-buffer-contents Stefan Monnier
2018-07-21 18:22 ` Eli Zaretskii
2018-07-21 18:29 ` Stefan Monnier
2018-07-21 18:35 ` Eli Zaretskii
2018-07-21 18:44 ` Stefan Monnier
2018-07-21 18:54 ` Eli Zaretskii
2018-07-21 20:46 ` Stefan Monnier [this message]
2018-07-22 2:15 ` Richard Stallman
2018-07-22 2:43 ` Eli Zaretskii
2018-07-22 5:18 ` Stefan Monnier
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=jwvo9f0nwws.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=eliz@gnu.org \
--cc=emacs-devel@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 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.