unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is there a package which uses markers to guess how to remap line  numbers?
@ 2009-11-19 13:02 rocky
  2009-11-19 15:25 ` despen
  2009-11-19 15:39 ` Scott Frazer
  0 siblings, 2 replies; 5+ messages in thread
From: rocky @ 2009-11-19 13:02 UTC (permalink / raw)
  To: help-gnu-emacs

I am writing a package (an interface to debuggers) that sets markers
on various lines (e.g. the lines at which the debugger stops at). Over
time, the buffer (source code) can change and the markers move around
with that. This is good.

Is there however a package which will suggest after buffer
modification how a particular line number might have changed given the
existing marker information and associated line number information for
that buffer?

Here is a concrete example. Let's say I have a buffer with a marker at
lines 1, 5, 10 and 20. Let's say the marker for 10 moves to line 11
after modification but not the one for 1, 5 or 20.

If I ask about lines in the range 2-4, I may warn that overall the
buffer has changed but possibly not the one in that range. Of course
if I ask about lines 1, 5, or 20, I can warn that although the buffer
has changed, (parts of) those lines haven't. If I ask about a line in
the range 6-19 I can suggest there may be a move ahead a line with
more certainty of line 10.

Has anyone thought about this problem. Does such a package exist or
has anything like this been done as part of an existing package?

Thanks.



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

* Re: Is there a package which uses markers to guess how to remap line numbers?
  2009-11-19 13:02 Is there a package which uses markers to guess how to remap line numbers? rocky
@ 2009-11-19 15:25 ` despen
  2009-11-20  2:10   ` rocky
  2009-11-19 15:39 ` Scott Frazer
  1 sibling, 1 reply; 5+ messages in thread
From: despen @ 2009-11-19 15:25 UTC (permalink / raw)
  To: help-gnu-emacs

rocky <rocky@gnu.org> writes:

> I am writing a package (an interface to debuggers) that sets markers
> on various lines (e.g. the lines at which the debugger stops at). Over
> time, the buffer (source code) can change and the markers move around
> with that. This is good.
>
> Is there however a package which will suggest after buffer
> modification how a particular line number might have changed given the
> existing marker information and associated line number information for
> that buffer?
>
> Here is a concrete example. Let's say I have a buffer with a marker at
> lines 1, 5, 10 and 20. Let's say the marker for 10 moves to line 11
> after modification but not the one for 1, 5 or 20.
>
> If I ask about lines in the range 2-4, I may warn that overall the
> buffer has changed but possibly not the one in that range. Of course
> if I ask about lines 1, 5, or 20, I can warn that although the buffer
> has changed, (parts of) those lines haven't. If I ask about a line in
> the range 6-19 I can suggest there may be a move ahead a line with
> more certainty of line 10.
>
> Has anyone thought about this problem. Does such a package exist or
> has anything like this been done as part of an existing package?

Part of the compile package does something like that.
As you do "next-error" it accounts for any fixes you may have made
for previous errors.


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

* Re: Is there a package which uses markers to guess how to remap line numbers?
  2009-11-19 13:02 Is there a package which uses markers to guess how to remap line numbers? rocky
  2009-11-19 15:25 ` despen
@ 2009-11-19 15:39 ` Scott Frazer
  2009-11-20  2:23   ` rocky
  1 sibling, 1 reply; 5+ messages in thread
From: Scott Frazer @ 2009-11-19 15:39 UTC (permalink / raw)
  To: help-gnu-emacs

rocky wrote:
> I am writing a package (an interface to debuggers) that sets markers
> on various lines (e.g. the lines at which the debugger stops at). Over
> time, the buffer (source code) can change and the markers move around
> with that. This is good.
> 
> Is there however a package which will suggest after buffer
> modification how a particular line number might have changed given the
> existing marker information and associated line number information for
> that buffer?
> 
> Here is a concrete example. Let's say I have a buffer with a marker at
> lines 1, 5, 10 and 20. Let's say the marker for 10 moves to line 11
> after modification but not the one for 1, 5 or 20.
> 
> If I ask about lines in the range 2-4, I may warn that overall the
> buffer has changed but possibly not the one in that range. Of course
> if I ask about lines 1, 5, or 20, I can warn that although the buffer
> has changed, (parts of) those lines haven't. If I ask about a line in
> the range 6-19 I can suggest there may be a move ahead a line with
> more certainty of line 10.
> 
> Has anyone thought about this problem. Does such a package exist or
> has anything like this been done as part of an existing package?
> 

What I have done for something similar is when the buffer is saved (or 
modified or whatever in your case) that I simply blow away all 
information that I am keeping about line numbers in this buffer and 
repopulate it by iterating over the markers (overlays in my case) and 
putting in the new line numbers.

Scott


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

* Re: Is there a package which uses markers to guess how to remap line numbers?
  2009-11-19 15:25 ` despen
@ 2009-11-20  2:10   ` rocky
  0 siblings, 0 replies; 5+ messages in thread
From: rocky @ 2009-11-20  2:10 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 19, 10:25 am, des...@verizon.net wrote:
> rocky <ro...@gnu.org> writes:
> > I am writing a package (an interface to debuggers) that sets markers
> > on various lines (e.g. the lines at which the debugger stops at). Over
> > time, the buffer (source code) can change and the markers move around
> > with that. This is good.
>
> > Is there however a package which will suggest after buffer
> > modification how a particular line number might have changed given the
> > existingmarkerinformation and associated line number information for
> > that buffer?
>
> > Here is a concrete example. Let's say I have a buffer with amarkerat
> > lines 1, 5, 10 and 20. Let's say themarkerfor 10 moves to line 11
> > after modification but not the one for 1, 5 or 20.
>
> > If I ask about lines in the range 2-4, I may warn that overall the
> > buffer has changed but possibly not the one in that range. Of course
> > if I ask about lines 1, 5, or 20, I can warn that although the buffer
> > has changed, (parts of) those lines haven't. If I ask about a line in
> > the range 6-19 I can suggest there may be a move ahead a line with
> > more certainty of line 10.
>
> > Has anyone thought about this problem. Does such a package exist or
> > has anything like this been done as part of an existing package?
>
> Part of the compile package does something like that.
> As you do "next-error" it accounts for any fixes you may have made
> for previous errors.

Thanks for the suggestion.

I looked at compile.el. It seems to be to parse all of the error
messages in the compilation buffer and set markers for each of those
locations referred to. That is why it can track edits.

The difference here is that we are interactive, so I don't know in
advance all of the lines that might be stopped at.

Assuming a debugger that only reports line positions and nothing finer
grained, I could set marks at every line in the file, or better sets
marks at every stoppable line in the file (i.e. the lines that you can
set a breakpoint on). However I suspect that will be too slow and/or
use lots of memory.

But perhaps not - we'll see.


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

* Re: Is there a package which uses markers to guess how to remap line numbers?
  2009-11-19 15:39 ` Scott Frazer
@ 2009-11-20  2:23   ` rocky
  0 siblings, 0 replies; 5+ messages in thread
From: rocky @ 2009-11-20  2:23 UTC (permalink / raw)
  To: help-gnu-emacs

On Nov 19, 10:39 am, Scott Frazer <frazer.sc...@gmail.com> wrote:
> rocky wrote:
> > I am writing a package (an interface to debuggers) that sets markers
> > on various lines (e.g. the lines at which the debugger stops at). Over
> > time, the buffer (source code) can change and the markers move around
> > with that. This is good.
>
> > Is there however a package which will suggest after buffer
> > modification how a particular line number might have changed given the
> > existingmarkerinformation and associated line number information for
> > that buffer?
>
> > Here is a concrete example. Let's say I have a buffer with amarkerat
> > lines 1, 5, 10 and 20. Let's say themarkerfor 10 moves to line 11
> > after modification but not the one for 1, 5 or 20.
>
> > If I ask about lines in the range 2-4, I may warn that overall the
> > buffer has changed but possibly not the one in that range. Of course
> > if I ask about lines 1, 5, or 20, I can warn that although the buffer
> > has changed, (parts of) those lines haven't. If I ask about a line in
> > the range 6-19 I can suggest there may be a move ahead a line with
> > more certainty of line 10.
>
> > Has anyone thought about this problem. Does such a package exist or
> > has anything like this been done as part of an existing package?
>
> What I have done for something similar is when the buffer is saved (or
> modified or whatever in your case) that I simply blow away all
> information that I am keeping about line numbers in this buffer and
> repopulate it by iterating over the markers (overlays in my case) and
> putting in the new line numbers.
>
> Scott

Thanks for your thoughts.

I think this situation is a little bit different in this regard: there
is an external program (e.g. a debugger) that has its notion the line/
position structure of the source; that is immutable (generally) over
the course of execution. So the problem is not that I want to store or
retrieve an up-to-date line number with a marker, I can easily get
using (line-number-at-pos) using the marker. Rather, I want map the
original line numbers that say a debugger reports interactively to the
corresponding line number in a modified file.

As I posted previously, rather than try to interpolate what the
original line numbers were, perhaps I need put a mark on every line or
on the possible stoppable lines. I am not sure though I would ever
want to update the original line number information since (generally)
the external program isn't going to change its line number
information.


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

end of thread, other threads:[~2009-11-20  2:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19 13:02 Is there a package which uses markers to guess how to remap line numbers? rocky
2009-11-19 15:25 ` despen
2009-11-20  2:10   ` rocky
2009-11-19 15:39 ` Scott Frazer
2009-11-20  2:23   ` rocky

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