From 3cdb7f32add31e28d7dc38d8de9b6ca41838101f Mon Sep 17 00:00:00 2001
From: Bozhidar Batsov <bozhidar@tradeo.com>
Date: Fri, 6 Dec 2013 17:10:04 +0200
Subject: [PATCH] [Fix #447] Extract ido config into a module

This should make it simpler to disable ido completely if you want to use
an alternative library (like `icomplete` or `icicles` for instance).
---
 .projectile               |  3 +-
 core/prelude-editor.el    | 26 ----------------
 core/prelude-packages.el  |  6 ++--
 modules/prelude-ido.el    | 64 +++++++++++++++++++++++++++++++++++++++
 sample/prelude-modules.el |  4 ++-
 5 files changed, 72 insertions(+), 31 deletions(-)
 create mode 100644 modules/prelude-ido.el

diff --git a/.projectile b/.projectile
index 40e4161..f47cd73 100644
--- a/.projectile
+++ b/.projectile
@@ -1,2 +1,3 @@
 /elpa
-/savefile
\ No newline at end of file
+/savefile
+/.cask
\ No newline at end of file
diff --git a/core/prelude-editor.el b/core/prelude-editor.el
index 996a013..9a51c59 100644
--- a/core/prelude-editor.el
+++ b/core/prelude-editor.el
@@ -211,32 +211,6 @@ The body of the advice is in BODY."
 ;; keep in mind known issues with zsh - see emacs wiki
 (setq tramp-default-method "ssh")
 
-;; ido-mode
-(require 'ido)
-(require 'ido-ubiquitous)
-(require 'flx-ido)
-(setq ido-enable-prefix nil
-      ido-enable-flex-matching t
-      ido-create-new-buffer 'always
-      ido-use-filename-at-point 'guess
-      ido-max-prospects 10
-      ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
-      ido-default-file-method 'selected-window
-      ido-auto-merge-work-directories-length -1)
-(ido-mode +1)
-(ido-ubiquitous-mode +1)
-;; smarter fuzzy matching for ido
-(flx-ido-mode +1)
-;; disable ido faces to see flx highlights
-(setq ido-use-faces nil)
-
-;; smex, remember recently and most frequently used commands
-(require 'smex)
-(setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
-(smex-initialize)
-(global-set-key (kbd "M-x") 'smex)
-(global-set-key (kbd "M-X") 'smex-major-mode-commands)
-
 (set-default 'imenu-auto-rescan t)
 
 ;; flyspell-mode does spell-checking on the fly as you type
diff --git a/core/prelude-packages.el b/core/prelude-packages.el
index 7ae83b2..9481539 100644
--- a/core/prelude-packages.el
+++ b/core/prelude-packages.el
@@ -43,11 +43,11 @@
 
 (defvar prelude-packages
   '(ace-jump-mode ack-and-a-half anzu dash diminish elisp-slime-nav
-    epl expand-region flx-ido flycheck gist
+    epl expand-region flycheck gist
     gitconfig-mode gitignore-mode grizzl
-    guru-mode projectile ido-ubiquitous
+    guru-mode projectile
     magit move-text rainbow-mode
-    smartparens smex undo-tree
+    smartparens undo-tree
     volatile-highlights zenburn-theme)
   "A list of packages to ensure are installed at launch.")
 
diff --git a/modules/prelude-ido.el b/modules/prelude-ido.el
new file mode 100644
index 0000000..27e17f2
--- /dev/null
+++ b/modules/prelude-ido.el
@@ -0,0 +1,64 @@
+;;; prelude-ido.el --- Ido setup
+;;
+;; Copyright © 2011-2013 Bozhidar Batsov
+;;
+;; Author: Bozhidar Batsov <bozhidar@batsov.com>
+;; URL: https://github.com/bbatsov/prelude
+;; Version: 1.0.0
+;; Keywords: convenience
+
+;; This file is not part of GNU Emacs.
+
+;;; Commentary:
+
+;; Ido-related config.
+
+;;; License:
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License
+;; as published by the Free Software Foundation; either version 3
+;; of the License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Code:
+(prelude-require-package '(flx-ido ido-ubiquitous smex))
+
+(require 'ido)
+(require 'ido-ubiquitous)
+(require 'flx-ido)
+
+(setq ido-enable-prefix nil
+      ido-enable-flex-matching t
+      ido-create-new-buffer 'always
+      ido-use-filename-at-point 'guess
+      ido-max-prospects 10
+      ido-save-directory-list-file (expand-file-name "ido.hist" prelude-savefile-dir)
+      ido-default-file-method 'selected-window
+      ido-auto-merge-work-directories-length -1)
+(ido-mode +1)
+(ido-ubiquitous-mode +1)
+
+;;; smarter fuzzy matching for ido
+(flx-ido-mode +1)
+;; disable ido faces to see flx highlights
+(setq ido-use-faces nil)
+
+;;; smex, remember recently and most frequently used commands
+(require 'smex)
+(setq smex-save-file (expand-file-name ".smex-items" prelude-savefile-dir))
+(smex-initialize)
+(global-set-key (kbd "M-x") 'smex)
+(global-set-key (kbd "M-X") 'smex-major-mode-commands)
+
+(provide 'prelude-ido)
+;;; prelude-ido.el ends here
diff --git a/sample/prelude-modules.el b/sample/prelude-modules.el
index ad0686a..3085b47 100644
--- a/sample/prelude-modules.el
+++ b/sample/prelude-modules.el
@@ -1,5 +1,8 @@
 ;;; Uncomment the modules you'd like to use and restart Prelude afterwards
 
+(require 'prelude-ido)
+;; (require 'prelude-helm)
+
 (require 'prelude-c)
 ;; (require 'prelude-clojure)
 ;; (require 'prelude-coffee)
@@ -9,7 +12,6 @@
 (require 'prelude-erc)
 ;; (require 'prelude-erlang)
 ;; (require 'prelude-haskell)
-;; (require 'prelude-helm)
 (require 'prelude-js)
 ;; (require 'prelude-key-chord)
 ;; (require 'prelude-latex)