[ESS-bugs] OOps! ESS partly fails in non-English locales!
Martin Maechler
maechler at stat.math.ethz.ch
Tue Aug 2 15:02:31 CEST 2005
>>>>> "StEgl" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>> on Tue, 2 Aug 2005 12:31:40 +0100 writes:
StEgl> thanks for follow up Martin.
>> One thing: May be it is not "more problematic" than the problem I
>> reported. The "only" mistake is the mini-buffer message "Not a
>> syntax error", but then one at least gets to see a relatively
>> simply to understand message.
StEgl> Yes, agree - sorry, "problematic" was a bad choice of wording from me.
StEgl> I can fix the regexp for this particular error:
StEgl> Error in parse(file, n = -1, NULL, "?") : syntax error on line 3
StEgl> perhaps by a regexp searching for
StEgl> syntax error on line [line number]
StEgl> but is that likely to be good enough for catching all R errors?
not all R errors for sure.
But for C-c C-l, we know that R (and S-plus) uses source(),
so we have to think about the errors that happen from source().
There, the syntax error is really a special interesting case,
because that one can be pointed to by a line number.
For R, it will always happen from
.Internal(parse(file, n = -1, NULL, "?")))
now that leads to calling do_parse in source.c, i.e.
https://svn.R-project.org/R/trunk/src/main/source.c
which shows you
if (status != PARSE_OK)
errorcall(call, _("syntax error on line %d"), R_ParseError);
The "errorcall(call, ..)" part entails that the message (in an
English locale!) will be
Error in parse(.....) : syntax error on line <n>
In a German locale, it's e.g.
Fehler in parse(file, n = -1, NULL, "?") : Syntaxfehler in Zeile 1
--
Hence, for English
"^Error .* syntax error"
or German
"^Fehler .* Syntaxfehler"
would work.
I think ideally, one would make use of the things we have
already
ess-dump-error-re ( == "[Ee]rror" for English)
and/or better of something derived from
(defvar ess-R-message-prefixes
'("Error:" "Error in"
"Warning:" "Warning in"
"Warning messages?"))
(which would need to be put in two parts: one for errors the
other for warnings).
--------
I still think the best solution would be that R (or S-plus or
...) at startup of "inferior-*"
produces these errors on purpose by eval-ing erronous examples
i.e. sends some commands to R such as
parse(text="1]")
eval(parse(text="rpois(-1)"))
eval(parse(text="rpois(-1,1)"))
cat("1]", file=(.tf <- tempfile())) ; try(parse(file=.tf)); unlink(.tf)
and out of the R (or S+ ..)
error message auto-produces the relevant pattern to use.
This way, ESS adapts to the system, including locale setting,
also for future systems / locales.
Martin
More information about the ESS-bugs
mailing list