Emacs auto-complete for ESS in tooltip instead of buffer

懵懂的女人 提交于 2019-12-12 08:06:50

问题


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?

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

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

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?


回答1:


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.




回答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

(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




回答3:


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.



来源:https://stackoverflow.com/questions/22304058/emacs-auto-complete-for-ess-in-tooltip-instead-of-buffer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!