File: helm-eproject.el

package info (click to toggle)
eproject-el 1.5+git20180312.068218d-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 204 kB
  • sloc: lisp: 1,092; sh: 10; makefile: 2
file content (86 lines) | stat: -rw-r--r-- 2,868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
;;; helm-eproject.el ---
;;
;; Filename: helm-eproject.el
;; Description:
;; Author: Glauber Alex Dias Prado
;; Author: Thomas Frössman
;; Maintainer:
;; Created: Ter Mar 27 20:26:06 2012 (-0300)
;; Version:
;; Last-Updated: sön sep 02 13:44:27 CEST 2012
;;           By: Thomas Frössman
;; URL: github
;; Keywords: emacs eproject helm complection
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This small utility helps eproject to show the project files under helm
;; perhaps it would be better implemented using helm completion hooks but this
;; is working pretty good for now :).
;;
;;; Install:
;;
;; Add the file somewhere to your load path like ~/elisp and add:
;; (require 'helm-eproject)
;; after you've setup both eproject and helm then just open a file that normal
;; eproject would pick up and voila :), you have to setup helm and eproject
;; for yourself so you can get the most out of these extensions.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Change log:
;;
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; 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, 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 this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:

;; helm support
(require 'helm-files)
(require 'cl)

(defvar helm-eproject-source
  '((name . "Eproject")
    (type . file)
    (match . helm-files-match-only-basename)
    (candidates . (lambda ()
		    (with-helm-current-buffer
		      (when (and (boundp 'eproject-mode) eproject-mode)
			(eproject-list-project-files-relative)))))
    (action . (lambda (candidate)
                (let ((candidate-abs (concat (eproject-root) candidate)))
                  (find-file candidate-abs))))))

(defun helm-eproject ()
  "helps helm to use eproject to find a file"
  (interactive)
  (helm :sources '(helm-eproject-source)
        :buffer "*Helm Eproject*"))

(defun eproject-helm-configure ()
  "Bind C-x f to `helm-eproject'."
  (global-set-key [(control x) (f)] 'helm-eproject))

(provide 'helm-eproject)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; helm-eproject.el ends here