Emacs auto-complete for ESS in tooltip instead of

2020-06-17 05:58发布

I understand from the following resources:

...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:

From version 12.03 ESS integrates out of the box with auto-complete package.

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.

I know that in general, my emacs tooltips are possible because they appear correctly with my python jedi setup in emacs.

However, my emacs auto-complete does not work. Instead, there is a buffer at the bottom:

enter image description here

instead of this, with the help superimposed on the working buffer:

enter image description here

And I have the following in my 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):

(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?

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...

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?

3条回答
欢心
2楼-- · 2020-06-17 06:06

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2020-06-17 06:08

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.

查看更多
一纸荒年 Trace。
4楼-- · 2020-06-17 06:27

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

(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

(setq ess-use-auto-complete t)

EDIT: ess-use-auto-complete is by default set to t so this step is not really needed.

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.

Auto-complete has a lot of configuration options do read the manual when you get time.

Glad I could help

查看更多
登录 后发表回答