Ludovic Brenta <[email protected]> writes:

> With ada-mode 5.0.1:
>
> 1. Create a new file, a.ads with the following contents:
>
> package A is
>    procedure Aa;
> end A;
>
> 2. Do ff-find-other-file (C-c o); this creates a nice skeleton for
> a.adb.  This body contains a body for procedure Aa.

As Georg noted, C-c C-o is the default binding for ada-find-other-file.
On the other hand, C-c C-d is the default binding for
ada-goto-declaration; which function are you using?

Also, you need a project file selected at this point, to set the file
search path.

> 3. Compile a.adb to get an .ali file.  Ignore the warnings.
>
> 4. In a.adb, comment out procedure Aa entirely (M-;).
>
> 5. Save a.adb but do not recompile.
>
> 6. In a.ads, place point anywhere and hit C-c o again.
>
> emacs enters what looks like an infinite loop; only C-g allows you
> to regain control.

This is because ada-set-point-accordingly is looking for a body that
is not in a comment. It needs to terminate on end of buffer.

Here's a patch:

--- ada-mode.el da7274b40a4e10086ec62dea594529d6a9e83eba
+++ ada-mode.el 3d26c0162977574587d6b29d3ded2d0c7f259075
@@ -1838,8 +1838,10 @@ previously set by a file navigation comm
       ;; This will still be confused by multiple references; we need
       ;; to use compiler cross reference info for more precision.
       (while (not done)
-       (when (search-forward-regexp ff-function-name nil t)
-         (setq found (match-beginning 0)))
+       (if (search-forward-regexp ff-function-name nil t)
+           (setq found (match-beginning 0))
+         ;; not in remainder of buffer
+         (setq done t))
        (if (ada-in-string-or-comment-p)
            (setq found nil)
          (setq done t)))

>The infinite loop is not reproducible if:
> - the procedure Aa is deleted entirely, rather than commented out,
>   in a.adb;
> - the procedure Aa is renamed in a.adb;

These are because the body is not found in the first place

> - the package body has never been compiled before.

because there is no cross reference info. But that only affects
ada-goto-declaration, not ada-find-other-file. However,
ada-goto-declaration doesn't call ada-set-point-accordingly. So I'm
confused.

> PS. I see that ada-mode uses the emacs bug tracking system which is
> essentially the same as the Debian bug tracking system :)  Should I
> report this bug there even though GNU emacs still ships by default
> with ada-mode 4?

As far as I'm concerned, this forum is adequate for bug reports. But it
doesn't hurt to use the Emacs bug tracker; just be sure to put the Ada
mode version in the bug report. I don't get automatic notice of a bug
report from the bug tracker, but I do check it for each release.

Hmm, I don't discuss bug reports in ada-mode.texi; I'll add that.

I'm hoping to mark Emacs Ada mode 4.0 obsolete in the next Emacs
release.

--
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to