[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Ada-mode-users] Line number mismatch with cross-references
From: |
Stephen Leake |
Subject: |
Re: [Ada-mode-users] Line number mismatch with cross-references |
Date: |
Sun, 03 Sep 2017 19:21:21 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1.91 (windows-nt) |
Simon Wright <address@hidden> writes:
> After working on a file for a while, a mismatch develops between the
> line numbers reported by e.g. C-c C-r and where point ends up when you
> click on a reference. The reported line numbers are correct, but point
> is at a different line number.
I only see this when the cross-reference database is out of date, but
then "the reported line numbers" would not be correct.
Just to be clear; you have tried Ada | Misc | refresh cross reference
cache ?
Are you using gpr-query? I assume so.
> I think this may be related to the way that, when the fix for a
> compilation error involves adding lines, when you click on the next
> compilation error you end up in the right place.
(Ah; "click" - that's the problem. Mice are the root of all evil :).
That works because compilation-mode uses markers, which move with the text.
gpr-query uses compilation-mode to display the cross references, so that
works the same for xrefs.
It can get confused if you edit the buffer after gpr-query (or the
compiler) is run, but before the cross reference buffer is parsed by
compilation-mode. I have managed to do that many times with compiler
errors; I don't recall it happening with xrefs, but the mechanism is the
same.
That can happen when there are multiple files, and a lot of errors/xrefs
(so they are not all parsed at the beginning); you are looking at
errors/xrefs for file_1.adb, and in response you edit file_2.ads; then
when you get to the errors/xrefs for file_2.ads, the markers are in the
wrong place.
> Is there some hook related to this? or should I look at
> ada-goto-source in ada-mode.el?
I need a more precise recipe before I can comment further.
--
-- Stephe