3

我经常发现自己有一堆在 ESS 缓冲区中运行的 R 进程。有一个方便的 Lisp 函数ess-request-a-process,它要求 R 进程,并将其放在前面。唯一的缺点是它以某种方式默认为S,所以每次我要进行切换时,我都必须输入R,令人作呕。

我尝试自定义ess-language变量,但即使我将值设置为“R”,即当前会话的 4,或者即使我为将来的会话保存设置,只要我键入C-c C-kS就会自动再次出现。这很烦人,我真的不想以C-x C-b想要C-s的 R 会话结束!=)

我什至尝试设置(setq-default ess-language "R").emacs但没有运气...

顺便说一句,我在 Linux Mint 上运行 Emacs v. 23.1.1,在 Arch Linux 上运行 Emacs v. 23.2,以及 ESS v. 5.12。如果这是相关的,我会从带有-nw参数的终端运行 Emacs。这是我的.emacs

;; start server
(server-start)

;; load ESS
(require 'ess-site)
(require 'ess-rutils)

;; set HTML help as default
(setq inferior-ess-r-help-command "help(\"%s\", help_type = \"html\")\n")

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(ess-help-kill-bogus-buffers t)
 '(ess-rutils-keys nil)
 '(show-paren-mode t))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )
(put 'upcase-region 'disabled nil)

那么......如何一劳永逸地设置R ?(我不使用 S/S+/SAS)

4

1 回答 1

3

到目前为止我还不知道这个功能。C-c C-k绑定到ess-force-buffer-currentESS 缓冲区中。

[编辑:C-c C-k 确实绑定到 iESS 中的 ess-request-a-process,在 ESS 中它是ess-force-buffer-current]

无论如何,您必须自定义的变量是ess-dialect

(setq-default ess-dialect "R")

它是缓冲区局部变量,其中的一些其他内容ess-mode-hook可能会将其设置为不同的值。

在每个缓冲区中检查它 C-h v ess-dialect

此外,如果您已经运行了多个进程,那么ess-switch-process( C-c C-s) 可能是正确的方法。[编辑:它不会跳转到一个进程,而只是重置当前 ESS 缓冲区的关联进程]

[编辑:在深入研究这个问题后,发现ess-request-a-process使用ess-language变量ess-dialect似乎更合适。问题是每次 ess-inferior 进程启动时,它都会重置ess-language. 这就是为什么在你的情况下设置它不起作用。

这是一个快速修复:

(defun ess-set-language ()
  (setq-default ess-language "R")
  (setq ess-language "R")
  )

(add-hook 'ess-post-run-hook 'ess-set-language t)

]

于 2010-12-08T08:53:18.703 回答