This page contains contributed sources for AutoComplete.

Lisp:auto-complete-extension.el contains some sources by AndyStewart.

Lisp:ac-lilypond.el is my (finally working) contribution to LilyPond-mode sources. Redsonya

LaTeX and Unicode Math Input

ac-math provides three sources, one for LaTeX command completion, one for LaTeX math symbols and the another one for Unicode input of math characters. A comprehensive list of math symbols is implemented (more than 2500).

The author of ac-math moved to company-math.

Direct download for the former autocomplete math is ac-math.el (and for company math is company-math).

For Emacs24 and installing ac-math from Melpa (with list-packages), adding these lines in my init.el seems working with AucTeX already installed:

(require 'package)

(require 'auto-complete)
(require 'auto-complete-config)

(require 'ac-math) 
(add-to-list 'ac-modes 'latex-mode)   ; make auto-complete aware of `latex-mode`

 (defun ac-LaTeX-mode-setup () ; add ac-sources to default ac-sources
   (setq ac-sources
         (append '(ac-source-math-unicode ac-source-math-latex ac-source-latex-commands)
(add-hook 'LaTeX-mode-hook 'ac-LaTeX-mode-setup)
(global-auto-complete-mode t)
(setq ac-math-unicode-in-math-p t)


auto-complete-auctex uses auctex’s parsing to give up-to-date, accurate completions of commands, environments, bib entries, and labels.


Completion for python without rope or anything like that.

Works with python.el, python-mode.el etc.


Asynchronous completion for python - async version of Chris Poole’s excellent project. Works best with builtin python.el in Emacs 24.2+. Solves problem with slow autocompletions when using an inferior Python process.

Completion for python using PySmell.

(defvar ac-source-pysmell
     . (lambda ()
         (require 'pysmell)
  "Source for PySmell")

(add-hook 'python-mode-hook
          (lambda ()             
            (set (make-local-variable 'ac-sources) (append ac-sources '(ac-source-pysmell)))))


Completion for python using rope.

(add-hook 'python-mode-hook
          (lambda ()
	    (add-to-list 'ac-sources 'ac-source-ropemacs)))

R mode completions

New ESSAuto-complete

And older Lisp:ac-R.el (0.1)

ac-R.el interferes with mode switching between LaTeX and R in noweb mode. This interference can be eliminated by commenting out

    (make-local-variable ac-ignore-case)

in the

    (add-hook 'ess-mode-hook

section near the end. I think this is harmless, but I don’t know lisp well enough to be sure. It works but if someone has a better solution I’d love to hear it.

make-local-variable should accept a quote instead var. otherwise, it would introduce error as “Symbol nil may not be buffer-local” and fail to start ESS process. Please modified

    (make-local-variable ac-ignore-case)


     (make-local-variable 'ac-ignore-case)

for both occurs.

      (require 'ac-R)

and then start R manullay which would active the autocomplete thing. and you may find it would be helpful to keeps lines below in your .emacs too.

     (require 'ess-eldoc) 
     (setq ess-eval-visibly-p nil) 

Have a dog day, cheers!


Lisp:ac-dabbrev.el (0.0.4)

Semantic Autocompletion

This should get you started:

(defun ac-semantic-construct-candidates (tags)
   "Construct candidates from the list inside of tags."
   (apply 'append
		  (mapcar (lambda (tag)
					(if (listp tag)
						(let ((type (semantic-tag-type tag))
							  (class (semantic-tag-class tag))
							  (name (semantic-tag-name tag)))
						   (if (or (and (stringp type)
										(string= type "class"))
								   (eq class 'function)
								   (eq class 'variable))
							   (list (list name type class))))))

(defvar ac-source-semantic-analysis nil)
(setq ac-source-semantic
  `((sigil . "b")
    (init . (lambda () (setq ac-source-semantic-analysis
                             (condition-case nil
                                             (ac-semantic-construct-candidates (semantic-fetch-tags))))))
    (candidates . (lambda ()
                    (if ac-source-semantic-analysis
                        (all-completions ac-target (mapcar 'car ac-source-semantic-analysis)))))))


Org Mode

It’s a “snarf and barf” of the org-complete code, but it does the trick. Hopefully I will be able to provide a better version soon.

(defvar ac-org-candidates nil)
(defvar ac-org-pattern nil)
(defun ac-org-construct-candidates ()
  "Pabbrev source for org."
  (let* ((end (point))
	 (beg1 (save-excursion
		(skip-chars-backward (org-re "[:alnum:]_@"))
	 (beg (save-excursion
	       (skip-chars-backward "a-zA-Z0-9_:$")
	 (confirm (lambda (x) (stringp (car x))))
	 (searchhead (equal (char-before beg) ?*))
	  (when (and (member (char-before beg1) '(?. ?<))
		     (setq a (assoc (buffer-substring beg1 (point))
		(org-complete-expand-structure-template (1- beg1) a)
		(throw 'exit t)))
	 (tag (and (equal (char-before beg1) ?:)
		   (equal (char-after (point-at-bol)) ?*)))
	 (prop (and (equal (char-before beg1) ?:)
		    (not (equal (char-after (point-at-bol)) ?*))))
	 (texp (equal (char-before beg) ?\\))
	 (link (equal (char-before beg) ?\[))
	 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
	 (startup (string-match "^#\\+STARTUP:.*"
				(buffer-substring (point-at-bol) (point))))
	 (completion-ignore-case opt)
	 (type nil)
	 (tbl nil)
	 (table (cond
		  (setq type :opt)
		  (require 'org-exp)
		    (lambda (x)
		      (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
		      (cons (match-string 2 x) (match-string 1 x)))
		    (org-split-string (org-get-current-options) "\n"))
		   (mapcar 'list org-additional-option-like-keywords)))
		  (setq type :startup)
		 (link (append org-link-abbrev-alist-local
		  (setq type :tex)
		 ((string-match "\\`\\*+[ \t]+\\'"
				(buffer-substring (point-at-bol) beg))
		  (setq type :todo)
		  (mapcar 'list org-todo-keywords-1))
		  (setq type :searchhead)
		   (goto-char (point-min))
		   (while (re-search-forward org-todo-line-regexp nil t)
			  (push (list
				  (match-string 3) t))
		 (tag (setq type :tag beg beg1)
		      (or org-tag-alist (org-get-buffer-tags)))
		 (prop (setq type :prop beg beg1)
		       (mapcar 'list (org-buffer-property-keys nil t t)))
		 (t (progn
		     (call-interactively org-completion-fallback-command)
		     (throw 'exit nil))))))
    (setq ac-org-pattern (buffer-substring-no-properties beg end))

(defvar ac-source-org nil)
(setq ac-source-org
      `((sigil . "o")
	(init . (lambda () (setq ac-org-candidates
				 (condition-case nil
	(candidates . (lambda ()
			(all-completions ac-target ac-org-candidates)))))



An auto-complete source for Slime, providing lisp symbol completion and pop-up documentation is available.



An auto-complete source for Octave, providing Octave commands completion is available: Lisp:ac-octave.el

OCaml/Tuareg Mode

An auto-complete source for the caml and tuareg modes, gets symbols from caml-help.el in caml mode:

(defun ac-ocaml-candidates (prefix)
  "Candidates for OCaml auto-completion"
  (let ((candidates)
	  (when (string-match "\\([A-Za-z_][A-Za-z0-9_']*\\)[.]" prefix)
	    (match-string 1 prefix))))
    (if module-name
        (iter (lambda (sym) (push (concat module-name "." sym) candidates))
              (ocaml-module-symbols (assoc module-name (ocaml-module-alist))))
       (lambda (mod)
	 (iter (lambda (sym) (push sym candidates))
	       (ocaml-module-symbols mod)))
      (iter (lambda (mod) (push (car mod) candidates)) (ocaml-module-alist)))
(ac-define-source ocaml
  '((available . (require 'caml-help nil t))
    (candidates . (ac-ocaml-candidates ac-prefix))
    (prefix . "\\(?:[^A-Za-z0-9_.']\\|\\`\\)\\(\\(?:[A-Za-z_][A-Za-z0-9_']*[.]\\)?[A-Za-z0-9_']*\\)")
    (symbol . "s")))


auto-complete-etags.el. Using TagsFile with auto-complete.


Writing your own sources

The manual contains a tutorial on how to write your own sources.