我正在运行OSX Yosemite,使用Emacs 24.5和R 3.2。
我在我的~/.bash_profile文件中有以下内容:
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="en_US.UTF-8"
export LC_TIME="en_US.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="en_US.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="en_US.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="en_US.UTF-8"
export LC_MEASUREMENT="en_US.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"
export LC_ALL=en_US.UTF-8
这是我的emacs设置:
(setq current-language-environment "UTF-8")
(add-hook 'ess-R-post-run-hook
(lambda () (set-buffer-process-coding-system
'utf-8-nfd-unix 'utf-8-nfd-unix)))
我甚至已经在整个系统中设置了以下内容:
defaults write org.R-project.R force.LANG en_US.UTF-8
当我从命令行或RStudio中运行R时,它使用正确的区域设置。然而,当我在emacs中运行R进程时,会收到以下警告:
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"
任何非 ASCII 字符都会导致错误,使其格式不正确。我该如何设置正确的语言环境?