diff options
| author | Simeon Simeonov | 2019-12-20 12:02:17 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2019-12-20 12:02:17 +0100 |
| commit | aa6722130316cd9460a5276bd07486887411799a (patch) | |
| tree | 721786dd19f5eeea7529930b68c7a3c473e14380 /.emacs.d/lisp/php-project.el | |
| parent | 447890a7ea96da048fa720d313b32860c995e8bb (diff) | |
Upgrade all modes
Diffstat (limited to '.emacs.d/lisp/php-project.el')
| -rw-r--r-- | .emacs.d/lisp/php-project.el | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el index eb9a50e..18115cc 100644 --- a/.emacs.d/lisp/php-project.el +++ b/.emacs.d/lisp/php-project.el | |||
| @@ -5,8 +5,8 @@ | |||
| 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.4 | 8 | ;; Version: 1.22.1 |
| 9 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) | 9 | ;; Package-Requires: ((emacs "24.3")) |
| 10 | ;; License: GPL-3.0-or-later | 10 | ;; License: GPL-3.0-or-later |
| 11 | 11 | ||
| 12 | ;; This program is free software; you can redistribute it and/or modify | 12 | ;; This program is free software; you can redistribute it and/or modify |
| @@ -72,6 +72,19 @@ | |||
| 72 | ;; Constants | 72 | ;; Constants |
| 73 | (defconst php-project-composer-autoloader "vendor/autoload.php") | 73 | (defconst php-project-composer-autoloader "vendor/autoload.php") |
| 74 | 74 | ||
| 75 | ;; Custom variables | ||
| 76 | (defgroup php-project nil | ||
| 77 | "Major mode for editing PHP code." | ||
| 78 | :tag "PHP Project" | ||
| 79 | :prefix "php-project-" | ||
| 80 | :group 'php) | ||
| 81 | |||
| 82 | (defcustom php-project-auto-detect-etags-file nil | ||
| 83 | "If `T', automatically detect etags file when file is opened." | ||
| 84 | :tag "PHP Project Auto Detect Etags File" | ||
| 85 | :group 'php-project | ||
| 86 | :type 'boolean) | ||
| 87 | |||
| 75 | ;; Variables | 88 | ;; Variables |
| 76 | (defvar php-project-available-root-files | 89 | (defvar php-project-available-root-files |
| 77 | '((projectile ".projectile") | 90 | '((projectile ".projectile") |
| @@ -104,6 +117,12 @@ STRING | |||
| 104 | (put 'php-project-root 'safe-local-variable | 117 | (put 'php-project-root 'safe-local-variable |
| 105 | #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))) | 118 | #'(lambda (v) (or (stringp v) (assq v php-project-available-root-files)))) |
| 106 | 119 | ||
| 120 | (defvar-local php-project-etags-file nil) | ||
| 121 | (put 'php-project-etags-file 'safe-local-variable | ||
| 122 | #'(lambda (v) (or (functionp v) | ||
| 123 | (eq v t) | ||
| 124 | (php-project--eval-bootstrap-scripts v)))) | ||
| 125 | |||
| 107 | (defvar-local php-project-bootstrap-scripts nil | 126 | (defvar-local php-project-bootstrap-scripts nil |
| 108 | "List of path to bootstrap php script file. | 127 | "List of path to bootstrap php script file. |
| 109 | 128 | ||
| @@ -172,7 +191,6 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") | |||
| 172 | (put 'php-project-server-start 'safe-local-variable | 191 | (put 'php-project-server-start 'safe-local-variable |
| 173 | #'(lambda (v) (or (functionp v) | 192 | #'(lambda (v) (or (functionp v) |
| 174 | (php-project--eval-bootstrap-scripts v))))) | 193 | (php-project--eval-bootstrap-scripts v))))) |
| 175 | |||
| 176 | 194 | ||
| 177 | ;; Functions | 195 | ;; Functions |
| 178 | (defun php-project--validate-php-file-as-template (val) | 196 | (defun php-project--validate-php-file-as-template (val) |
| @@ -229,6 +247,17 @@ Typically it is `pear', `drupal', `wordpress', `symfony2' and `psr2'.") | |||
| 229 | (t (prog1 nil | 247 | (t (prog1 nil |
| 230 | (warn "php-project-php-file-as-template is unexpected format"))))) | 248 | (warn "php-project-php-file-as-template is unexpected format"))))) |
| 231 | 249 | ||
| 250 | (defun php-project-apply-local-variables () | ||
| 251 | "Apply php-project variables to local variables." | ||
| 252 | (when (null tags-file-name) | ||
| 253 | (when (or (and php-project-auto-detect-etags-file | ||
| 254 | (null php-project-etags-file)) | ||
| 255 | (eq php-project-etags-file t)) | ||
| 256 | (let ((tags-file (expand-file-name "TAGS" (php-project-get-root-dir)))) | ||
| 257 | (when (file-exists-p tags-file) | ||
| 258 | (setq-local php-project-etags-file tags-file)))) | ||
| 259 | (when php-project-etags-file | ||
| 260 | (setq-local tags-file-name (php-project--eval-bootstrap-scripts php-project-etags-file))))) | ||
| 232 | ;;;###autoload | 261 | ;;;###autoload |
| 233 | (defun php-project-get-bootstrap-scripts () | 262 | (defun php-project-get-bootstrap-scripts () |
| 234 | "Return list of bootstrap script." | 263 | "Return list of bootstrap script." |
