I understand from the following resources:
我从以下资源中了解到:
- http://www.emacswiki.org/emacs/ESSAuto-complete
- http://www.emacswiki.org/emacs/AutoComplete
- Emacs autocomplete-mode extension for ESS and R
- Is it possible to get code completion for R in Emacs ESS similar to what is available in Rstudio?
ESS和R的Emacs自动完成模式扩展
是否可以在Emacs ESS中获得类似于Rstudio中可用的R的代码完成?
...that I should have access to tooltips for auto-complete help in emacs when using ESS for R development. The last link additionally specifies that it should work out of the box with the latest ESS, and:
...在使用ESS for R开发时,我应该可以访问工具提示以获取emacs中的自动完成帮助。最后一个链接还指定它应该与最新的ESS一起开箱即用,并且:
From version 12.03 ESS integrates out of the box with auto-complete package.
从版本12.03开始,ESS开箱即用,具有自动完成包。
Three sources ‘ac-source-R-args’, ‘ac-source-R-objects’ and ‘ac-source-R’ are included in ESS distribution. The latest combines previous two and makes them play nicely together.
ESS分布中包括三个来源'ac-source-R-args','ac-source-R-objects'和'ac-source-R'。最新的结合前两个,使他们很好地一起玩。
I know that in general, my emacs tooltips are possible because they appear correctly with my python jedi setup in emacs.
我知道,一般来说,我的emacs工具提示是可能的,因为它们在emacs中使用我的python jedi设置正确显示。
However, my emacs auto-complete does not work. Instead, there is a buffer at the bottom:
但是,我的emacs自动完成功能不起作用。相反,底部有一个缓冲区:
instead of this, with the help superimposed on the working buffer:
而不是这个,帮助叠加在工作缓冲区上:
And I have the following in my init.el:
我的init.el中有以下内容:
(require 'auto-complete)
(setq ess-use-auto-complete t)
(ess-toggle-underscore nil)
I have the following versions of:
我有以下版本:
ess 20131207.1141 installed No description available.
ess-R-data-view 20130509.458 installed Data viewer for GNU R
ess-R-object-popup 20130302.336 installed popup description of R object
auto-complete 20140208.653 installed Auto Completion for GNU Emacs
What am I missing?
我错过了什么?
UPDATE 1
Here's my init for ESS stuff. This produces completions in a buffer, but not in a tooltip, where some configuration options from the manual have been added. (I have now tried all permutations of commenting and not commenting all of these):
这是我对ESS的初始化。这会在缓冲区中生成完成,但不会在工具提示中生成完成,其中添加了手册中的某些配置选项。 (我现在尝试了评论的所有排列,而不是评论所有这些):
(require 'auto-complete)
(global-auto-complete-mode)
(require 'auto-complete-config)
(ac-config-default)
(require 'ess-site)
(setq ess-use-auto-complete t)
(setq ac-auto-start 2)
(setq ac-auto-show-menu 0.2)
(ess-toggle-underscore nil)
UPDATE 2
Similar question here, but the same solution is suggested which did not actually result in tooltips on my setup. But it suggests to me this might be a platform issue? The poster there was also on Ubuntu 12.04 as I am---is it possible the solutions that worked for VitoshKa, Alex Vorobiev, and Iqbal Ansari were on a different platform? Are you guys using OS X?
类似的问题在这里,但建议相同的解决方案实际上没有导致我的设置工具提示。但它告诉我这可能是一个平台问题?那张海报也出现在Ubuntu 12.04上,因为我有可能为VitoshKa,Alex Vorobiev和Iqbal Ansari工作的解决方案在不同的平台上吗?你们是否使用OS X?
UPDATE 3
Maybe other diagnostics:
也许其他诊断:
ac-source-R is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-ac-start)
(candidates . ess-ac-candidates)
(document . ess-ac-help))
Documentation:
Combined ad-completion source for R function arguments and R objects
ac-source-R-objects is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-symbol-start)
(candidates . ess-ac-objects)
(document . ess-ac-help-object))
Documentation:
Auto-completion source for R objects
ac-source-R-args is a variable defined in `ess-r-d.el'.
Its value is ((prefix . ess-ac-start-args)
(candidates . ess-ac-args)
(document . ess-ac-help-arg))
Documentation:
Auto-completion source for R function arguments
[back]
where the variables for ess-ac[TAB]
are only...
其中ess-ac [TAB]的变量只是......
Click <mouse-2> on a completion to select it.
In this buffer, type RET to select the completion near point.
Possible completions are:
ess-ac-R-argument-suffix
ess-ac-sources
So maybe the problem is my ESS install is lacking all ess-ac-*
things defined above, like ess-ac-args
, etc?
所以也许问题是我的ESS安装缺少上面定义的所有ess-ac- *事物,比如ess-ac-args等?
3 个解决方案
#1
2
My auto-complete configuration also has
我的自动完成配置也有
(require 'auto-complete-config)
(ac-config-default)
and after that setting ess-use-auto-complete
makes ESS show the popup menus.
之后设置ess-use-auto-complete使ESS显示弹出菜单。
#2
2
So as per your comments it turned out that auto-complete
was not enabled in your emacs config. So just enable auto-complete
by adding something like this in you init file
因此,根据您的意见,结果是您的emacs配置中未启用自动完成功能。因此,只需在init文件中添加类似的内容即可启用自动完成功能
(load "auto-complete")
(global-auto-complete-mode)
Also for ESS you will need to set ess-use-auto-complete
to t
something like following would do
同样对于ESS,您需要将ess-use-auto-complete设置为类似以下内容
(setq ess-use-auto-complete t)
EDIT: ess-use-auto-complete
is by default set to t
so this step is not really needed.
编辑:默认情况下,ess-use-auto-complete设置为t,因此不需要执行此步骤。
Also since you found this option confusing I would recommend you to open an issue on the github repo so that the maintainers can improve the documentation (or code) whichever can reduce the confusion.
此外,由于您发现此选项令人困惑,我建议您在github repo上打开一个问题,以便维护人员可以改进文档(或代码),以减少混淆。
Auto-complete has a lot of configuration options do read the manual when you get time.
自动完成有很多配置选项,当你有时间时,请阅读手册。
Glad I could help
很高兴我能帮上忙
#3
1
Don't confuse eldoc
with auto-completion. Eldoc is what you have in your screenshot, it shows all arguments of a function without being intrusive. Auto-completion pops up when you start typing stuff and activates after ac-auto-start
characters.
不要将eldoc与自动完成混淆。 Eldoc就是你的截图中的内容,它显示了函数的所有参数,而不是侵入性的。当您开始输入内容时会弹出自动完成功能,并在交流自动启动字符后激活。
#1
2
My auto-complete configuration also has
我的自动完成配置也有
(require 'auto-complete-config)
(ac-config-default)
and after that setting ess-use-auto-complete
makes ESS show the popup menus.
之后设置ess-use-auto-complete使ESS显示弹出菜单。
#2
2
So as per your comments it turned out that auto-complete
was not enabled in your emacs config. So just enable auto-complete
by adding something like this in you init file
因此,根据您的意见,结果是您的emacs配置中未启用自动完成功能。因此,只需在init文件中添加类似的内容即可启用自动完成功能
(load "auto-complete")
(global-auto-complete-mode)
Also for ESS you will need to set ess-use-auto-complete
to t
something like following would do
同样对于ESS,您需要将ess-use-auto-complete设置为类似以下内容
(setq ess-use-auto-complete t)
EDIT: ess-use-auto-complete
is by default set to t
so this step is not really needed.
编辑:默认情况下,ess-use-auto-complete设置为t,因此不需要执行此步骤。
Also since you found this option confusing I would recommend you to open an issue on the github repo so that the maintainers can improve the documentation (or code) whichever can reduce the confusion.
此外,由于您发现此选项令人困惑,我建议您在github repo上打开一个问题,以便维护人员可以改进文档(或代码),以减少混淆。
Auto-complete has a lot of configuration options do read the manual when you get time.
自动完成有很多配置选项,当你有时间时,请阅读手册。
Glad I could help
很高兴我能帮上忙
#3
1
Don't confuse eldoc
with auto-completion. Eldoc is what you have in your screenshot, it shows all arguments of a function without being intrusive. Auto-completion pops up when you start typing stuff and activates after ac-auto-start
characters.
不要将eldoc与自动完成混淆。 Eldoc就是你的截图中的内容,它显示了函数的所有参数,而不是侵入性的。当您开始输入内容时会弹出自动完成功能,并在交流自动启动字符后激活。