diff options
| author | Simeon Simeonov | 2019-05-27 09:57:43 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2019-05-27 09:57:43 +0200 |
| commit | aede1540a05b083908ef17ef4571569e0960dda0 (patch) | |
| tree | b5feddb1b88323e1a56aa3c1920b985895518165 /.emacs.d/lisp/php-project.el | |
| parent | 415d6b9a9e26b7cb0ee8ca6d0ec384841b2359ec (diff) | |
Update php-mode
Diffstat (limited to '.emacs.d/lisp/php-project.el')
| -rw-r--r-- | .emacs.d/lisp/php-project.el | 92 |
1 files changed, 54 insertions, 38 deletions
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el index e12d83a..7ab003e 100644 --- a/.emacs.d/lisp/php-project.el +++ b/.emacs.d/lisp/php-project.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: USAMI Kenta <tadsan@zonu.me> | 5 | ;; Author: USAMI Kenta <tadsan@zonu.me> |
| 6 | ;; Keywords: tools, files | 6 | ;; Keywords: tools, files |
| 7 | ;; URL: https://github.com/emacs-php/php-mode | 7 | ;; URL: https://github.com/emacs-php/php-mode |
| 8 | ;; Version: 1.21.2 | 8 | ;; Version: 1.21.3 |
| 9 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) | 9 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) |
| 10 | ;; License: GPL-3.0-or-later | 10 | ;; License: GPL-3.0-or-later |
| 11 | 11 | ||
| @@ -102,85 +102,90 @@ STRING | |||
| 102 | If the string is an actual directory path, it is set as the absolute path | 102 | If the string is an actual directory path, it is set as the absolute path |
| 103 | of the root directory, not the marker.") | 103 | of the root directory, not the marker.") |
| 104 | (put 'php-project-root 'safe-local-variable | 104 | (put 'php-project-root 'safe-local-variable |
| 105 | #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files))))) | 105 | #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))) |
| 106 | 106 | ||
| 107 | ;;;###autoload | ||
| 108 | (progn | ||
| 109 | (defvar-local php-project-bootstrap-scripts nil | 107 | (defvar-local php-project-bootstrap-scripts nil |
| 110 | "List of path to bootstrap php script file. | 108 | "List of path to bootstrap php script file. |
| 111 | 109 | ||
| 112 | The ideal bootstrap file is silent, it only includes dependent files, | 110 | The ideal bootstrap file is silent, it only includes dependent files, |
| 113 | defines constants, and sets the class loaders.") | 111 | defines constants, and sets the class loaders.") |
| 114 | (put 'php-project-bootstrap-scripts 'safe-local-variable #'php-project--eval-bootstrap-scripts)) | 112 | (put 'php-project-bootstrap-scripts 'safe-local-variable #'php-project--eval-bootstrap-scripts) |
| 115 | 113 | ||
| 116 | ;;;###autoload | ||
| 117 | (progn | ||
| 118 | (defvar-local php-project-php-executable nil | 114 | (defvar-local php-project-php-executable nil |
| 119 | "Path to php executable file.") | 115 | "Path to php executable file.") |
| 120 | (put 'php-project-php-executable 'safe-local-variable | 116 | (put 'php-project-php-executable 'safe-local-variable |
| 121 | #'(lambda (v) (and (stringp v) (file-executable-p v))))) | 117 | #'(lambda (v) (and (stringp v) (file-executable-p v)))) |
| 122 | 118 | ||
| 123 | ;;;###autoload | ||
| 124 | (progn | ||
| 125 | (defvar-local php-project-phan-executable nil | 119 | (defvar-local php-project-phan-executable nil |
| 126 | "Path to phan executable file.") | 120 | "Path to phan executable file.") |
| 127 | (put 'php-project-phan-executable 'safe-local-variable #'php-project--eval-bootstrap-scripts)) | 121 | (put 'php-project-phan-executable 'safe-local-variable #'php-project--eval-bootstrap-scripts) |
| 128 | 122 | ||
| 129 | ;;;###autoload | ||
| 130 | (progn | ||
| 131 | (defvar-local php-project-coding-style nil | 123 | (defvar-local php-project-coding-style nil |
| 132 | "Symbol value of the coding style of the project that PHP major mode refers to. | 124 | "Symbol value of the coding style of the project that PHP major mode refers to. |
| 133 | 125 | ||
| 134 | Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") | 126 | Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") |
| 135 | (put 'php-project-coding-style 'safe-local-variable #'symbolp)) | 127 | (put 'php-project-coding-style 'safe-local-variable #'symbolp) |
| 136 | 128 | ||
| 137 | ;;;###autoload | 129 | (defvar-local php-project-php-file-as-template 'auto |
| 138 | (progn | 130 | " |
| 139 | (defvar php-project-repl nil | 131 | `auto' (default) |
| 132 | Automatically switch to mode for template when HTML tag detected in file. | ||
| 133 | |||
| 134 | `t' | ||
| 135 | Switch all PHP files in that directory to mode for HTML template. | ||
| 136 | |||
| 137 | `nil' | ||
| 138 | Any .php in that directory is just a PHP script. | ||
| 139 | |||
| 140 | \(\(PATTERN . SYMBOL)) | ||
| 141 | Alist of file name pattern regular expressions and the above symbol pairs. | ||
| 142 | PATTERN is regexp pattern. | ||
| 143 | ") | ||
| 144 | (put 'php-project-php-file-as-template 'safe-local-variable #'php-project--validate-php-file-as-template) | ||
| 145 | |||
| 146 | (defvar-local php-project-repl nil | ||
| 140 | "Function name or path to REPL (interactive shell) script.") | 147 | "Function name or path to REPL (interactive shell) script.") |
| 141 | (make-variable-buffer-local 'php-project-repl) | ||
| 142 | (put 'php-project-repl 'safe-local-variable | 148 | (put 'php-project-repl 'safe-local-variable |
| 143 | #'(lambda (v) (or (functionp v) | 149 | #'(lambda (v) (or (functionp v) |
| 144 | (php-project--eval-bootstrap-scripts v))))) | 150 | (php-project--eval-bootstrap-scripts v)))) |
| 145 | 151 | ||
| 146 | ;;;###autoload | 152 | (defvar-local php-project-unit-test nil |
| 147 | (progn | ||
| 148 | (defvar php-project-unit-test nil | ||
| 149 | "Function name or path to unit test script.") | 153 | "Function name or path to unit test script.") |
| 150 | (make-variable-buffer-local 'php-project-unit-test) | ||
| 151 | (put 'php-project-unit-test 'safe-local-variable | 154 | (put 'php-project-unit-test 'safe-local-variable |
| 152 | #'(lambda (v) (or (functionp v) | 155 | #'(lambda (v) (or (functionp v) |
| 153 | (php-project--eval-bootstrap-scripts v))))) | 156 | (php-project--eval-bootstrap-scripts v)))) |
| 154 | 157 | ||
| 155 | ;;;###autoload | 158 | (defvar-local php-project-deploy nil |
| 156 | (progn | ||
| 157 | (defvar php-project-deploy nil | ||
| 158 | "Function name or path to deploy script.") | 159 | "Function name or path to deploy script.") |
| 159 | (make-variable-buffer-local 'php-project-deploy) | ||
| 160 | (put 'php-project-deploy 'safe-local-variable | 160 | (put 'php-project-deploy 'safe-local-variable |
| 161 | #'(lambda (v) (or (functionp v) | 161 | #'(lambda (v) (or (functionp v) |
| 162 | (php-project--eval-bootstrap-scripts v))))) | 162 | (php-project--eval-bootstrap-scripts v)))) |
| 163 | 163 | ||
| 164 | ;;;###autoload | 164 | (defvar-local php-project-build nil |
| 165 | (progn | ||
| 166 | (defvar php-project-build nil | ||
| 167 | "Function name or path to build script.") | 165 | "Function name or path to build script.") |
| 168 | (make-variable-buffer-local 'php-project-build) | ||
| 169 | (put 'php-project-build 'safe-local-variable | 166 | (put 'php-project-build 'safe-local-variable |
| 170 | #'(lambda (v) (or (functionp v) | 167 | #'(lambda (v) (or (functionp v) |
| 171 | (php-project--eval-bootstrap-scripts v))))) | 168 | (php-project--eval-bootstrap-scripts v)))) |
| 172 | 169 | ||
| 173 | ;;;###autoload | 170 | (defvar-local php-project-server-start nil |
| 174 | (progn | ||
| 175 | (defvar php-project-server-start nil | ||
| 176 | "Function name or path to server-start script.") | 171 | "Function name or path to server-start script.") |
| 177 | (make-variable-buffer-local 'php-project-server-start) | ||
| 178 | (put 'php-project-server-start 'safe-local-variable | 172 | (put 'php-project-server-start 'safe-local-variable |
| 179 | #'(lambda (v) (or (functionp v) | 173 | #'(lambda (v) (or (functionp v) |
| 180 | (php-project--eval-bootstrap-scripts v))))) | 174 | (php-project--eval-bootstrap-scripts v))))) |
| 181 | 175 | ||
| 182 | 176 | ||
| 183 | ;; Functions | 177 | ;; Functions |
| 178 | (defun php-project--validate-php-file-as-template (val) | ||
| 179 | "Return T when `VAL' is valid list of safe ." | ||
| 180 | (cond | ||
| 181 | ((null val) t) | ||
| 182 | ((memq val '(t auto)) t) | ||
| 183 | ((listp val) | ||
| 184 | (cl-loop for v in val | ||
| 185 | always (and (consp v) | ||
| 186 | (stringp (car v)) | ||
| 187 | (php-project--validate-php-file-as-template (cdr v))))) | ||
| 188 | (t nil))) | ||
| 184 | 189 | ||
| 185 | (defun php-project--eval-bootstrap-scripts (val) | 190 | (defun php-project--eval-bootstrap-scripts (val) |
| 186 | "Return T when `VAL' is valid list of safe bootstrap php script." | 191 | "Return T when `VAL' is valid list of safe bootstrap php script." |
| @@ -213,6 +218,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") | |||
| 213 | (cons 'root "vendor/bin/phan")))) | 218 | (cons 'root "vendor/bin/phan")))) |
| 214 | (executable-find "phan"))) | 219 | (executable-find "phan"))) |
| 215 | 220 | ||
| 221 | (defun php-project-get-file-html-template-type (filename) | ||
| 222 | "Return symbol T, NIL or `auto' by `FILENAME'." | ||
| 223 | (cond | ||
| 224 | ((not php-project-php-file-as-template) nil) | ||
| 225 | ((eq t php-project-php-file-as-template) t) | ||
| 226 | ((eq 'auto php-project-php-file-as-template) 'auto) | ||
| 227 | ((listp php-project-php-file-as-template) | ||
| 228 | (assoc-default filename php-project-php-file-as-template #'string-match-p)) | ||
| 229 | (t (prog1 nil | ||
| 230 | (warn "php-project-php-file-as-template is unexpected format"))))) | ||
| 231 | |||
| 216 | ;;;###autoload | 232 | ;;;###autoload |
| 217 | (defun php-project-get-bootstrap-scripts () | 233 | (defun php-project-get-bootstrap-scripts () |
| 218 | "Return list of bootstrap script." | 234 | "Return list of bootstrap script." |
