[ESS-bugs] OOps! ESS partly fails in non-English locales!
Stephen Eglen
S.J.Eglen at damtp.cam.ac.uk
Tue Aug 2 11:05:45 CEST 2005
hi Martin,
to follow up on your mail about locales interfering with parsing
errors... I just noticed something a bit more problematic. I presume
I'm working in the native locale
$ echo $LC_MESSAGES
(I've not set anything myself.)
and if I have a short R file:
---
x <- 9.9)
---
and then do C-c C-l, I get told
Errors: Use C-c ` to find error.
which is great, but then hitting C-c ` I get shown the *ESS-errors*
buffer but told "Not a syntax error." ESS-errors shows me:
----
Error in parse(file, n = -1, NULL, "?") : syntax error on line 3
----
which from looking briefly at ess-parse-errors regexps, won't be found
by
(re-search-backward
"^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$"
should this be working in English?
Stephen
Martin Maechler writes:
> Uaah! That's really pretty problematic.
>
> I've been using and advocation the use of C-c C-l
> (ess-load-file, also "Load File" (2nd from top) in the ESS menu).
>
> And have started wondering why it didn't work for me, in case
> the source()ing of the file gave errors:
>
>
> Then found the following *ESS-errors* buffer
> ----------------------------------------------------------------------------
> Fehler in parse(file, n = -1, NULL, "?") : Syntaxfehler in Zeile 274
> ----------------------------------------------------------------------------
>
> and only later realized that we are searching for a match with
>
> ess-dump-error-re which is set to "[Ee]rror"
>
> hence no match in the above German language error buffer, hence
> the (to me) most important useful feature of C-c C-l fails.
>
> As a work around, we could start adding the translations of the
> word "Error" to the ess-dump-error-re variable -- and that's
> what I have now done, here locally -- assuming either English or
> German or language where "error" is translated with something
> like "errore" where no change is needed.
>
> A nicer solution would however a bit more complicated,
> namely have ESS call R in a way to produce an error and find the
> corresponding word in the error message - e.g. assuming it would
> come first, at least for something like the above "Error in ...".
>
> BTW: Running everything inside a try(...) is not a solution IMO,
> since that will not run correctly all R code which uses
> try(.) itself.
>
> At the moment I think it would be great if there was an R way of
> saying ``set LC_MESSAGES to C for the time being'' . This would
> require that R has both the standard English and the 'locale'
> messages loaded - or loadable during runtime.
> Currently, LC_MESSAGES cannot be changed from
> inside R but must be set before R is started.
> I have now idea how hard / inefficient / ... the above proposal
> would be, but can imagine that this would be desirable in other
> situations as well. If this seems like a good idea, Kurt and I
> should take it to R-core.
>
> Actually , the issue is even larger: We have other places where
> we assume English for 'LC_MESSAGES', e.g., in
>
> (defvar ess-R-message-prefixes
> '("Error:" "Error in"
> "Warning:" "Warning in"
> "Warning messages?"))
>
> but this only affects font-locking AFAICS.
>
> Martin
>
> _______________________________________________
> ESS-bugs ESS-bugs at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/ess-bugs
>
> _______________________________________________
> ESS-core list: https://stat.ethz.ch/mailman/listinfo/ess-core
More information about the ESS-bugs
mailing list