4

With below setup, my ielm mode has autocompletion function:

enter image description here

(require 'ac-slime)
(add-hook 'slime-mode-hook 'set-up-slime-ac)
(add-hook 'slime-repl-mode-hook 'set-up-slime-ac)
(eval-after-load "auto-complete"
   '(add-to-list 'ac-modes 'slime-repl-mode 'emacs-lisp-mode))

(defun ielm-auto-complete ()                               
  "Enables `auto-complete' support in \\[ielm]."           
  (setq ac-sources '(ac-source-functions                   
                     ac-source-variables                   
                     ac-source-features                    
                     ac-source-symbols                     
                     ac-source-words-in-same-mode-buffers))
  (add-to-list 'ac-modes 'inferior-emacs-lisp-mode)        
  (auto-complete-mode 1))                                  
(add-hook 'ielm-mode-hook 'ielm-auto-complete)

(add-hook 'ielm-mode-hook #'enable-paredit-mode)
(add-hook 'ielm-mode-hook (lambda () (set (make-local-variable 'company-backends) '(company-elisp))))

(add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode)
(add-hook 'emacs-lisp-mode-hook (lambda () (set (make-local-variable 'company-backends) '(company-elisp))))

But it doesn't work when edit a .el file. I guess I can not share the same function call ielm-auto-complete but don't know how to change it.

3

Add below line should work:

(add-hook 'emacs-lisp-mode-hook 'ielm-auto-complete)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.