unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications
@ 2010-02-22 15:48 Paul Pogonyshev
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Pogonyshev @ 2010-02-22 15:48 UTC (permalink / raw)
  To: 5620

When hitting C-x ` (next-error) the point is positioned correctly only
if the buffer is not modified.  If number of lines before the target
position is changed, point is positioned wrongly.

For instance, say 'test.txt' contains these lines:

    foo
    bar
    baz

I then run 'grep' from Emacs like this:

    grep -nH -e ba test.txt

Results:

    -*- mode: grep; default-directory: "/home/paul/test/" -*-
    Grep started at Mon Feb 22 17:41:30

    grep -nH -e ba test.txt
    test.txt:2:bar
    test.txt:3:baz

    Grep finished (matches found) at Mon Feb 22 17:41:30

Then I insert a few more lines in 'test.txt' buffer:

    foo
    bar
    spam
    ham
    baz

Now if I hit C-x ` the first time point is moved to line 2 --
correctly.  The second time, however, the point is moved to line 3,
i.e. the original location of 'baz'.  However, 'baz' is now at line 5
and that's where I expect C-x ` to move point to.  Note that at no
point I closed the buffer, so Emacs should be able to track changes
between 'grep' run and current buffer/file contents.

This is especially unhelpful with compilation errors.  Often, you'd go
through errors fixing them in process, sometimes adding or removing
lines.  However, any such change makes finding subsequent errors
difficult as C-x ` will no longer locate errors correctly.

I believe this used to work fine in past.

Paul







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications
       [not found] <201004281805.58350.p.pogonyshev@anakreon.net>
@ 2021-12-04 21:00 ` Lars Ingebrigtsen
  2022-01-21 13:47   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-12-04 21:00 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 5620

Paul Pogonyshev <p.pogonyshev@anakreon.net> 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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications
  2021-12-04 21:00 ` bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications Lars Ingebrigtsen
@ 2022-01-21 13:47   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-01-21 13:47 UTC (permalink / raw)
  To: Paul Pogonyshev; +Cc: 5620

Lars Ingebrigtsen <larsi@gnus.org> writes:

> 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?

Nobody had an opinion in a month, so I think we'll keep the current
semantics, and I'm closing this bug report.

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-21 13:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201004281805.58350.p.pogonyshev@anakreon.net>
2021-12-04 21:00 ` bug#5620: 23.1.92.1; next-error no longer takes into account buffer modifications Lars Ingebrigtsen
2022-01-21 13:47   ` Lars Ingebrigtsen
2010-02-22 15:48 Paul Pogonyshev

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