 ;; Used only for its faces (for color-theme).
 (require 'font-lock)
 
+(defgroup lusty-explorer nil
+  "Quickly open new files or switch among open buffers."
+  :group 'extensions
+  :group 'convenience
+  :version "23")
+
+(defcustom lusty-setup-hook nil
+  "Hook run after the lusty keymap has been setup.
+Additional keys can be defined in `lusty-mode-map'."
+  :type 'hook
+  :group 'lusty-explorer)
+
 (defvar lusty-match-face font-lock-function-name-face)
 (defvar lusty-directory-face font-lock-type-face)
 (defvar lusty-slash-face font-lock-keyword-face)

      (setq entries (nthcdr n-rows entries)))
    (nreverse sublists)))

(defun lusty--run (read-fn)
  (add-hook 'post-command-hook 'lusty--post-command-function t)
  (let ((lusty--highlighted-index 0)
        (lusty--previous-printed-matches '()))
    (unwind-protect 
        (save-window-excursion
          (funcall read-fn ">> "))

(defun lusty-buffer-explorer ()
  "Launch the buffer mode of LustyExplorer."
  (interactive)
  (lusty--define-mode-map)
  (let* ((lusty--active-mode :buffer-explorer)
         (minibuffer-local-completion-map lusty-mode-map)
         (buffer (lusty--run 'read-buffer)))
    (when buffer
      (switch-to-buffer buffer))))

;;;###autoload
(defun lusty-highlight-next ()
  "Highlight the next entry in *Lusty-Matches*."
  (interactive)
  (incf lusty--highlighted-index)
  (lusty-refresh-matches-buffer))

;;;###autoload
(defun lusty-highlight-previous ()
  "Highlight the previous entry in *Lusty-Matches*."
  (interactive)
