Emacs ess auto-complete

前端 未结 3 1677
醉话见心
醉话见心 2021-01-15 02:05

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

3条回答
  •  北恋
    北恋 (楼主)
    2021-01-15 02:31

    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

    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)
    

提交回复
热议问题