Emacs already has decent completion capabilities. Any time there's a list of possible answers, you can press Tab for completion. When there's more than one possible completion, it brings up a list for you.
I like to see the list of possible completions without pressing Tab or ?. In XEmacs, I use two packages,
icomplete to get a list of completions as I type, at least for switching buffers and for minibuffer inputs:
(require 'iswitchb) (setq iswitchb-buffer-ignore '("^ " "*Buffer")) (add-hook 'iswitchb-define-mode-map-hook '(lambda () (define-key iswitchb-mode-map " " 'iswitchb-next-match) (define-key iswitchb-mode-map [del] 'iswitchb-prev-match) (define-key iswitchb-mode-map [bs] 'iswitchb-prev-match) (define-key iswitchb-mode-map [right] 'iswitchb-next-match) (define-key iswitchb-mode-map [left] 'iswitchb-prev-match))) (icomplete-mode 1)
In Emacs22, I use
ido instead of
iswitchb. It works for both switching buffers and for opening files:
(setq ido-confirm-unique-completion t) (setq ido-default-buffer-method 'samewindow) (setq ido-use-filename-at-point t) (ido-mode t) (ido-everywhere t) (set-face-background 'ido-first-match "white") (set-face-foreground 'ido-subdir "blue3") (icomplete-mode 1)
If you're really into the power of completion, be sure to check out the
icicles package by Drew Adams. It has a lot more features, and it has some things that look incredibly useful. It works for buffers, files, and the minibuffer, and it allows you to chain together multiple commands in powerful ways.
icicles looks so good, why am I using
icomplete? It's because they come with Emacs22. The bar is higher for third party packages because it's an added dependency. I can't just tell a friend to put something into their
.emacs; I have to tell them to download it and add to their
load-path and so on. I wish there was a standard Emacs package system. I do plan to try out
icicles and other packages once I've finished exploring the standard set of packages that comes with Emacs22.