Skip to content

Commit

Permalink
enable the helm integration only if helm is present
Browse files Browse the repository at this point in the history
  • Loading branch information
Bozhidar Batsov committed Mar 27, 2012
1 parent c52c922 commit b243f8b
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions projectile.el
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit b243f8b

Please sign in to comment.