help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: auto-complete


From: John Mastro
Subject: Re: auto-complete
Date: Tue, 10 Nov 2015 16:56:42 -0800

<haris.bogdanovic@gmail.com> wrote:
> Hi
>
> This is my .emacs file:

[snip]

> Why doesn't my auto-completion work ?
> I am programming in Common Lisp and I want a dialog to pop up, with
> possible completions, in my REPL and .lisp files, while I'm typing.
> Thanks

I can't say for sure what is the problem, but here's a minimal
configuration that works for me. Give it a try and see if it works for
you too.

A couple notes that aren't directly related to slime or auto-complete:
- When using package.el to install packages, it's not necessary to
  manage `load-path' yourself - that's part of what package.el does for
  you.
- This is more personal preference, but I would probably suggest
  removing Marmalade from your package archives list and stick with GNU
  ELPA and MELPA. If you want less-frequently-changing packages than
  MELPA, give MELPA Stable (https://stable.melpa.org) a look.
- The various calls to `require' weren't necessary because the functions
  in question are autoloads (i.e. the relevant file will automatically
  be loaded the first time you use the function).

After adding the below to your init file, restart Emacs, visit a Lisp
file, and then invoke `M-x slime' to launch the SLIME REPL. You should
then get autocompletion in both the file-visiting buffer and the REPL.

#+begin_src emacs-lisp
(require 'package)

(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/";))

(package-initialize)

(defvar my-packages
  '(auto-complete slime ac-slime)
  "List of packages to install automatically.")

(let ((need (delq nil (mapcar (lambda (pkg)
                                (unless (package-installed-p pkg)
                                  pkg))
                              my-packages))))
  (when need
    (package-refresh-contents)
    (mapc #'package-install need)))

(ac-config-default)
(global-auto-complete-mode)

(add-hook 'lisp-mode-hook #'slime-mode)

(eval-after-load 'slime
  '(add-hook 'slime-mode-hook #'set-up-slime-ac))
(eval-after-load 'slime-repl
  '(add-hook 'slime-repl-mode-hook #'set-up-slime-ac))
#+end_src

-- 
john



reply via email to

[Prev in Thread] Current Thread [Next in Thread]