title: ESS (R) Auto-complete
body: <p>I try to get a practical development environment for R in Emacs, hoping to get auto-completion working as shown in <a href="http://www.emacswiki.org/emacs/ESSAuto-complete" rel="nofollow">http://www.emacswiki.org/emacs/ESSAuto-complete</a>.</p>
  
  <p>However, even in a minimal configuration, I can't get it working.</p>
  
  <p>See what I get on <a href="http://screencast.com/t/qcyVwkECX" rel="nofollow">http://screencast.com/t/qcyVwkECX</a>. In fact, while AC <em>does</em> work (see completion menu appearing), it's like if there was no info from the R language itself, while ac-source-R is WELL added to ac-sources.</p>
  
  <p>Do you understand what's happening?</p>
  
  <p>Best regards.</p>
  
  <p>PS- Here is my minimal Emacs configuration file for the demo:</p>
  
  <pre><code>;; Auto Completion
  (add-to-list 'load-path "~/.emacs.d/elpa/auto-complete-20140824.1658/")
  (add-to-list 'load-path "~/.emacs.d/elpa/popup-20140815.629/")
  (when (require 'auto-complete-config)
  
  (ac-config-default)
  
  ;; use `C-n/C-p' to select candidates
  (setq ac-use-menu-map t)
  (define-key ac-menu-map (kbd "C-n") 'ac-next)
  (define-key ac-menu-map (kbd "C-p") 'ac-previous)
  
  ;; unbind some keys (inconvenient in iESS buffers)
  (define-key ac-completing-map (kbd "M-n") nil)
  (define-key ac-completing-map (kbd "M-p") nil)
  
  ;; set default sources
  (setq ac-sources
        (append '(ac-source-features
          ac-source-functions
          ac-source-yasnippet
          ac-source-variables
          ac-source-symbols)
            ac-sources))
  
  (setq ac-delay 0)               ; faster than default 0.1
  (setq ac-auto-show-menu 0.2)
  (setq ac-quick-help-delay 0.5)
  (setq ac-quick-help-height 10)
  (setq ac-candidate-limit 100)
  
  ;; completion by TAB
  (define-key ac-completing-map
    (kbd "&lt;tab&gt;") 'ac-complete)
  
  ;; avoid Flyspell processes when auto completion is being started
  (ac-flyspell-workaround))
  
  ;; ESS: Emacs Speaks Statistics
  (add-to-list 'load-path "~/.emacs.d/elpa/ess-20140824.1452/lisp/")
  
    (setq shell-file-name "zsh.exe")
  
  (add-to-list 'auto-mode-alist '("\\.[rR]\\'" . R-mode))
  
  (autoload 'R "ess-site" "Call 'R', the 'GNU S' system from the R Foundation." t)
  (autoload 'R-mode "ess-site" "Major mode for editing R source." t)
  
  (setq ess-ask-for-ess-directory nil)
  (setq inferior-ess-same-window nil)
  (setq ess-default-style 'DEFAULT)
  
  (with-eval-after-load "ess-site"
  
    ;; use eldoc to report R function names
    (require 'ess-eldoc)
    (add-hook 'inferior-ess-mode-hook 'ess-use-eldoc))
  </code></pre>
  
  <p>PPS- In fact, ElDoc does not seem to work either!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <ol>
  <li><p>I just discovered it almost works when the iESS buffer gets created, not when just editing R code in its own buffer. See <a href="http://screencast.com/t/fKRjLmIC6K0" rel="nofollow">http://screencast.com/t/fKRjLmIC6K0</a>.</p>
  
  <p>What would explain that iESS must be run first before it finally works?</p></li>
  <li><p>Still, something that does not work is the completion on function arguments (like with the cat function on the page <a href="http://www.emacswiki.org/emacs/ESSAuto-complete" rel="nofollow">http://www.emacswiki.org/emacs/ESSAuto-complete</a>).</p>
  
  <p>Why does that not work?</p></li>
  </ol>