[ESS] Help configuring auto-complete

Ista Zahn istazahn at gmail.com
Fri Jun 15 21:52:58 CEST 2012


Hi all,

Sorry for resurrecting this old thread. I just wanted to note for
future googlers that I finally solved this problem to my complete
satisfaction using

(define-key ac-completing-map "\t" 'ac-complete)
(define-key ac-completing-map "\r" nil)

I had tried this before without succes, but it now works as intended
(not sure what the problem was before)

This prevents auto-complete from completing when the return key is
pressed, and instead uses the tab key for this. Although I don't think
I realized it myself when I first opened this thread, that is actually
what I want, and I'm now very happy with the way auto-complete is
working with ESS.

Thanks again,
Ista

On Tue, May 15, 2012 at 2:01 PM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>
>>>>> Ista Zahn <istazahn at gmail.com>
>>>>> on Tue, 15 May 2012 13:12:09 -0400 wrote:
>
>  > Hi Vitalie,
>  > Great, thank you for the comprehensive reply. For now I'm going to
>  > disable argument auto-completion using the second method you
>  > described.
>
> Third method might be better, as you will have arguments completion.
>
>
>  > More generally, I like having auto-complete menus popping up all over
>  > the place -- for me it really is just this situation (argument
>  > completion menu triggered by ",") where it gets in my way.
>
> You can place this into ess-mode-hook and ess-post-run-hook:
>
> (delete 'ess-smart-comma ac-trigger-commands)
>
> Then comma wont trigger the ac menu.
>
> Vitalie.
>
>  > On Tue, May 15, 2012 at 11:40 AM, Vitalie Spinu <spinuvit at gmail.com> wrote:
>  >>
>  >>>>>> 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
>  >> short.
>  >>
>  >> 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.
>  >>
>  >> Best,
>  >> Vitalie.



More information about the ESS-help mailing list