-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-command-recipes-project.el
53 lines (41 loc) · 1.91 KB
/
run-command-recipes-project.el
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
;;; run-command-recipes-project.el --- Operations on project -*- lexical-binding: t; -*-
;; Author: semenInRussia <[email protected]>
;; Version: 0.1.0
;; Keywords: extensions run-command
;; Homepage: https://github.com/semenInRussia/emacs-run-command-recipes
;; 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 this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This very small wrapper on `f' and `projectile'
;;; Code:
(require 'dash)
(require 'f)
(declare-function projectile-acquire-root "projectile")
(declare-function project-root "project")
(declare-function project-current "project")
(defvar projectile-mode)
(defun run-command-recipes-project-root ()
"Return path to project root."
(cond
((and (featurep 'projectile) projectile-mode)
(projectile-acquire-root))
((and (featurep 'project) (project-current))
(project-root (project-current)))
(t default-directory)))
(defun run-command-recipes-project-root-has (entire)
"Return t, when root of current project has ENTIRE (filename or directory)."
(f-exists-p (f-join (run-command-recipes-project-root) entire)))
(defun run-command-recipes-project-root-has-one-of (entires)
"Return t, when root of current project has of ENTIRES.
Entire is filename or directory."
(-any #'run-command-recipes-project-root-has entires))
(provide 'run-command-recipes-project)
;;; run-command-recipes-project.el ends here