[ESS] Help configuring auto-complete

Vitalie Spinu spinuvit at gmail.com
Tue May 15 17:40:29 CEST 2012

>>>> Ista Zahn <istazahn at gmail.com>
>>>> on Tue, 15 May 2012 09:56:42 -0400 wrote:

  > c(x = 1,

  > with the cursor immediately after the comma, the auto-complete menu
  > pops up offering to complete "recursive=".
  > I would really appreciate it if  you can tell me how to disable just
  > this specific feature. 

What feature precisely? disable it inside c() or disable argument
completion altogether?

  > The manual suggests that I should look at the docstring of
  > ac-use-auto-complete, but I can't seem to find it.

it should be ess-use-auto-complete, it's a type in new features
section. Thanks.

On a general note, I am still not clear what default ac set-up is the
most meaningful. And user input is highly valuable here. I agree that
the current one is too intrusive. Though auto-popup works fine in elisp
buffers it is pretty annoying in R buffers because most of the names are

There are three general ways that the user can go about it.

First, is to deactivate ac auto pop-up by setting ac-auto-show-menu to
nil and make TAB to trigger the menu:

 (ac-set-trigger-key "TAB").

Second, is to disable auto-completion of arguments. There are 2 basic R
sources `ac-source-R-objects' and `ac-source-R-args'. The third source
ac-source-R combines conveniently the previous 2 and is activated by
default. Add only one of them to ac-sources variable:

(defun my-ac-ess-config ()
  (setq ac-souces
	'(ac-source-R-objects ac-source-filename ac-source-words-in-buffer)))

(add-hook 'ess-mode-hook 'my-ac-ess-config)
(add-hook 'ess-post-run-hook 'my-ac-ess-config)

Third, you can look at definitions of these souces and redefine
them. Particularly you can configure the prefix parameter to be 1 or
even 2 (instead of the default 0):

(setq ac-source-R
      '((prefix . ess-ac-start)
       (requires . 2)
       (candidates . ess-ac-candidates)
       (document . ess-ac-help)))

But then you won't have auto completion of arguments at "(" and
",". Given the current eldoc functionality I think this last option
should actually be the default.


More information about the ESS-help mailing list