Skip to content

Commit 89cf223

Browse files
committed
Remove dependency to projectile
1 parent dedd0f1 commit 89cf223

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

projectile-variable.el

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;; Version: 0.0.1
88
;; Keywords: project, convenience
99
;; Homepage: https://github.com/zonuexe/projectile-variable
10-
;; Package-Requires: ((emacs "24") (cl-lib "0.5") (projectile "0.14.0"))
10+
;; Package-Requires: ((emacs "24") (cl-lib "0.5"))
1111

1212
;; This file is NOT part of GNU Emacs.
1313

@@ -41,13 +41,32 @@
4141

4242
;;; Code:
4343
(require 'cl-lib)
44-
(require 'projectile)
44+
(require 'projectile nil t)
4545

4646
(defconst projectile-variable--prefix "projectile-variable--")
4747

48+
(defgroup projectile-variable nil
49+
"Store project local variables."
50+
:group 'lisp
51+
:prefix "projectile-variable-")
52+
53+
(defcustom projectile-variable-default-project-root-function #'projectile-project-root
54+
"Default function to retrieve root directory."
55+
:type 'function)
56+
57+
(defvar projectile-variable-project-root-function nil)
58+
59+
(defun projectile-variable--get-root ()
60+
"Return path to root directory the project."
61+
(if projectile-variable-project-root-function
62+
(funcall projectile-variable-project-root-function)
63+
(if (fboundp projectile-variable-default-project-root-function)
64+
(funcall projectile-variable-default-project-root-function)
65+
(error "Function `%s' is not exists" projectile-variable-default-project-root-function))))
66+
4867
(defun projectile-variable--make-symbol ()
4968
"Make symbol for save project local variable."
50-
(intern (concat projectile-variable--prefix (projectile-project-root))))
69+
(intern (concat projectile-variable--prefix (projectile-variable--get-root))))
5170

5271
(defun projectile-variable-plist (&optional prefix)
5372
"Return project local property list. Fiter properties by prefix if PREFIX is not nil."

0 commit comments

Comments
 (0)