ESS:ess-request-a-process 默认为“S”
我经常发现自己有一堆 R 进程在 ESS 缓冲区中运行。有一个方便的 Lisp 函数 ess-request-a-process
可以请求 R 进程,并将其置于前面。唯一的缺点是它以某种方式默认为S,所以每次我要进行切换时,我都必须输入R,令人恶心。
我尝试自定义 ess-language
变量,但即使我将值设置为“R”,即当前会话的 4,或者即使我保存未来会话的设置,只要我输入 Cc Ck
,S 自动再次出现。这非常烦人,我真的不想以 Cx Cb
结束,然后以 Cs
进行所需的 R 会话! =)
我什至尝试在 .emacs
中设置 (setq-default ess-language "R")
,但没有运气......
顺便说一句,我正在运行 Emacs v Linux Mint 上的 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)
Quite often I find myself with bunch of R processes running in ESS buffers. There's a convenient Lisp function ess-request-a-process
that asks for R process, and brings it to front. The only downside is that it somehow defaults to S, so each time I'm about to make a switch, I have to type R, ad nauseam.
I tried customising the ess-language
variable, but even if I set value to "R", i.e. 4 for current session, or even if I save settings for future session, as soon as I type C-c C-k
, automagically S appears once again. It's very annoying, and I really don't want to end up with C-x C-b
and then C-s
for desired R session! =)
I even tried setting (setq-default ess-language "R")
in .emacs
, but with no luck...
BTW, I'm running Emacs v. 23.1.1 on Linux Mint and Emacs v. 23.2 on Arch Linux, with ESS v. 5.12. If that's relevant, I run Emacs from terminal with -nw
argument. Here's my .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)
So... how to set R once and for all? (I don't use S/S+/SAS)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止我还不知道这个功能。 Cc Ck 绑定到 ESS 缓冲区中的
ess-force-buffer-current
。[编辑:Cc Ck确实绑定到iESS中的ess-request-a-process,在ESS中它是
ess-force-buffer-current
]在任何情况下,您的变量必须自定义的是
ess-dialect
它是缓冲区本地变量,
ess-mode-hook
中的其他一些内容可能会将其设置为不同的值。使用 Ch v 在每个缓冲区中检查它
ess-dialect
另外,如果您已经运行多个进程,则
ess-switch-process
(抄送 Cs)可能是正确的方法。[编辑:它不会跳转到进程,而只是重置当前 ESS 缓冲区的关联进程]
[编辑:在深入研究这个问题后,发现
ess-request-a-process
使用ess-language
变量是ess-dialect
似乎更合适。问题是,每次 ess-inferior 进程启动时,它都会重置 ess-language 的全局值。这就是为什么将其设置在您的情况下不起作用的原因。这是一个快速修复:
]
I did not know about this function so far. C-c C-k is bound to
ess-force-buffer-current
in ESS buffers.[edit: C-c C-k is indeed bound to ess-request-a-process in iESS, in ESS it's
ess-force-buffer-current
]In any case the variable you have to customize is
ess-dialect
It's buffer-local variable and some other stuff in
ess-mode-hook
might set it a different value.Check it in each buffer with C-h v
ess-dialect
Additionally, if you already running several processes then
ess-switch-process
(C-c C-s) might be the right way to go.[edit: it will not jump to a process but just reset the associated process of the current ESS buffer]
[edit: After dwelling deeper on the issue it turned out that
ess-request-a-process
usesess-language
variable were theess-dialect
seems to be more appropriate. The problem is that each time an ess-inferior process starts it resets the global value ofess-language
. This is why setting it in your case didn't work.Here is a quick fix:
]