From 523a4851a6c9e4d0c586781c378d90df36ddf29b Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 3 Nov 2013 23:37:40 +0200 Subject: [PATCH] Extract Helm support into a separate module --- README.md | 2 +- core/prelude-core.el | 1 - core/prelude-editor.el | 14 ---------- core/prelude-packages.el | 2 +- modules/prelude-helm.el | 58 +++++++++++++++++++++++++++++++++++++++ sample/prelude-modules.el | 1 + 6 files changed, 61 insertions(+), 17 deletions(-) create mode 100644 modules/prelude-helm.el diff --git a/README.md b/README.md index 395c376..0cd4b57 100644 --- a/README.md +++ b/README.md @@ -293,7 +293,7 @@ Keybinding | Description C-c r | Rename the currently visited file and buffer. C-c t | Open a terminal emulator (`ansi-term`). C-c k | Kill all open buffers except the one you're currently in. -C-c h | Open Helm (a useful means of navigating your buffers and project files). +C-c h | Open Helm (available if you've enabled the `prelude-helm` module). C-c + | Increment integer at point. C-c - | Decrement integer at point. Super-r | Recent files diff --git a/core/prelude-core.el b/core/prelude-core.el index e58cded..cf6e8b3 100644 --- a/core/prelude-core.el +++ b/core/prelude-core.el @@ -405,7 +405,6 @@ Doesn't mess with special buffers." "Press quickly to jump to the beginning of a visible word." "Press quickly to jump to a visible character." "Press quickly to jump to a visible line." - "Press to navigate a project in Helm." "Press to search in Google." "Press to search in GitHub." "Press to search in YouTube." diff --git a/core/prelude-editor.el b/core/prelude-editor.el index 7f1a3a8..a3f0a86 100644 --- a/core/prelude-editor.el +++ b/core/prelude-editor.el @@ -294,20 +294,6 @@ The body of the advice is in BODY." (diminish 'anzu-mode) (global-anzu-mode) -(require 'helm-misc) -(require 'helm-projectile) - -(defun helm-prelude () - "Preconfigured `helm'." - (interactive) - (condition-case nil - (if (projectile-project-root) - (helm-projectile) - ;; otherwise fallback to helm-mini - (helm-mini)) - ;; fall back to helm mini if an error occurs (usually in projectile-project-root) - (error (helm-mini)))) - ;; shorter aliases for ack-and-a-half commands (defalias 'ack 'ack-and-a-half) (defalias 'ack-same 'ack-and-a-half-same) diff --git a/core/prelude-packages.el b/core/prelude-packages.el index 02bdfa2..b6d5e19 100644 --- a/core/prelude-packages.el +++ b/core/prelude-packages.el @@ -45,7 +45,7 @@ '(ace-jump-mode ack-and-a-half anzu dash diminish elisp-slime-nav epl expand-region flx-ido flycheck gist gitconfig-mode gitignore-mode grizzl - guru-mode helm helm-projectile ido-ubiquitous + guru-mode projectile ido-ubiquitous key-chord magit move-text rainbow-mode smartparens smex undo-tree volatile-highlights zenburn-theme) diff --git a/modules/prelude-helm.el b/modules/prelude-helm.el new file mode 100644 index 0000000..42a2459 --- /dev/null +++ b/modules/prelude-helm.el @@ -0,0 +1,58 @@ +;;; prelude-helm.el --- Helm setup +;; +;; Copyright © 2011-2013 Bozhidar Batsov +;; +;; Author: Bozhidar Batsov +;; URL: https://github.com/bbatsov/prelude +;; Version: 1.0.0 +;; Keywords: convenience + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;; Some config for Helm. + +;;; 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-packages '(helm helm-projectile)) + +(require 'helm-misc) +(require 'helm-projectile) + +(defun helm-prelude () + "Preconfigured `helm'." + (interactive) + (condition-case nil + (if (projectile-project-root) + (helm-projectile) + ;; otherwise fallback to `helm-mini' + (helm-mini)) + ;; fall back to helm mini if an error occurs (usually in `projectile-project-root') + (error (helm-mini)))) + +(eval-after-load 'prelude-mode + '(define-key prelude-mode-map (kbd "C-c h") 'helm-prelude)) + +(push "Press to navigate a project in Helm." prelude-tips) + +(provide 'prelude-helm) + +;;; prelude-helm.el ends here diff --git a/sample/prelude-modules.el b/sample/prelude-modules.el index c890fc8..3bfc47c 100644 --- a/sample/prelude-modules.el +++ b/sample/prelude-modules.el @@ -9,6 +9,7 @@ (require 'prelude-erc) ;; (require 'prelude-erlang) ;; (require 'prelude-haskell) +;; (require 'prelude-helm) (require 'prelude-js) ;; (require 'prelude-latex) (require 'prelude-lisp)