[Mono-dev] gmcs output differing from shell and emacs (through make and xbuild)
Mads Bondo Dydensborg
mbd at dbc.dk
Thu Oct 19 08:20:39 EDT 2006
tirsdag 17 oktober 2006 22:42 skrev Miguel de Icaza:
> > gmcs alone => line + column
> > xbuild -> gmcs => line + column
> > emacs -> gmcs => line only
> > emacs -> make -> gmcs => line only
> > emacs -> xbuild -> gmcs => neither line, nor column.
>
> There is no special case "no line information".
>
> Perhaps xbuild is filtering something.
OK, I believe I now have an overview of what is going on. I will recap for the
benefit of others.
(g)mcs are "emacs aware", and strip the column information if the environment
variable "EMACS" is set. (Look for variable "InEmacs" in the (g)mcs source
code).
XBuild - for various reasons - parses the warning/error output of (g)mcs and
is unaware, that (g)mcs in some cases does not provide column information. In
those cases, line numbers are lost too, as xbuild can't figure out what is
going on. (Look at
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs:ParseOrigin).
Now, I believe it is a mistake for (g)mcs to adapt to emacs. Emacs should
adapt to (g)cms, not the other way around.
This lisp statement in emacs, will make emacs match, and use, the line:column
number information both directly from (g)mcs and from xbuild:
(setq compilation-error-regexp-alist
(append
'(
;;C# Compiler
;;t.cs(6,18): error SC1006: Name of constructor must match name of class
("\\(\\([_a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)[,]\\([0-9]+\\)):
*\\(error\\|warning\\) CS[0-9]+:" 1 3 4))
compilation-error-regexp-alist))
(There is no linebreak in the regexp, of course).
This fixes next-error, and conviniently places your cursor on the correct
column too.
This leaves a single problem: gmcs (have not tested with mcs) insists on
outputting an ansi control code when run from emacs:
gmcs Main.cs
[6nMain.cs(19): error CS8025: Parsing error
Compilation failed: 1 error(s), 0 warnings
AFAICT, this ansi control code is output from
mcs/class/corlib/System/TermInfoDriver.cs - I can't figure out why though, or
how to stop it from doing it...
It is possibly to fix this in emacs, using this regular expression instead of
the other suggested above:
'(( "\\(.\\[6n\\)?\\(\\([_a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)
[,]\\([0-9]+\\)): *\\(error\\|warning\\) CS[0-9]+:" 2 4 5) )
but I think it would be better for gmcs to drop the escape code in this case.
So, in summary: I suggest that dropping column information when running from
emacs is a bug. Additionally, I suggest that gmcs stop emitting ansi codes
when the terminal is "dumb".
Should I file a bug about this?
Regards,
Mads
--
Med venlig hilsen/Regards
Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34
More information about the Mono-devel-list
mailing list