2
votes

I am a R user, I want to use R in emacs. But, I am in trouble with customizing ess in emacs. I have installed the auto-complete packages and the latest ess in my emacs. But when I run r in emacs, the auto-complete don't work well. When I type app, I suppose to show like the image in (http://www.emacswiki.org/pics/static/ess-ac3) , but in my emacs neither of the auto-complete nor the yellow part shows.

My OS: ubuntu 12.04 amd64

my ~/.emacs file

;; Auto-complete
(add-to-list 'load-path "~/.emacs.d/site-lisp")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/ac-dict")
(ac-config-default)
; ess-site
(add-to-list 'load-path "/usr/share/emacs/site-lisp/ess")
(require 'ess-site)
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil) 
3
I think I am having the same problem, over here: stackoverflow.com/questions/22304058/… I have the same OS, too, so maybe all the people responding that (setq ess-use-auto-complete t) on both of our questions are using macs or something. That did not work for me.Mittenchops

3 Answers

1
votes

I recently started using ESS on Windows, and struggled with the same issue. I don't know all of the ins and outs but recent versions of ESS suggest using company-mode rather than auto-complete-mode. This minimal setup seems to have autocomplete working quite well for me on the following setup:

  • Windows 10 x64
  • R 3.4.3 x64
  • Emacs 25 x64 installed normally
  • MELPA repo enabled in init.el
  • package-install [RET] company
  • package-install [RET] ess
  • open a new R file in some directory
  • M-x company-mode to enable company-mode in the current buffer
  • `C-c C-z' to start an inferior R process

At this point, with the init.el file shown below, R completion is working, completing function calls, and package members. I think more configuration is needed to tailor it to your liking, but getting to this point took me long enough I consider it a success

emacs ess autocomplete

init.el:

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  )
(package-initialize)

;; emacs controlled settings
(custom-set-variables
 '(package-selected-packages (quote (company ess)))
 '(show-paren-mode t)
 '(tool-bar-mode nil))
(custom-set-faces
 '(default ((t (:family "Consolas" :foundry "outline" :slant normal :weight normal :height 113 :width normal)))))

(require 'company)
0
votes

Auto-complete works for me with this setting

(setq ess-use-auto-complete t)
0
votes

I got the same problem and the following code worked for me:

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(package-initialize)  ;load and activate packages, including auto-complete
(ac-config-default)
(setq ess-use-auto-complete 'script-only)
;;if not working, use the following instead of (setq ess-use-auto-complete 'script-only)
;;(global-auto-complete-mode t)