diff options
Diffstat (limited to '.emacs.d/lisp')
| -rw-r--r-- | .emacs.d/lisp/php-project.el | 48 | ||||
| -rw-r--r-- | .emacs.d/lisp/yasnippet.el | 3 |
2 files changed, 51 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." |
diff --git a/.emacs.d/lisp/yasnippet.el b/.emacs.d/lisp/yasnippet.el index 1f92adc..5f17465 100644 --- a/.emacs.d/lisp/yasnippet.el +++ b/.emacs.d/lisp/yasnippet.el | |||
| @@ -4306,6 +4306,9 @@ The SNIPPET's markers are preserved." | |||
| 4306 | (forward-line 1) | 4306 | (forward-line 1) |
| 4307 | (let ((indent-line-function | 4307 | (let ((indent-line-function |
| 4308 | (lambda () | 4308 | (lambda () |
| 4309 | ;; We need to be at beginning of line in order to | ||
| 4310 | ;; indent existing whitespace correctly. | ||
| 4311 | (beginning-of-line) | ||
| 4309 | (indent-to-column yas--indent-original-column)))) | 4312 | (indent-to-column yas--indent-original-column)))) |
| 4310 | (yas--indent-region (line-beginning-position) | 4313 | (yas--indent-region (line-beginning-position) |
| 4311 | (point-max) | 4314 | (point-max) |
