Lisp: Emacs Autocomplete

Integrate emacs autocomplete
Emacs Autocomplete provides dictionaries for many languages and inserts new words on the fly (with the correct settings).
Install it to .emacs.d and insert the following lines into your .emacs-file to enable it:

;; add .emacs.d to load path
(add-to-list 'load-path "~/.emacs.d")

;; enable autocomplete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(global-auto-complete-mode t)
(auto-complete-mode t)

Lisp-specific autocomplete
Put ac-slime into your .emacs.d-folder and paste the following snippet into your .emacs-file:

;; add lisp autocomplete-support
(require 'ac-slime)
(add-hook 'slime-mode-hook 'set-up-slime-ac)

Global autocomplete
Globally enable autocomplete by pasting the following snippet into your .emacs-file:

(define-globalized-minor-mode real-global-auto-complete-mode
  auto-complete-mode (lambda ()
                       (if (not (minibufferp (current-buffer)))
                         (auto-complete-mode 1))))
(real-global-auto-complete-mode t)

Insert new words on the fly
Insert new words on the fly by pasting the following snippet into your .emacs-file:

;; create and add new words to the dictionary on the fly
(when (require 'auto-complete-config nil 'noerror)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
  (setq ac-comphist-file  "~/.emacs.d/ac-comphist.dat")
  (ac-config-default))
Advertisements
Lisp: Emacs Autocomplete

Emacs for Mac OS X adjustments

To use Emacs on Mac OS X you have to adjust some properties.

Map the alt and meta key
Go to “Emacs” – “Preferences” – “Environment” – “Ns : GNUstep/Mac OS X specific features” and change the following:

  • Ns Command Modifier” -> “meta
  • Ns Alternate Modifier” -> “No modifier

Now you can use your alt and meta keys as usual.

Change the background and mouse color

  • open your “~/.emacs
  • paste the following code snippet:
(setq default-frame-alist
    (append default-frame-alist
        '((foreground-color . "LawnGreen")
          (background-color . "Black")
          (cursor-color . "LawnGreen"))))
Emacs for Mac OS X adjustments