[ESS-bugs] OOps! ESS partly fails in non-English locales!
Martin Maechler
maechler at stat.math.ethz.ch
Tue Aug 2 12:52:17 CEST 2005
>>>>> "StEgl" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>> on Tue, 2 Aug 2005 10:05:45 +0100 writes:
StEgl> hi Martin,
StEgl> to follow up on your mail about locales interfering with parsing
StEgl> errors... I just noticed something a bit more problematic. I presume
StEgl> I'm working in the native locale
StEgl> $ echo $LC_MESSAGES
StEgl> (I've not set anything myself.)
StEgl> and if I have a short R file:
StEgl> ---
StEgl> x <- 9.9)
StEgl> ---
StEgl> and then do C-c C-l, I get told
StEgl> Errors: Use C-c ` to find error.
StEgl> which is great, but then hitting C-c ` I get shown the *ESS-errors*
StEgl> buffer but told "Not a syntax error." ESS-errors shows me:
StEgl> ----
StEgl> Error in parse(file, n = -1, NULL, "?") : syntax error on line 3
StEgl> ----
StEgl> which from looking briefly at ess-parse-errors regexps, won't be found
StEgl> by
StEgl> (re-search-backward
StEgl> "^\\(Syntax error: .*\\) at line \\([0-9]*\\), file \\(.*\\)$"
StEgl> should this be working in English?
yes, it should; and we now see why it doesn't....
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.
The problem with the foreign (well, my "native") locales is that
you get *nothing*; You have no idea that there was an error, and
things look like C-c C-l did work properly.
Martin
StEgl> Stephen
StEgl> 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
More information about the ESS-bugs
mailing list