summaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/php-project.el
diff options
context:
space:
mode:
authorSimeon Simeonov2018-03-09 08:28:35 +0100
committerSimeon Simeonov2018-03-09 08:28:35 +0100
commitf12ad4ea469aa95a4f8a5c42a1899b375fa405b6 (patch)
tree33816471d2204d28ab010d0b4c2fac82e11c7b9c /.emacs.d/lisp/php-project.el
parent9119a5a78090d59da4c861c1e6cc1d3939ae9b01 (diff)
Update php-project.el and yasnippet.el
Diffstat (limited to '.emacs.d/lisp/php-project.el')
-rw-r--r--.emacs.d/lisp/php-project.el48
1 files changed, 48 insertions, 0 deletions
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el
index cb04341..c36c81f 100644
--- a/.emacs.d/lisp/php-project.el
+++ b/.emacs.d/lisp/php-project.el
@@ -37,6 +37,16 @@
37;; 37;;
38;; Return list of path to bootstrap script file. 38;; Return list of path to bootstrap script file.
39;; 39;;
40;; ### `php-project-get-php-executable()'
41;;
42;; Return path to PHP executable file with the project settings overriding.
43;;
44;; ### `php-project-get-phan-executable()'
45;;
46;; Return path to Phan executable file with the project settings overriding.
47;; Phan is a static analyzer and LSP server implementation for PHP.
48;; See https://github.com/phan/phan
49;;
40;; ## `.dir-locals.el' support 50;; ## `.dir-locals.el' support
41;; 51;;
42;; - `php-project-coding-style' 52;; - `php-project-coding-style'
@@ -47,6 +57,13 @@
47;; - `php-project-bootstrap-scripts' 57;; - `php-project-bootstrap-scripts'
48;; - List of path to bootstrap file of project. 58;; - List of path to bootstrap file of project.
49;; (ex. (((root . "vendor/autoload.php") (root . "inc/bootstrap.php"))) 59;; (ex. (((root . "vendor/autoload.php") (root . "inc/bootstrap.php")))
60;; - `php-project-php-executable'
61;; - Path to project specific PHP executable file.
62;; - If you want to use a file different from the system wide `php' command.
63;; - `php-project-phan-executable'
64;; - Path to project specific Phan executable file.
65;; - When not specified explicitly, it is automatically searched from
66;; Composer's dependency of the project and `exec-path'.
50;; 67;;
51 68
52;;; Code: 69;;; Code:
@@ -95,6 +112,21 @@ defines constants, and sets the class loaders.")
95 112
96;;;###autoload 113;;;###autoload
97(progn 114(progn
115 (defvar php-project-php-executable nil
116 "Path to php executable file.")
117 (make-variable-buffer-local 'php-project-php-executable)
118 (put 'php-project-php-executable 'safe-local-variable
119 #'(lambda (v) (and (stringp v) (file-executable-p v)))))
120
121;;;###autoload
122(progn
123 (defvar php-project-phan-executable nil
124 "Path to phan executable file.")
125 (make-variable-buffer-local 'php-project-phan-executable)
126 (put 'php-project-phan-executable 'safe-local-variable #'php-project--eval-bootstrap-scripts))
127
128;;;###autoload
129(progn
98 (defvar php-project-coding-style nil 130 (defvar php-project-coding-style nil
99 "Symbol value of the coding style of the project that PHP major mode refers to. 131 "Symbol value of the coding style of the project that PHP major mode refers to.
100 132
@@ -120,6 +152,22 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.")
120 (cl-loop for v in val collect (php-project--eval-bootstrap-scripts v))) 152 (cl-loop for v in val collect (php-project--eval-bootstrap-scripts v)))
121 (t nil))) 153 (t nil)))
122 154
155(defun php-project-get-php-executable ()
156 "Return path to PHP executable file."
157 (cond
158 ((and (stringp php-project-php-executable)
159 (file-executable-p php-project-php-executable))
160 php-project-php-executable)
161 ((boundp 'php-executable) php-executable)
162 (t (executable-find "php"))))
163
164(defun php-project-get-phan-executable ()
165 "Return path to phan executable file."
166 (or (car-safe (php-project--eval-bootstrap-scripts
167 (list php-project-phan-executable
168 (cons 'root "vendor/bin/phan"))))
169 (executable-find "phan")))
170
123;;;###autoload 171;;;###autoload
124(defun php-project-get-bootstrap-scripts () 172(defun php-project-get-bootstrap-scripts ()
125 "Return list of bootstrap script." 173 "Return list of bootstrap script."