Subject: bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications

From: Lars Ingebrigtsen <[email-masked]>
Date: Sat, 04 Dec 2021 22:00:20 +0100

Paul Pogonyshev <[email-masked]> writes:

> I wonder if the supposed fix was checked at all.  It fixes neither the
> original test case in the bug report, nor compilation error messages.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

The problem (as demonstrated by the original test case) is still present
in Emacs to this day.  But it does seem to work sometimes, in my vague
recollection?  Let's see...

Right, this is supposed to work by setting markers in the buffers where
you have the hits, so if you change the buffer in a way that doesn't
make the markers move, then you'll get the wrong line.

In this case:

foo
bar
baz

The marker is a 9, the start of the "baz" line.  Then we yank two lines:

foo
bar
spam
ham
baz

But this doesn't make the "baz" marker move -- we're inserting before
that marker.

So I'm not sure how this could be fixed in general, as this is just the
way markers work.  We could set the marker on the second char of the
line, perhaps, and that'd be marginally less likely to have this effect
(since people commonly insert new lines), but that seems like a pretty
gross hack.

So I don't know what, if anything, could be done here.  Anybody?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no