diff options
Diffstat (limited to '.emacs.d/lisp/php-mode.el')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 81 |
1 files changed, 53 insertions, 28 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index e1b2597..79bf356 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | ;;; php-mode.el --- Major mode for editing PHP code | 1 | ;;; php-mode.el --- Major mode for editing PHP code |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2018 Friends of Emacs-PHP development | ||
| 3 | ;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad | 4 | ;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad |
| 4 | ;; 2008 Aaron S. Hawley | 5 | ;; 2008 Aaron S. Hawley |
| 5 | ;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz | 6 | ;; 2011, 2012, 2013, 2014, 2015, 2016, 2017 Eric James Michael Ritz |
| @@ -8,14 +9,14 @@ | |||
| 8 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> | 9 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> |
| 9 | ;; URL: https://github.com/emacs-php/php-mode | 10 | ;; URL: https://github.com/emacs-php/php-mode |
| 10 | ;; Keywords: languages php | 11 | ;; Keywords: languages php |
| 11 | ;; Version: 1.19.1 | 12 | ;; Version: 1.20.0 |
| 12 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) | 13 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) |
| 13 | ;; License: GPL-3.0-or-later | 14 | ;; License: GPL-3.0-or-later |
| 14 | 15 | ||
| 15 | (defconst php-mode-version-number "1.19.1" | 16 | (defconst php-mode-version-number "1.20.0" |
| 16 | "PHP Mode version number.") | 17 | "PHP Mode version number.") |
| 17 | 18 | ||
| 18 | (defconst php-mode-modified "2018-08-28" | 19 | (defconst php-mode-modified "2018-12-05" |
| 19 | "PHP Mode build date.") | 20 | "PHP Mode build date.") |
| 20 | 21 | ||
| 21 | ;; This file is free software; you can redistribute it and/or | 22 | ;; This file is free software; you can redistribute it and/or |
| @@ -92,6 +93,7 @@ | |||
| 92 | 93 | ||
| 93 | (eval-when-compile | 94 | (eval-when-compile |
| 94 | (require 'regexp-opt) | 95 | (require 'regexp-opt) |
| 96 | (autoload 'pkg-info-version-info "pkg-info") | ||
| 95 | (defvar c-vsemi-status-unknown-p) | 97 | (defvar c-vsemi-status-unknown-p) |
| 96 | (defvar syntax-propertize-via-font-lock)) | 98 | (defvar syntax-propertize-via-font-lock)) |
| 97 | 99 | ||
| @@ -122,10 +124,20 @@ | |||
| 122 | ;; Local variables | 124 | ;; Local variables |
| 123 | ;;;###autoload | 125 | ;;;###autoload |
| 124 | (defgroup php nil | 126 | (defgroup php nil |
| 125 | "Major mode for editing PHP code." | 127 | "Language support for PHP." |
| 126 | :tag "PHP" | 128 | :tag "PHP" |
| 127 | :prefix "php-" | ||
| 128 | :group 'languages | 129 | :group 'languages |
| 130 | :group 'php | ||
| 131 | :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") | ||
| 132 | :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) | ||
| 133 | |||
| 134 | ;;;###autoload | ||
| 135 | (defgroup php-mode nil | ||
| 136 | "Major mode for editing PHP code." | ||
| 137 | :tag "PHP Mode" | ||
| 138 | :prefix "php-mode-" | ||
| 139 | :group 'languages | ||
| 140 | :group 'php | ||
| 129 | :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") | 141 | :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") |
| 130 | :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) | 142 | :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) |
| 131 | 143 | ||
| @@ -134,13 +146,17 @@ | |||
| 134 | "The location of the PHP executable." | 146 | "The location of the PHP executable." |
| 135 | :type 'string) | 147 | :type 'string) |
| 136 | 148 | ||
| 137 | (defcustom php-default-face 'default | 149 | (define-obsolete-variable-alias 'php-default-face 'php-mode-default-face "1.20.0") |
| 150 | (defcustom php-mode-default-face 'default | ||
| 138 | "Default face in `php-mode' buffers." | 151 | "Default face in `php-mode' buffers." |
| 152 | :group 'php-mode | ||
| 139 | :type 'face) | 153 | :type 'face) |
| 140 | 154 | ||
| 141 | (defcustom php-speedbar-config t | 155 | (define-obsolete-variable-alias 'php-speedbar-config 'php-mode-speedbar-config "1.20.0") |
| 156 | (defcustom php-mode-speedbar-config t | ||
| 142 | "When set to true automatically configures Speedbar to observe PHP files. | 157 | "When set to true automatically configures Speedbar to observe PHP files. |
| 143 | Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\"" | 158 | Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\"" |
| 159 | :group 'php-mode | ||
| 144 | :type 'boolean | 160 | :type 'boolean |
| 145 | :set (lambda (sym val) | 161 | :set (lambda (sym val) |
| 146 | (set-default sym val) | 162 | (set-default sym val) |
| @@ -151,14 +167,17 @@ Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\ | |||
| 151 | (defcustom php-mode-speedbar-open nil | 167 | (defcustom php-mode-speedbar-open nil |
| 152 | "Normally `php-mode' starts with the speedbar closed. | 168 | "Normally `php-mode' starts with the speedbar closed. |
| 153 | Turning this on will open it whenever `php-mode' is loaded." | 169 | Turning this on will open it whenever `php-mode' is loaded." |
| 170 | :group 'php-mode | ||
| 154 | :type 'boolean | 171 | :type 'boolean |
| 155 | :set (lambda (sym val) | 172 | :set (lambda (sym val) |
| 156 | (set-default sym val) | 173 | (set-default sym val) |
| 157 | (when val | 174 | (when val |
| 158 | (speedbar 1)))) | 175 | (speedbar 1)))) |
| 159 | 176 | ||
| 160 | (defcustom php-template-compatibility t | 177 | (define-obsolete-variable-alias 'php-template-compatibility 'php-mode-template-compatibility "1.20.0") |
| 178 | (defcustom php-mode-template-compatibility t | ||
| 161 | "Should detect presence of html tags." | 179 | "Should detect presence of html tags." |
| 180 | :group 'php-mode | ||
| 162 | :type 'boolean) | 181 | :type 'boolean) |
| 163 | 182 | ||
| 164 | (defsubst php-in-string-p () | 183 | (defsubst php-in-string-p () |
| @@ -170,7 +189,7 @@ Turning this on will open it whenever `php-mode' is loaded." | |||
| 170 | (defsubst php-in-string-or-comment-p () | 189 | (defsubst php-in-string-or-comment-p () |
| 171 | (nth 8 (syntax-ppss))) | 190 | (nth 8 (syntax-ppss))) |
| 172 | 191 | ||
| 173 | (defun php-mode-extra-constants-create-regexp(kwds) | 192 | (defun php-mode-extra-constants-create-regexp (kwds) |
| 174 | "Create regexp for the list of extra constant keywords KWDS." | 193 | "Create regexp for the list of extra constant keywords KWDS." |
| 175 | (concat "[^_$]?\\<\\(" | 194 | (concat "[^_$]?\\<\\(" |
| 176 | (regexp-opt | 195 | (regexp-opt |
| @@ -178,7 +197,7 @@ Turning this on will open it whenever `php-mode' is loaded." | |||
| 178 | (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) | 197 | (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) |
| 179 | "\\)\\>[^_]?")) | 198 | "\\)\\>[^_]?")) |
| 180 | 199 | ||
| 181 | (defun php-mode-extra-constants-set(sym value) | 200 | (defun php-mode-extra-constants-set (sym value) |
| 182 | "Apply the list of extra constant keywords `VALUE'. | 201 | "Apply the list of extra constant keywords `VALUE'. |
| 183 | 202 | ||
| 184 | This function is called when the custom variable php-extra-constants | 203 | This function is called when the custom variable php-extra-constants |
| @@ -194,14 +213,18 @@ of constants when set." | |||
| 194 | 'php-mode `((,(php-mode-extra-constants-create-regexp value) 1 'php-constant)))) | 213 | 'php-mode `((,(php-mode-extra-constants-create-regexp value) 1 'php-constant)))) |
| 195 | (set sym value)) | 214 | (set sym value)) |
| 196 | 215 | ||
| 197 | (defcustom php-lineup-cascaded-calls nil | 216 | (define-obsolete-variable-alias 'php-lineup-cascaded-calls 'php-mode-lineup-cascaded-calls "1.20.0") |
| 217 | (defcustom php-mode-lineup-cascaded-calls nil | ||
| 198 | "Indent chained method calls to the previous line." | 218 | "Indent chained method calls to the previous line." |
| 219 | :group 'php-mode | ||
| 199 | :type 'boolean) | 220 | :type 'boolean) |
| 200 | 221 | ||
| 201 | ;;;###autoload | 222 | |
| 202 | (defcustom php-extra-constants '() | 223 | (define-obsolete-variable-alias 'php-extra-constants 'php-mode-extra-constants "1.20.0") |
| 224 | (defcustom php-mode-extra-constants '() | ||
| 203 | "A list of additional strings to treat as PHP constants." | 225 | "A list of additional strings to treat as PHP constants." |
| 204 | :type 'list | 226 | :group 'php-mode |
| 227 | :type '(repeat string) | ||
| 205 | :set 'php-mode-extra-constants-set) | 228 | :set 'php-mode-extra-constants-set) |
| 206 | 229 | ||
| 207 | (defun php-create-regexp-for-method (visibility) | 230 | (defun php-create-regexp-for-method (visibility) |
| @@ -265,10 +288,11 @@ can be used to match against definitions for that classlike." | |||
| 265 | "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) | 288 | "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) |
| 266 | "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") | 289 | "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") |
| 267 | 290 | ||
| 268 | (defcustom php-do-not-use-semantic-imenu t | 291 | (define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0") |
| 292 | (defcustom php-mode-do-not-use-semantic-imenu t | ||
| 269 | "Customize `imenu-create-index-function' for `php-mode'. | 293 | "Customize `imenu-create-index-function' for `php-mode'. |
| 270 | 294 | ||
| 271 | If using `semantic-mode' `imenu-create-index-function' will be | 295 | If using function `semantic-mode' `imenu-create-index-function' will be |
| 272 | set to `semantic-create-imenu-index' due to `c-mode' being its | 296 | set to `semantic-create-imenu-index' due to `c-mode' being its |
| 273 | parent. Set this variable to t if you want to use | 297 | parent. Set this variable to t if you want to use |
| 274 | `imenu-default-create-index-function' even with `semantic-mode' | 298 | `imenu-default-create-index-function' even with `semantic-mode' |
| @@ -394,6 +418,11 @@ This function may interfere with other hooks and other behaviors. | |||
| 394 | In that case set to `NIL'." | 418 | In that case set to `NIL'." |
| 395 | :type 'boolean) | 419 | :type 'boolean) |
| 396 | 420 | ||
| 421 | (defcustom php-mode-disable-parent-mode-hooks t | ||
| 422 | "When set to `T', do not run hooks of parent modes (`java-mode', `c-mode')." | ||
| 423 | :type 'boolean | ||
| 424 | :group 'php-mode) | ||
| 425 | |||
| 397 | (defun php-mode-version () | 426 | (defun php-mode-version () |
| 398 | "Display string describing the version of PHP Mode." | 427 | "Display string describing the version of PHP Mode." |
| 399 | (interactive) | 428 | (interactive) |
| @@ -405,9 +434,9 @@ In that case set to `NIL'." | |||
| 405 | (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") | 434 | (define-obsolete-variable-alias 'php-available-project-root-files 'php-project-available-root-files "1.19.0") |
| 406 | 435 | ||
| 407 | (defvar php-mode-map | 436 | (defvar php-mode-map |
| 408 | (let ((map (make-sparse-keymap))) | 437 | (let ((map (make-sparse-keymap "PHP Mode"))) |
| 409 | ;; (define-key map [menu-bar php] | 438 | ;; Remove menu item for c-mode |
| 410 | ;; (cons "PHP" (make-sparse-keymap "PHP"))) | 439 | (define-key map [menu-bar C] nil) |
| 411 | 440 | ||
| 412 | ;; (define-key map [menu-bar php complete-function] | 441 | ;; (define-key map [menu-bar php complete-function] |
| 413 | ;; '("Complete function name" . php-complete-function)) | 442 | ;; '("Complete function name" . php-complete-function)) |
| @@ -1014,7 +1043,7 @@ this ^ lineup" | |||
| 1014 | (defgroup php-faces nil | 1043 | (defgroup php-faces nil |
| 1015 | "Faces used in PHP Mode" | 1044 | "Faces used in PHP Mode" |
| 1016 | :tag "PHP Faces" | 1045 | :tag "PHP Faces" |
| 1017 | :group 'php | 1046 | :group 'php-mode |
| 1018 | :group 'faces) | 1047 | :group 'faces) |
| 1019 | 1048 | ||
| 1020 | (defface php-string '((t (:inherit font-lock-string-face))) | 1049 | (defface php-string '((t (:inherit font-lock-string-face))) |
| @@ -1234,7 +1263,9 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1234 | "Major mode for editing PHP code. | 1263 | "Major mode for editing PHP code. |
| 1235 | 1264 | ||
| 1236 | \\{php-mode-map}" | 1265 | \\{php-mode-map}" |
| 1237 | 1266 | (when php-mode-disable-parent-mode-hooks | |
| 1267 | (setq-local c-mode-hook nil) | ||
| 1268 | (setq-local java-mode-hook nil)) | ||
| 1238 | (c-initialize-cc-mode t) | 1269 | (c-initialize-cc-mode t) |
| 1239 | (c-init-language-vars php-mode) | 1270 | (c-init-language-vars php-mode) |
| 1240 | (c-common-init 'php-mode) | 1271 | (c-common-init 'php-mode) |
| @@ -1310,7 +1341,6 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1310 | (save-excursion | 1341 | (save-excursion |
| 1311 | (php-syntax-propertize-function (point-min) (point-max)))))) | 1342 | (php-syntax-propertize-function (point-min) (point-max)))))) |
| 1312 | 1343 | ||
| 1313 | |||
| 1314 | (declare-function semantic-create-imenu-index "semantic/imenu" (&optional stream)) | 1344 | (declare-function semantic-create-imenu-index "semantic/imenu" (&optional stream)) |
| 1315 | 1345 | ||
| 1316 | (defvar-mode-local php-mode imenu-create-index-function | 1346 | (defvar-mode-local php-mode imenu-create-index-function |
| @@ -1859,9 +1889,4 @@ The output will appear in the buffer *PHP*." | |||
| 1859 | t) | 1889 | t) |
| 1860 | 1890 | ||
| 1861 | (provide 'php-mode) | 1891 | (provide 'php-mode) |
| 1862 | |||
| 1863 | ;;; php-mode.el ends here | 1892 | ;;; php-mode.el ends here |
| 1864 | |||
| 1865 | ;; Local Variables: | ||
| 1866 | ;; firestarter: ert-run-tests-interactively | ||
| 1867 | ;; End: | ||
