Friday, November 11, 2011

ac-source-slime


Here's a little bit of elisp to enable the excellent auto-complete-mode to understand SLIME:

(defun jsn-slime-source ()
  (let* ((end (move-marker (make-marker) (slime-symbol-end-pos)))
  (beg (move-marker (make-marker) (slime-symbol-start-pos)))
  (prefix (buffer-substring-no-properties beg end))
  (completion-result (slime-contextual-completions beg end))
  (completion-set (first completion-result)))
    completion-set))

(defvar ac-source-slime '((candidates . jsn-slime-source)))

Once these are added to your .emacs, add these two expressions to your lisp-mode
hook:

  (auto-complete-mode)
  (setq ac-sources '(ac-source-slime))

and you'll get nice modern-looking popup completions as you type.

No comments:

Post a Comment