16

Is there an R-extension to Emacs autocomplete-mode that can be used with ESS?

If the extension doesn't exist I'd also appreciate any hints for writing one!

Matti Pastell
  • 9,135
  • 3
  • 37
  • 44

2 Answers2

12

There is an ac-source for R here. I recall struggling with it and finally wrote my own which at that time was much faster, but buggy since I didn't manage to make prefix regexp work properly.

EDIT: the newest ESS (only svn currently) has out-of-the-box integration with auto-complete. I have added the instructions to the wiki.

enter image description here

VitoshKa
  • 8,387
  • 3
  • 35
  • 59
  • OK, I tried it and seems to be quite good, I think it should be enough for me. – Matti Pastell Jan 14 '11 at 08:17
  • I can only get it to have the drop-down list, not any of the other functionality? help? – PascalVKooten Oct 14 '12 at 12:16
  • @Dualinity It is explained in the wiki. Help doesn't pop up automatically as far as I remember. There are tons of options for auto-complete. You can make it pop-up. I simply bind it to M-h and whenever in ac-mode-map. – VitoshKa Oct 14 '12 at 14:42
  • That ac-completing-map is not existing for me (AC 1.3.1). – PascalVKooten Oct 14 '12 at 14:47
  • @Dualinity Hm, ac 1.3.1 is utterly old. Install one from https://github.com/auto-complete/auto-complete (clone and add require, stuff as usual) – VitoshKa Oct 15 '12 at 04:12
  • error gives: "popup-create: Keyword argument :mouse-face not one of (:min-height :around :face :selection-face :scroll-bar :margin-left :margin-right :symbol :parent :parent-offset)" – PascalVKooten Oct 15 '12 at 17:18
  • @VitoshKa thanks for the tip. I have: (setq ess-use-auto-complete t) (defun my-ac-emacs-ess-mode () (setq ac-sources '(ac-source-R ac-source-filename)) ) (add-hook 'ess-mode-hook 'my-ac-emacs-ess-mode) (add-hook 'inferior-ess-mode-hook 'my-ac-emacs-ess-mode) in my init file and it seems like autocomplete works in my inferior ess buffer, but not my R script. Can you provide documentation to correctly set this up? Thanks! – Vinh Nguyen Jan 30 '13 at 06:44
  • @VinhNguyen `ac-source-R` will work in script buffer only if the buffer is associated with the subprocess (C-c C-z, or C-c C-s,or just evaluate something). In addition, you don't need any of your configuration with the recent version of ESS. Autocomplete is detected and configured automatically, – VitoshKa Feb 01 '13 at 10:44
  • I find for the latest version of ess, autcomplete is nto detected an configured automatically. – Mittenchops Mar 16 '14 at 13:56
4

auto-complete-acr is auto-complete sources.

it is more useful than ac-R.

add to .emacs below.

(require ‘auto-complete)
(require ‘auto-complete-acr)
myuhe
  • 41
  • 1