[R-SIG-Mac] Setting locale for running R in emacs / ess
Rainer M Krug
Rainer at krugs.de
Fri Oct 23 14:13:17 CEST 2015
Marc Schwartz <marc_schwartz at me.com> writes:
>> On Oct 23, 2015, at 5:33 AM, Rainer M Krug <Rainer at krugs.de> wrote:
>>
>> Hi
>>
>> I installed R via homebrew, but it should be the same for the normal R
>> installation.
>>
>> When I start R in emacs, I get these unset locale warnings:
>>
>> ,----
>> | During startup - Warning messages:
>> | 1: Setting LC_CTYPE failed, using "C"
>> | 2: Setting LC_COLLATE failed, using "C"
>> | 3: Setting LC_TIME failed, using "C"
>> | 4: Setting LC_MESSAGES failed, using "C"
>> | 5: Setting LC_MONETARY failed, using "C"
>> | > > options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
>> | > sessionInfo()
>> | R version 3.2.2 (2015-08-14)
>> | Platform: x86_64-apple-darwin14.5.0 (64-bit)
>> | Running under: OS X 10.11 (El Capitan)
>> |
>> | locale:
>> | [1] C
>> |
>> | attached base packages:
>> | [1] stats graphics grDevices utils datasets methods base
>> | > version
>> | _
>> | platform x86_64-apple-darwin14.5.0
>> | arch x86_64
>> | os darwin14.5.0
>> | system x86_64, darwin14.5.0
>> | status
>> | major 3
>> | minor 2.2
>> | year 2015
>> | month 08
>> | day 14
>> | svn rev 69053
>> | language R
>> | version.string R version 3.2.2 (2015-08-14)
>> | nickname Fire Safety
>> | >
>> `----
>>
>> But I have the following in my .emacs file which should set the locales
>> (as far as I know)
>>
>> ,----
>> | (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
>> | (set-language-environment 'utf-8)
>> | ;; (set-keyboard-coding-system 'utf-8-mac) ; For old Carbon emacs on OS X only
>> | (setq locale-coding-system 'utf-8)
>> | (set-default-coding-systems 'utf-8)
>> | (set-terminal-coding-system 'utf-8)
>> | (unless (eq system-type 'windows-nt)
>> | (set-selection-coding-system 'utf-8))
>> | (prefer-coding-system 'utf-8)
>> `----
>>
>> which apparently does not work.
>>
>> Do I have to resort to setting the locales as described at
>> http://stackoverflow.com/questions/30264526/why-does-my-ess-r-session-fall-back-to-c-locale
>>
>> or am I missing something?
>>
>> Thanks,
>>
>> Rainer
>
>
> Rainer,
>
> Download exec-path-from-shell.el from:
>
> https://github.com/purcell/exec-path-from-shell
>
> and place it where you may have other Emacs related add ins.
>
> Then, in your ~/.emacs file, add:
>
> (load "/PATH.TO/exec-path-from-shell")
> (exec-path-from-shell-initialize)
>
> Replacing PATH.TO with the actual path to the exec-path-from-shell.el file.
Thanks - I was using exec-path-from-shell already, but it was supposed
to only copy the PATH and MANPATH as you can see here. But all
environmental variables were copier=d under emacs 24.
My problem is under 25, where exec-path-from-shell bev=haves as it
should (or emacs does) as it only copies the PATH and MANPATH. I now
added
,----
| (exec-path-from-shell-copy-env "LC_ALL")
| (exec-path-from-shell-copy-env "LANG")
`----
and it works nicely.
There seems to be a bug in either emacs 24 or in exec-path-from-shell.
>
> You should remove the other lines pertaining to locales that you have above.
>
> That should help Emacs/ESS started from the GUI/dock pick up the
> environment that you would normally have in a terminal session of R.
>
> Also, in case you are not aware, there is a dedicated ESS list here:
>
> https://stat.ethz.ch/mailman/listinfo/ess-help
Yes I know, but I s=decided to ask here, as it is a mac specific
problem. The last time I tried it on the ESS list but did not get a
response.
Thanks a lot, and keep this change in mu=ind when upgrading to emacs
25,
Rainer
>
>
> Regards,
>
> Marc Schwartz
>
>
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa
Tel : +33 - (0)9 53 10 27 44
Cell: +33 - (0)6 85 62 59 98
Fax : +33 - (0)9 58 10 27 44
Fax (D): +49 - (0)3 21 21 25 22 44
email: Rainer at krugs.de
Skype: RMkrug
PGP: 0x0F52F982
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 454 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20151023/a4382f08/attachment.bin>
More information about the R-SIG-Mac
mailing list