Permalink
Browse files

enable the helm integration only if helm is present

  • Loading branch information...
Bozhidar Batsov
Bozhidar Batsov committed Mar 27, 2012
1 parent c52c922 commit b243f8b8c14b6420a48086e32fb5a72b95345e06
Showing with 29 additions and 29 deletions.
  1. +29 −29 projectile.el
View
@@ -6,7 +6,7 @@
;; Author: Bozhidar Batsov
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Projectile
;; Git: git://github.com/bbatsov/projectile.git
-;; Version: 0.4
+;; Version: 0.5
;; Created: 2011-31-07
;; Keywords: project, convenience
;; EmacsWiki: Projectile
@@ -226,37 +226,37 @@
["Regenerate etags" projectile-regenerate-tags])))
;; Helm integration
-(defun helm-c-projectile-list ()
- "Generates a list of files in the current project"
- (projectile-get-project-files
- (projectile-get-project-root)))
-
-(defvar helm-c-projectile-cache nil)
-
-(defvar helm-c-source-projectile
- `((name . "Projectile")
- (init . (lambda ()
- (setq helm-c-projectile-cache
- (helm-c-projectile-list))))
- ;; Needed for filenames with capitals letters.
- (disable-shortcuts)
- (candidates . helm-c-projectile-cache)
- (volatile)
- (keymap . ,helm-generic-files-map)
- (help-message . helm-generic-file-help-message)
- (mode-line . helm-generic-file-mode-line-string)
- (match helm-c-match-on-basename)
- (type . file))
- "Helm source definition")
-
-(defun helm-projectile ()
- "Example function for calling Helm with the projectile file source.
+(when (fboundp 'helm)
+ (defun helm-c-projectile-list ()
+ "Generates a list of files in the current project"
+ (projectile-get-project-files
+ (projectile-get-project-root)))
+
+ (defvar helm-c-projectile-cache nil)
+
+ (defvar helm-c-source-projectile
+ `((name . "Projectile")
+ (init . (lambda ()
+ (setq helm-c-projectile-cache
+ (helm-c-projectile-list))))
+ ;; Needed for filenames with capitals letters.
+ (disable-shortcuts)
+ (candidates . helm-c-projectile-cache)
+ (volatile)
+ (keymap . ,helm-generic-files-map)
+ (help-message . helm-generic-file-help-message)
+ (mode-line . helm-generic-file-mode-line-string)
+ (match helm-c-match-on-basename)
+ (type . file))
+ "Helm source definition")
+
+ (defun helm-projectile ()
+ "Example function for calling Helm with the projectile file source.
Use this function as example and create your own list of Helm sources.
"
- (interactive)
- (helm-other-buffer 'helm-c-source-projectile "*helm projectile*"))
-
+ (interactive)
+ (helm-other-buffer 'helm-c-source-projectile "*helm projectile*")))
;; define minor mode
(define-globalized-minor-mode projectile-global-mode projectile-mode projectile-on)

0 comments on commit b243f8b

Please sign in to comment.