comp.lang.ada
 help / color / mirror / Atom feed
* References in error message for use with Emacs.
@ 2002-01-14 16:38 Matthieu Moy
  2002-01-14 17:06 ` Jean-Pierre Rosen
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Moy @ 2002-01-14 16:38 UTC (permalink / raw)


I use gnat as a compiler and Emacs as editor. Error messages like 

list_brackets.adb:46:07: not type conformant with declaration at list_brackets.ads:22

Bored me because Emacs could only show me the reference in the
begining of line, and not the declaration referenced at the end.

I wrote a small wrapper for that (for unix) :

The directory ~/bin must be in the begining of the path. Then, put an
executable file in this directory containg the following code:

#!/bin/sh
# This is a small wrapper for gnatgcc. It adds some lines when a
# reference is cited in an error message, such as
#
# list_brackets.adb:31:18: left operand has type "Ptr_String" defined at basic_types.ads:16
#
# Who becomes
#
#
# list_brackets.adb:31:18: left operand has type "Ptr_String" defined at basic_types.ads:16
# basic_types.ads:16: (Reference cited in previous line)
#
/usr/bin/gnatgcc "$@" 2>&1 | sed 's/^\([^:]*:.* \([^ ]*\.ad[bs]:[0-9]*\).*\)$/\1\
\2: (Reference cited in previous line)/g'

and from now, gnatmake will show this kind of error messages :

list_brackets.adb:46:07: not type conformant with declaration at list_brackets.ads:22
list_brackets.ads:22: (Reference cited in previous line)

and Emacs can lead you to both references.

May I suggest, if this is not the case, that the next versions of gnat
give this kind of message without any wrapper (as gcc does for C) ?

-- 
| Matthieu MOY



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

* Re: References in error message for use with Emacs.
  2002-01-14 16:38 References in error message for use with Emacs Matthieu Moy
@ 2002-01-14 17:06 ` Jean-Pierre Rosen
  0 siblings, 0 replies; 2+ messages in thread
From: Jean-Pierre Rosen @ 2002-01-14 17:06 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 777 bytes --]


"Matthieu Moy" <MatthieumNOSPAM@yahoo.com> a �crit dans le message news: vpq6664ubuj.fsf@ubaye.imag.fr...
> I use gnat as a compiler and Emacs as editor. Error messages like
>
> list_brackets.adb:46:07: not type conformant with declaration at list_brackets.ads:22
>
> Bored me because Emacs could only show me the reference in the
> begining of line, and not the declaration referenced at the end.
>
> I wrote a small wrapper for that (for unix) :
>
Nice try, but you didn't need to.
Just click with the middle button on the reference, Emacs will get you there (assuming you are using a recent version of the Ada
mode).

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





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

end of thread, other threads:[~2002-01-14 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-14 16:38 References in error message for use with Emacs Matthieu Moy
2002-01-14 17:06 ` Jean-Pierre Rosen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox