diff options
Diffstat (limited to '.emacs.d/lisp/php-mode.el')
| -rw-r--r-- | .emacs.d/lisp/php-mode.el | 462 |
1 files changed, 67 insertions, 395 deletions
diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 8e72fe3..2fa1ab5 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el | |||
| @@ -9,30 +9,28 @@ | |||
| 9 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> | 9 | ;; Maintainer: USAMI Kenta <tadsan@zonu.me> |
| 10 | ;; URL: https://github.com/emacs-php/php-mode | 10 | ;; URL: https://github.com/emacs-php/php-mode |
| 11 | ;; Keywords: languages php | 11 | ;; Keywords: languages php |
| 12 | ;; Version: 1.21.0 | 12 | ;; Version: 1.21.2 |
| 13 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) | 13 | ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) |
| 14 | ;; License: GPL-3.0-or-later | 14 | ;; License: GPL-3.0-or-later |
| 15 | 15 | ||
| 16 | (defconst php-mode-version-number "1.21.0" | 16 | (defconst php-mode-version-number "1.21.2" |
| 17 | "PHP Mode version number.") | 17 | "PHP Mode version number.") |
| 18 | 18 | ||
| 19 | (defconst php-mode-modified "2019-02-28" | 19 | (defconst php-mode-modified "2019-05-11" |
| 20 | "PHP Mode build date.") | 20 | "PHP Mode build date.") |
| 21 | 21 | ||
| 22 | ;; This file is free software; you can redistribute it and/or | 22 | ;; This program is free software; you can redistribute it and/or modify |
| 23 | ;; modify it under the terms of the GNU General Public License | 23 | ;; it under the terms of the GNU General Public License as published by |
| 24 | ;; as published by the Free Software Foundation; either version 3 | 24 | ;; the Free Software Foundation, either version 3 of the License, or |
| 25 | ;; of the License, or (at your option) any later version. | 25 | ;; (at your option) any later version. |
| 26 | 26 | ||
| 27 | ;; This file is distributed in the hope that it will be useful, | 27 | ;; This program is distributed in the hope that it will be useful, |
| 28 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 28 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 29 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 | ;; GNU General Public License for more details. | 30 | ;; GNU General Public License for more details. |
| 31 | 31 | ||
| 32 | ;; You should have received a copy of the GNU General Public License | 32 | ;; You should have received a copy of the GNU General Public License |
| 33 | ;; along with this file; if not, write to the Free Software | 33 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 34 | ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||
| 35 | ;; 02110-1301, USA. | ||
| 36 | 34 | ||
| 37 | ;;; Commentary: | 35 | ;;; Commentary: |
| 38 | 36 | ||
| @@ -65,6 +63,8 @@ | |||
| 65 | 63 | ||
| 66 | ;;; Code: | 64 | ;;; Code: |
| 67 | 65 | ||
| 66 | (require 'php) | ||
| 67 | (require 'php-face) | ||
| 68 | (require 'cc-mode) | 68 | (require 'cc-mode) |
| 69 | (require 'cc-langs) | 69 | (require 'cc-langs) |
| 70 | 70 | ||
| @@ -80,12 +80,10 @@ | |||
| 80 | (require 'font-lock) | 80 | (require 'font-lock) |
| 81 | (require 'add-log) | 81 | (require 'add-log) |
| 82 | (require 'custom) | 82 | (require 'custom) |
| 83 | (require 'flymake) | ||
| 84 | (require 'etags) | 83 | (require 'etags) |
| 85 | (require 'speedbar) | 84 | (require 'speedbar) |
| 86 | (require 'imenu) | 85 | (require 'imenu) |
| 87 | (require 'nadvice nil t) | 86 | (require 'nadvice nil t) |
| 88 | (require 'package) | ||
| 89 | 87 | ||
| 90 | (require 'cl-lib) | 88 | (require 'cl-lib) |
| 91 | (require 'mode-local) | 89 | (require 'mode-local) |
| @@ -93,14 +91,13 @@ | |||
| 93 | 91 | ||
| 94 | (eval-when-compile | 92 | (eval-when-compile |
| 95 | (require 'regexp-opt) | 93 | (require 'regexp-opt) |
| 96 | (autoload 'pkg-info-version-info "pkg-info") | ||
| 97 | (defvar c-vsemi-status-unknown-p) | 94 | (defvar c-vsemi-status-unknown-p) |
| 98 | (defvar syntax-propertize-via-font-lock)) | 95 | (defvar syntax-propertize-via-font-lock)) |
| 99 | 96 | ||
| 100 | ;; Work around emacs bug#18845, cc-mode expects cl to be loaded | 97 | ;; Work around emacs bug#18845, cc-mode expects cl to be loaded |
| 101 | ;; while php-mode only uses cl-lib (without compatibility aliases) | 98 | ;; while php-mode only uses cl-lib (without compatibility aliases) |
| 102 | (eval-and-compile | 99 | (eval-and-compile |
| 103 | (if (and (= emacs-major-version 24) (>= emacs-minor-version 4)) | 100 | (when (and (= emacs-major-version 24) (>= emacs-minor-version 4)) |
| 104 | (require 'cl))) | 101 | (require 'cl))) |
| 105 | 102 | ||
| 106 | ;; Work around https://github.com/emacs-php/php-mode/issues/310. | 103 | ;; Work around https://github.com/emacs-php/php-mode/issues/310. |
| @@ -120,16 +117,10 @@ | |||
| 120 | ;; need it in php-mode, just return nil. | 117 | ;; need it in php-mode, just return nil. |
| 121 | nil))) | 118 | nil))) |
| 122 | 119 | ||
| 120 | (autoload 'php-mode-debug "php-mode-debug" | ||
| 121 | "Display informations useful for debugging PHP Mode." t) | ||
| 123 | 122 | ||
| 124 | ;; Local variables | 123 | ;; Local variables |
| 125 | ;;;###autoload | ||
| 126 | (defgroup php nil | ||
| 127 | "Language support for PHP." | ||
| 128 | :tag "PHP" | ||
| 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 | 124 | ||
| 134 | ;;;###autoload | 125 | ;;;###autoload |
| 135 | (defgroup php-mode nil | 126 | (defgroup php-mode nil |
| @@ -141,11 +132,6 @@ | |||
| 141 | :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") | 132 | :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") |
| 142 | :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) | 133 | :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) |
| 143 | 134 | ||
| 144 | (defcustom php-executable (or (executable-find "php") | ||
| 145 | "/usr/bin/php") | ||
| 146 | "The location of the PHP executable." | ||
| 147 | :type 'string) | ||
| 148 | |||
| 149 | (define-obsolete-variable-alias 'php-default-face 'php-mode-default-face "1.20.0") | 135 | (define-obsolete-variable-alias 'php-default-face 'php-mode-default-face "1.20.0") |
| 150 | (defcustom php-mode-default-face 'default | 136 | (defcustom php-mode-default-face 'default |
| 151 | "Default face in `php-mode' buffers." | 137 | "Default face in `php-mode' buffers." |
| @@ -180,20 +166,11 @@ Turning this on will open it whenever `php-mode' is loaded." | |||
| 180 | :group 'php-mode | 166 | :group 'php-mode |
| 181 | :type 'boolean) | 167 | :type 'boolean) |
| 182 | 168 | ||
| 183 | (defsubst php-in-string-p () | ||
| 184 | (nth 3 (syntax-ppss))) | ||
| 185 | |||
| 186 | (defsubst php-in-comment-p () | ||
| 187 | (nth 4 (syntax-ppss))) | ||
| 188 | |||
| 189 | (defsubst php-in-string-or-comment-p () | ||
| 190 | (nth 8 (syntax-ppss))) | ||
| 191 | |||
| 192 | (defun php-mode-extra-constants-create-regexp (kwds) | 169 | (defun php-mode-extra-constants-create-regexp (kwds) |
| 193 | "Create regexp for the list of extra constant keywords KWDS." | 170 | "Create regexp for the list of extra constant keywords KWDS." |
| 194 | (concat "[^_$]?\\<\\(" | 171 | (concat "[^_$]?\\<\\(" |
| 195 | (regexp-opt | 172 | (regexp-opt |
| 196 | (append kwds | 173 | (append kwds |
| 197 | (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) | 174 | (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants))) |
| 198 | "\\)\\>[^_]?")) | 175 | "\\)\\>[^_]?")) |
| 199 | 176 | ||
| @@ -227,67 +204,6 @@ of constants when set." | |||
| 227 | :type '(repeat string) | 204 | :type '(repeat string) |
| 228 | :set 'php-mode-extra-constants-set) | 205 | :set 'php-mode-extra-constants-set) |
| 229 | 206 | ||
| 230 | (defun php-create-regexp-for-method (visibility) | ||
| 231 | "Make a regular expression for methods with the given VISIBILITY. | ||
| 232 | |||
| 233 | VISIBILITY must be a string that names the visibility for a PHP | ||
| 234 | method, e.g. 'public'. The parameter VISIBILITY can itself also | ||
| 235 | be a regular expression. | ||
| 236 | |||
| 237 | The regular expression this function returns will check for other | ||
| 238 | keywords that can appear in method signatures, e.g. 'final' and | ||
| 239 | 'static'. The regular expression will have one capture group | ||
| 240 | which will be the name of the method." | ||
| 241 | (concat | ||
| 242 | ;; Initial space with possible 'abstract' or 'final' keywords | ||
| 243 | "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" | ||
| 244 | ;; 'static' keyword may come either before or after visibility | ||
| 245 | "\\(?:" visibility "\\(?:\\s-+static\\)?\\|\\(?:static\\s-+\\)?" visibility "\\)\\s-+" | ||
| 246 | ;; Make sure 'function' comes next with some space after | ||
| 247 | "function\\s-+" | ||
| 248 | ;; Capture the name as the first group and the regexp and make sure | ||
| 249 | ;; by the end we see the opening parenthesis for the parameters. | ||
| 250 | "\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(")) | ||
| 251 | |||
| 252 | (defun php-create-regexp-for-classlike (type) | ||
| 253 | "Accepts a `TYPE' of a 'classlike' object as a string, such as | ||
| 254 | 'class' or 'interface', and returns a regexp as a string which | ||
| 255 | can be used to match against definitions for that classlike." | ||
| 256 | (concat | ||
| 257 | ;; First see if 'abstract' or 'final' appear, although really these | ||
| 258 | ;; are not valid for all values of `type' that the function | ||
| 259 | ;; accepts. | ||
| 260 | "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" | ||
| 261 | ;; The classlike type | ||
| 262 | type | ||
| 263 | ;; Its name, which is the first captured group in the regexp. We | ||
| 264 | ;; allow backslashes in the name to handle namespaces, but again | ||
| 265 | ;; this is not necessarily correct for all values of `type'. | ||
| 266 | "\\s-+\\(\\(?:\\sw\\|\\\\\\|\\s_\\)+\\)")) | ||
| 267 | |||
| 268 | (defvar php-imenu-generic-expression | ||
| 269 | `(("Namespaces" | ||
| 270 | ,(php-create-regexp-for-classlike "namespace") 1) | ||
| 271 | ("Classes" | ||
| 272 | ,(php-create-regexp-for-classlike "class") 1) | ||
| 273 | ("Interfaces" | ||
| 274 | ,(php-create-regexp-for-classlike "interface") 1) | ||
| 275 | ("Traits" | ||
| 276 | ,(php-create-regexp-for-classlike "trait") 1) | ||
| 277 | ("All Methods" | ||
| 278 | ,(php-create-regexp-for-method "\\(?:\\sw\\|\\s_\\)+") 1) | ||
| 279 | ("Private Methods" | ||
| 280 | ,(php-create-regexp-for-method "private") 1) | ||
| 281 | ("Protected Methods" | ||
| 282 | ,(php-create-regexp-for-method "protected") 1) | ||
| 283 | ("Public Methods" | ||
| 284 | ,(php-create-regexp-for-method "public") 1) | ||
| 285 | ("Anonymous Functions" | ||
| 286 | "\\<\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*=\\s-*function\\s-*(" 1) | ||
| 287 | ("Named Functions" | ||
| 288 | "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) | ||
| 289 | "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") | ||
| 290 | |||
| 291 | (define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0") | 207 | (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 | 208 | (defcustom php-mode-do-not-use-semantic-imenu t |
| 293 | "Customize `imenu-create-index-function' for `php-mode'. | 209 | "Customize `imenu-create-index-function' for `php-mode'. |
| @@ -299,34 +215,6 @@ parent. Set this variable to t if you want to use | |||
| 299 | enabled." | 215 | enabled." |
| 300 | :type 'boolean) | 216 | :type 'boolean) |
| 301 | 217 | ||
| 302 | (defcustom php-site-url "https://secure.php.net/" | ||
| 303 | "Default PHP.net site URL. | ||
| 304 | |||
| 305 | The URL to use open PHP manual and search word. | ||
| 306 | You can find a mirror site closer to you." | ||
| 307 | :type 'string | ||
| 308 | :link '(url-link :tag "List of Mirror Sites" "https://secure.php.net/mirrors.php")) | ||
| 309 | |||
| 310 | (defcustom php-manual-url 'en | ||
| 311 | "URL at which to find PHP manual. | ||
| 312 | You can replace \"en\" with your ISO language code." | ||
| 313 | :type '(choice (const :tag "English" 'en) | ||
| 314 | (const :tag "Brazilian Portuguese" 'pt_BR) | ||
| 315 | (const :tag "Chinese (Simplified)" 'zh) | ||
| 316 | (const :tag "French" 'fr) | ||
| 317 | (const :tag "German" 'de) | ||
| 318 | (const :tag "Japanese" 'ja) | ||
| 319 | (const :tag "Romanian" 'ro) | ||
| 320 | (const :tag "Russian" 'ru) | ||
| 321 | (const :tag "Spanish" 'es) | ||
| 322 | (const :tag "Turkish" 'tr) | ||
| 323 | (string :tag "PHP manual URL"))) | ||
| 324 | |||
| 325 | (defcustom php-search-url nil | ||
| 326 | "URL at which to search for documentation on a word." | ||
| 327 | :type '(choice (string :tag "URL to search PHP documentation") | ||
| 328 | (const :tag "Use `php-site-url' variable" nil))) | ||
| 329 | |||
| 330 | (defcustom php-completion-file "" | 218 | (defcustom php-completion-file "" |
| 331 | "Path to the file which contains the function names known to PHP." | 219 | "Path to the file which contains the function names known to PHP." |
| 332 | :type 'string) | 220 | :type 'string) |
| @@ -524,6 +412,10 @@ In that case set to `NIL'." | |||
| 524 | (left-assoc "\\" "::" "->") | 412 | (left-assoc "\\" "::" "->") |
| 525 | (prefix "\\" "::"))) | 413 | (prefix "\\" "::"))) |
| 526 | 414 | ||
| 415 | (c-lang-defconst c-operators | ||
| 416 | php (delete '(postfix-if-paren "<" ">") | ||
| 417 | (c-lang-const c-operators))) | ||
| 418 | |||
| 527 | ;; Allow '\' when scanning from open brace back to defining | 419 | ;; Allow '\' when scanning from open brace back to defining |
| 528 | ;; construct like class | 420 | ;; construct like class |
| 529 | (c-lang-defconst c-block-prefix-disallowed-chars | 421 | (c-lang-defconst c-block-prefix-disallowed-chars |
| @@ -580,40 +472,35 @@ PHP does not have an \"enum\"-like keyword." | |||
| 580 | php '("implements" "extends")) | 472 | php '("implements" "extends")) |
| 581 | 473 | ||
| 582 | (c-lang-defconst c-type-list-kwds | 474 | (c-lang-defconst c-type-list-kwds |
| 583 | php '("new" "use" "implements" "extends" "namespace" "instanceof" "insteadof")) | 475 | php '("@new" ;; @new is *NOT* language construct, it's workaround for coloring. |
| 476 | "new" "use" "implements" "extends" "namespace" "instanceof" "insteadof")) | ||
| 584 | 477 | ||
| 585 | (c-lang-defconst c-ref-list-kwds | 478 | (c-lang-defconst c-ref-list-kwds |
| 586 | php nil) | 479 | php nil) |
| 587 | 480 | ||
| 588 | (c-lang-defconst c-block-stmt-2-kwds | 481 | (c-lang-defconst c-block-stmt-2-kwds |
| 589 | php (append '("elseif" "foreach" "declare") | 482 | php '("catch" "declare" "elseif" "for" "foreach" "if" "switch" "while")) |
| 590 | (remove "synchronized" (c-lang-const c-block-stmt-2-kwds)))) | ||
| 591 | 483 | ||
| 592 | (c-lang-defconst c-simple-stmt-kwds | 484 | (c-lang-defconst c-simple-stmt-kwds |
| 593 | php (append '("include" "include_once" "require" "require_once" | 485 | php '("break" "continue" "die" "echo" "exit" "goto" "return" "throw" |
| 594 | "echo" "print" "die" "exit") | 486 | "include" "include_once" "print" "require" "require_once")) |
| 595 | (c-lang-const c-simple-stmt-kwds))) | ||
| 596 | 487 | ||
| 597 | (c-lang-defconst c-constant-kwds | 488 | (c-lang-defconst c-constant-kwds |
| 598 | php '("true" | 489 | php '("true" "false" "null")) |
| 599 | "false" | ||
| 600 | "null")) | ||
| 601 | 490 | ||
| 602 | (c-lang-defconst c-lambda-kwds | 491 | (c-lang-defconst c-lambda-kwds |
| 603 | php '("function" | 492 | php '("function" "use")) |
| 604 | "use")) | ||
| 605 | 493 | ||
| 606 | (c-lang-defconst c-other-block-decl-kwds | 494 | (c-lang-defconst c-other-block-decl-kwds |
| 607 | php '("namespace")) | 495 | php '("namespace")) |
| 608 | 496 | ||
| 609 | (c-lang-defconst c-other-kwds | 497 | (c-lang-defconst c-other-kwds |
| 610 | "Keywords not accounted for by any other `*-kwds' language constant." | 498 | "Keywords not accounted for by any other `*-kwds' language constant." |
| 611 | php '( | 499 | php |
| 500 | '( | ||
| 612 | "__halt_compiler" | 501 | "__halt_compiler" |
| 613 | "and" | 502 | "and" |
| 614 | "array" | 503 | "array" |
| 615 | "callable" | ||
| 616 | "iterable" | ||
| 617 | "as" | 504 | "as" |
| 618 | "break" | 505 | "break" |
| 619 | "catch" | 506 | "catch" |
| @@ -627,6 +514,7 @@ PHP does not have an \"enum\"-like keyword." | |||
| 627 | "endswitch" | 514 | "endswitch" |
| 628 | "endwhile" | 515 | "endwhile" |
| 629 | "eval" | 516 | "eval" |
| 517 | "fn" ;; NOT c-lambda-kwds | ||
| 630 | "global" | 518 | "global" |
| 631 | "isset" | 519 | "isset" |
| 632 | "list" | 520 | "list" |
| @@ -656,6 +544,12 @@ PHP does not have an \"enum\"-like keyword." | |||
| 656 | (c-lang-defconst c-recognize-<>-arglists | 544 | (c-lang-defconst c-recognize-<>-arglists |
| 657 | php nil) | 545 | php nil) |
| 658 | 546 | ||
| 547 | (c-lang-defconst c-<>-type-kwds | ||
| 548 | php nil) | ||
| 549 | |||
| 550 | (c-lang-defconst c-inside-<>-type-kwds | ||
| 551 | php nil) | ||
| 552 | |||
| 659 | (c-lang-defconst c-enums-contain-decls | 553 | (c-lang-defconst c-enums-contain-decls |
| 660 | php nil) | 554 | php nil) |
| 661 | 555 | ||
| @@ -679,6 +573,13 @@ might be to handle switch and goto labels differently." | |||
| 679 | php (cl-remove-if (lambda (elm) (and (listp elm) (equal (car elm) "\\s|"))) | 573 | php (cl-remove-if (lambda (elm) (and (listp elm) (equal (car elm) "\\s|"))) |
| 680 | (c-lang-const c-basic-matchers-before php))) | 574 | (c-lang-const c-basic-matchers-before php))) |
| 681 | 575 | ||
| 576 | (c-lang-defconst c-basic-matchers-after | ||
| 577 | php (cl-remove-if (lambda (elm) (and (listp elm) (memq 'c-annotation-face elm))) | ||
| 578 | (c-lang-const c-basic-matchers-after php))) | ||
| 579 | |||
| 580 | (c-lang-defconst c-opt-<>-sexp-key | ||
| 581 | php nil) | ||
| 582 | |||
| 682 | (defun php-lineup-cascaded-calls (langelem) | 583 | (defun php-lineup-cascaded-calls (langelem) |
| 683 | "Line up chained methods using `c-lineup-cascaded-calls', | 584 | "Line up chained methods using `c-lineup-cascaded-calls', |
| 684 | but only if the setting is enabled" | 585 | but only if the setting is enabled" |
| @@ -788,10 +689,10 @@ but only if the setting is enabled" | |||
| 788 | "Move to the beginning of the ARGth PHP function from point. | 689 | "Move to the beginning of the ARGth PHP function from point. |
| 789 | Implements PHP version of `beginning-of-defun-function'." | 690 | Implements PHP version of `beginning-of-defun-function'." |
| 790 | (interactive "p") | 691 | (interactive "p") |
| 791 | (let ((arg (or arg 1))) | 692 | (let (found-p (arg (or arg 1))) |
| 792 | (while (> arg 0) | 693 | (while (> arg 0) |
| 793 | (re-search-backward php-beginning-of-defun-regexp | 694 | (setq found-p (re-search-backward php-beginning-of-defun-regexp |
| 794 | nil 'noerror) | 695 | nil 'noerror)) |
| 795 | (setq arg (1- arg))) | 696 | (setq arg (1- arg))) |
| 796 | (while (< arg 0) | 697 | (while (< arg 0) |
| 797 | (end-of-line 1) | 698 | (end-of-line 1) |
| @@ -800,9 +701,10 @@ Implements PHP version of `beginning-of-defun-function'." | |||
| 800 | (forward-list 2) | 701 | (forward-list 2) |
| 801 | (forward-line 1) | 702 | (forward-line 1) |
| 802 | (if (eq opoint (point)) | 703 | (if (eq opoint (point)) |
| 803 | (re-search-forward php-beginning-of-defun-regexp | 704 | (setq found-p (re-search-forward php-beginning-of-defun-regexp |
| 804 | nil 'noerror)) | 705 | nil 'noerror))) |
| 805 | (setq arg (1+ arg)))))) | 706 | (setq arg (1+ arg)))) |
| 707 | (not (null found-p)))) | ||
| 806 | 708 | ||
| 807 | (defun php-end-of-defun (&optional arg) | 709 | (defun php-end-of-defun (&optional arg) |
| 808 | "Move the end of the ARGth PHP function from point. | 710 | "Move the end of the ARGth PHP function from point. |
| @@ -988,7 +890,7 @@ this ^ lineup" | |||
| 988 | "Build a regular expression for the end of a heredoc started by the string HEREDOC-START." | 890 | "Build a regular expression for the end of a heredoc started by the string HEREDOC-START." |
| 989 | ;; Extract just the identifier without <<< and quotes. | 891 | ;; Extract just the identifier without <<< and quotes. |
| 990 | (string-match "\\_<.+?\\_>" heredoc-start) | 892 | (string-match "\\_<.+?\\_>" heredoc-start) |
| 991 | (concat "^\\(" (match-string 0 heredoc-start) "\\)\\W")) | 893 | (concat "^\\s-*\\(" (match-string 0 heredoc-start) "\\)\\W")) |
| 992 | 894 | ||
| 993 | (defun php-syntax-propertize-function (start end) | 895 | (defun php-syntax-propertize-function (start end) |
| 994 | "Apply propertize rules from START to END." | 896 | "Apply propertize rules from START to END." |
| @@ -1000,12 +902,7 @@ this ^ lineup" | |||
| 1000 | (while (re-search-forward "['\"]" end t) | 902 | (while (re-search-forward "['\"]" end t) |
| 1001 | (when (php-in-comment-p) | 903 | (when (php-in-comment-p) |
| 1002 | (c-put-char-property (match-beginning 0) | 904 | (c-put-char-property (match-beginning 0) |
| 1003 | 'syntax-table (string-to-syntax "_")))) | 905 | 'syntax-table (string-to-syntax "_"))))) |
| 1004 | (funcall | ||
| 1005 | (syntax-propertize-rules | ||
| 1006 | ("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) | ||
| 1007 | ("\\('\\)\\(\\\\.\\|[^'\n\\]\\)*\\('\\)" (1 "\"") (3 "\""))) | ||
| 1008 | start end)) | ||
| 1009 | 906 | ||
| 1010 | (defun php-heredoc-syntax () | 907 | (defun php-heredoc-syntax () |
| 1011 | "Mark the boundaries of searched heredoc." | 908 | "Mark the boundaries of searched heredoc." |
| @@ -1041,106 +938,6 @@ this ^ lineup" | |||
| 1041 | (easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands" | 938 | (easy-menu-define php-mode-menu php-mode-map "PHP Mode Commands" |
| 1042 | (cons "PHP" (c-lang-const c-mode-menu php))) | 939 | (cons "PHP" (c-lang-const c-mode-menu php))) |
| 1043 | 940 | ||
| 1044 | |||
| 1045 | ;; Faces | ||
| 1046 | |||
| 1047 | ;;;###autoload | ||
| 1048 | (defgroup php-faces nil | ||
| 1049 | "Faces used in PHP Mode" | ||
| 1050 | :tag "PHP Faces" | ||
| 1051 | :group 'php-mode | ||
| 1052 | :group 'faces) | ||
| 1053 | |||
| 1054 | (defface php-string '((t (:inherit font-lock-string-face))) | ||
| 1055 | "PHP Mode face used to highlight string literals." | ||
| 1056 | :group 'php-faces) | ||
| 1057 | |||
| 1058 | (defface php-keyword '((t (:inherit font-lock-keyword-face))) | ||
| 1059 | "PHP Mode face used to highlight keywords." | ||
| 1060 | :group 'php-faces) | ||
| 1061 | |||
| 1062 | (defface php-builtin '((t (:inherit font-lock-builtin-face))) | ||
| 1063 | "PHP Mode face used to highlight builtins." | ||
| 1064 | :group 'php-faces) | ||
| 1065 | |||
| 1066 | (defface php-function-name '((t (:inherit font-lock-function-name-face))) | ||
| 1067 | "PHP Mode face used to highlight function names." | ||
| 1068 | :group 'php-faces) | ||
| 1069 | |||
| 1070 | (defface php-function-call '((t (:inherit default))) | ||
| 1071 | "PHP Mode face used to highlight function names in calles." | ||
| 1072 | :group 'php-faces) | ||
| 1073 | |||
| 1074 | (defface php-method-call '((t (:inherit php-function-call))) | ||
| 1075 | "PHP Mode face used to highlight method names in calles." | ||
| 1076 | :group 'php-faces) | ||
| 1077 | |||
| 1078 | (defface php-static-method-call '((t (:inherit php-method-call))) | ||
| 1079 | "PHP Mode face used to highlight static method names in calles." | ||
| 1080 | :group 'php-faces) | ||
| 1081 | |||
| 1082 | (defface php-variable-name '((t (:inherit font-lock-variable-name-face))) | ||
| 1083 | "PHP Mode face used to highlight variable names." | ||
| 1084 | :group 'php-faces) | ||
| 1085 | |||
| 1086 | (defface php-property-name '((t (:inherit php-variable-name))) | ||
| 1087 | "PHP Mode face used to highlight property names." | ||
| 1088 | :group 'php-faces) | ||
| 1089 | |||
| 1090 | (defface php-variable-sigil '((t (:inherit default))) | ||
| 1091 | "PHP Mode face used to highlight variable sigils ($)." | ||
| 1092 | :group 'php-faces) | ||
| 1093 | |||
| 1094 | (defface php-object-op '((t (:inherit default))) | ||
| 1095 | "PHP Mode face used to object operators (->)." | ||
| 1096 | :group 'php-faces) | ||
| 1097 | |||
| 1098 | (defface php-paamayim-nekudotayim '((t (:inherit default))) | ||
| 1099 | "PHP Mode face used to highlight \"Paamayim Nekudotayim\" scope resolution operators (::)." | ||
| 1100 | :group 'php-faces) | ||
| 1101 | |||
| 1102 | (defface php-type '((t (:inherit font-lock-type-face))) | ||
| 1103 | "PHP Mode face used to highlight types." | ||
| 1104 | :group 'php-faces) | ||
| 1105 | |||
| 1106 | (defface php-constant '((t (:inherit font-lock-constant-face))) | ||
| 1107 | "PHP Mode face used to highlight constants." | ||
| 1108 | :group 'php-faces) | ||
| 1109 | |||
| 1110 | (defface php-$this '((t (:inherit php-constant))) | ||
| 1111 | "PHP Mode face used to highlight $this variables." | ||
| 1112 | :group 'php-faces) | ||
| 1113 | |||
| 1114 | (defface php-$this-sigil '((t (:inherit php-constant))) | ||
| 1115 | "PHP Mode face used to highlight sigils($) of $this variable." | ||
| 1116 | :group 'php-faces) | ||
| 1117 | |||
| 1118 | (defface php-php-tag '((t (:inherit font-lock-preprocessor-face))) | ||
| 1119 | "PHP Mode face used to highlight PHP tags." | ||
| 1120 | :group 'php-faces) | ||
| 1121 | |||
| 1122 | (defface php-doc-annotation-tag '((t . (:inherit font-lock-constant-face))) | ||
| 1123 | "Face used to highlight annotation tags in doc-comment." | ||
| 1124 | :group 'php-faces) | ||
| 1125 | |||
| 1126 | (defface php-doc-variable-sigil '((t (:inherit font-lock-variable-name-face))) | ||
| 1127 | "PHP Mode face used to highlight variable sigils($)." | ||
| 1128 | :group 'php-faces) | ||
| 1129 | |||
| 1130 | (defface php-doc-$this '((t (:inherit php-type))) | ||
| 1131 | "PHP Mode face used to highlight $this variable in doc-comment." | ||
| 1132 | :group 'php-faces) | ||
| 1133 | |||
| 1134 | (defface php-doc-$this-sigil '((t (:inherit php-type))) | ||
| 1135 | "PHP Mode face used to highlight sigil of $this variable in doc-comment." | ||
| 1136 | :group 'php-faces) | ||
| 1137 | |||
| 1138 | (defface php-doc-class-name '((t (:inherit php-string))) | ||
| 1139 | "Face used to class names in doc-comment." | ||
| 1140 | :group 'php-faces) | ||
| 1141 | |||
| 1142 | (define-obsolete-face-alias 'php-annotations-annotation-face 'php-doc-annotation-tag "1.19.0") | ||
| 1143 | |||
| 1144 | (defvar-local php-mode--delayed-set-style nil) | 941 | (defvar-local php-mode--delayed-set-style nil) |
| 1145 | 942 | ||
| 1146 | (defun php-set-style (stylename &optional dont-override) | 943 | (defun php-set-style (stylename &optional dont-override) |
| @@ -1199,70 +996,6 @@ After setting the stylevars run hooks according to STYLENAME | |||
| 1199 | (prog1 (php-set-style (symbol-name coding-style)) | 996 | (prog1 (php-set-style (symbol-name coding-style)) |
| 1200 | (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay))))) | 997 | (remove-hook 'hack-local-variables-hook #'php-mode-set-style-delay))))) |
| 1201 | 998 | ||
| 1202 | (defun php-mode-debug--buffer (&optional command &rest args) | ||
| 1203 | "Return buffer for php-mode-debug, and execute `COMMAND' with `ARGS'." | ||
| 1204 | (with-current-buffer (get-buffer-create "*PHP Mode DEBUG*") | ||
| 1205 | (cl-case command | ||
| 1206 | (init (erase-buffer) | ||
| 1207 | (goto-address-mode)) | ||
| 1208 | (top (goto-char (point-min))) | ||
| 1209 | (insert (goto-char (point-max)) | ||
| 1210 | (apply #'insert args))) | ||
| 1211 | (current-buffer))) | ||
| 1212 | |||
| 1213 | (defun php-mode-debug--message (format-string &rest args) | ||
| 1214 | "Write message `FORMAT-STRING' and `ARGS' to debug buffer, like `message'." | ||
| 1215 | (declare (indent 1)) | ||
| 1216 | (php-mode-debug--buffer 'insert (apply #'format format-string args) "\n")) | ||
| 1217 | |||
| 1218 | (declare-function custom-group-members "cus-edit" (symbol groups-only)) | ||
| 1219 | |||
| 1220 | (defun php-mode-debug () | ||
| 1221 | "Display informations useful for debugging PHP Mode." | ||
| 1222 | (interactive) | ||
| 1223 | (require 'cus-edit) | ||
| 1224 | (require 'pkg-info nil t) | ||
| 1225 | (php-mode-debug--buffer 'init) | ||
| 1226 | (php-mode-debug--message "Feel free to report on GitHub what you noticed!") | ||
| 1227 | (php-mode-debug--message "https://github.com/emacs-php/php-mode/issues/new") | ||
| 1228 | (php-mode-debug--message "") | ||
| 1229 | (php-mode-debug--message "Pasting the following information on the issue will help us to investigate the cause.") | ||
| 1230 | (php-mode-debug--message "```") | ||
| 1231 | (php-mode-debug--message "--- PHP-MODE DEBUG BEGIN ---") | ||
| 1232 | (php-mode-debug--message "versions: %s; %s" (emacs-version) (php-mode-version)) | ||
| 1233 | (php-mode-debug--message "package-version: %s" | ||
| 1234 | (if (fboundp 'pkg-info) | ||
| 1235 | (pkg-info-version-info 'php-mode) | ||
| 1236 | (let ((pkg (and (boundp 'package-alist) | ||
| 1237 | (cadr (assq 'php-mode package-alist))))) | ||
| 1238 | (when (and pkg (member (package-desc-status pkg) '("unsigned" "dependency"))) | ||
| 1239 | (package-version-join (package-desc-version pkg)))))) | ||
| 1240 | |||
| 1241 | (php-mode-debug--message "major-mode: %s" major-mode) | ||
| 1242 | (php-mode-debug--message "minor-modes: %s" | ||
| 1243 | (cl-loop for s in minor-mode-list | ||
| 1244 | unless (string-match-p "global" (symbol-name s)) | ||
| 1245 | if (and (boundp s) (symbol-value s)) | ||
| 1246 | collect s)) | ||
| 1247 | (php-mode-debug--message "variables: %s" | ||
| 1248 | (cl-loop for v in '(indent-tabs-mode tab-width) | ||
| 1249 | collect (list v (symbol-value v)))) | ||
| 1250 | (php-mode-debug--message "custom variables: %s" | ||
| 1251 | (cl-loop for (v type) in (custom-group-members 'php nil) | ||
| 1252 | if (eq type 'custom-variable) | ||
| 1253 | collect (list v (symbol-value v)))) | ||
| 1254 | (php-mode-debug--message "c-indentation-style: %s" c-indentation-style) | ||
| 1255 | (php-mode-debug--message "c-style-variables: %s" | ||
| 1256 | (cl-loop for v in c-style-variables | ||
| 1257 | unless (memq v '(c-doc-comment-style c-offsets-alist)) | ||
| 1258 | collect (list v (symbol-value v)))) | ||
| 1259 | (php-mode-debug--message "c-doc-comment-style: %s" c-doc-comment-style) | ||
| 1260 | (php-mode-debug--message "c-offsets-alist: %s" c-offsets-alist) | ||
| 1261 | (php-mode-debug--message "--- PHP-MODE DEBUG END ---") | ||
| 1262 | (php-mode-debug--message "```\n") | ||
| 1263 | (php-mode-debug--message "Thank you!") | ||
| 1264 | (pop-to-buffer (php-mode-debug--buffer 'top))) | ||
| 1265 | |||
| 1266 | ;;;###autoload | 999 | ;;;###autoload |
| 1267 | (define-derived-mode php-mode c-mode "PHP" | 1000 | (define-derived-mode php-mode c-mode "PHP" |
| 1268 | "Major mode for editing PHP code. | 1001 | "Major mode for editing PHP code. |
| @@ -1657,21 +1390,16 @@ a completion list." | |||
| 1657 | ;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but | 1390 | ;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but |
| 1658 | ;; not in $obj->var() | 1391 | ;; not in $obj->var() |
| 1659 | ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call)) | 1392 | ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call)) |
| 1393 | ("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign)) | ||
| 1660 | 1394 | ||
| 1661 | ;; Highlight special variables | 1395 | ;; Highlight special variables |
| 1662 | ("\\(\\$\\)\\(this\\|that\\)\\_>" (1 'php-$this-sigil) (2 'php-$this)) | 1396 | ("\\(\\$\\)\\(this\\)\\>" (1 'php-$this-sigil) (2 'php-$this)) |
| 1663 | ("\\(\\$\\)\\([a-zA-Z0-9_]+\\)" (1 'php-variable-sigil) (2 'php-variable-name)) | 1397 | ("\\(\\$+\\)\\(\\sw+\\)" (1 'php-variable-sigil) (2 'php-variable-name)) |
| 1664 | ("\\(->\\)\\([a-zA-Z0-9_]+\\)" (1 'php-object-op) (2 'php-property-name)) | 1398 | ("\\(->\\)\\([a-zA-Z0-9_]+\\)" (1 'php-object-op) (2 'php-property-name)) |
| 1665 | 1399 | ||
| 1666 | ;; Highlight function/method names | 1400 | ;; Highlight function/method names |
| 1667 | ("\\<function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1 'php-function-name) | 1401 | ("\\<function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1 'php-function-name) |
| 1668 | 1402 | ||
| 1669 | ;; The dollar sign should not get a variable-name face, below | ||
| 1670 | ;; pattern resets the face to default in case cc-mode sets the | ||
| 1671 | ;; variable-name face (cc-mode does this for variables prefixed | ||
| 1672 | ;; with type, like in arglist) | ||
| 1673 | ("\\(\\$\\)\\(\\sw+\\)" 1 'php-variable-sigil) | ||
| 1674 | |||
| 1675 | ;; 'array' and 'callable' are keywords, except in the following situations: | 1403 | ;; 'array' and 'callable' are keywords, except in the following situations: |
| 1676 | ;; - when used as a type hint | 1404 | ;; - when used as a type hint |
| 1677 | ;; - when used as a return type | 1405 | ;; - when used as a return type |
| @@ -1681,12 +1409,17 @@ a completion list." | |||
| 1681 | ;; - when used as cast, so that (int) and (array) look the same | 1409 | ;; - when used as cast, so that (int) and (array) look the same |
| 1682 | ("(\\(array\\))" 1 font-lock-type-face) | 1410 | ("(\\(array\\))" 1 font-lock-type-face) |
| 1683 | 1411 | ||
| 1412 | (,(regexp-opt php-magical-constants 'symbols) (1 'php-magical-constant)) | ||
| 1684 | ;; namespaces | 1413 | ;; namespaces |
| 1685 | ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)[^:a-zA-Z0-9_\\\\]" 1 'font-lock-type-face) | 1414 | ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)[^:a-zA-Z0-9_\\\\]" 1 'font-lock-type-face) |
| 1686 | ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)::" 1 'php-constant) | 1415 | ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)::" 1 'php-constant) |
| 1687 | 1416 | ||
| 1688 | ;; Support the ::class constant in PHP5.6 | 1417 | ;; Support the ::class constant in PHP5.6 |
| 1689 | ("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-constant)) | 1418 | ("\\sw+\\(::\\)\\(class\\)\\b" (1 'php-paamayim-nekudotayim) (2 'php-magical-constant)) |
| 1419 | |||
| 1420 | ;; Highlight static method calls as such. This is necessary for method | ||
| 1421 | ;; names which are identical to keywords to be highlighted correctly. | ||
| 1422 | ("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call) | ||
| 1690 | 1423 | ||
| 1691 | ;; While c-opt-cpp-* highlights the <?php opening tags, it is not | 1424 | ;; While c-opt-cpp-* highlights the <?php opening tags, it is not |
| 1692 | ;; possible to make it highlight short open tags and closing tags | 1425 | ;; possible to make it highlight short open tags and closing tags |
| @@ -1711,6 +1444,7 @@ a completion list." | |||
| 1711 | ;; already fontified by another pattern. Note that using OVERRIDE | 1444 | ;; already fontified by another pattern. Note that using OVERRIDE |
| 1712 | ;; is usually overkill. | 1445 | ;; is usually overkill. |
| 1713 | `( | 1446 | `( |
| 1447 | ("\\<\\(@\\)" 1 'php-errorcontrol-op) | ||
| 1714 | ;; Highlight all upper-cased symbols as constant | 1448 | ;; Highlight all upper-cased symbols as constant |
| 1715 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) | 1449 | ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant) |
| 1716 | 1450 | ||
| @@ -1756,34 +1490,12 @@ a completion list." | |||
| 1756 | (defvar php-font-lock-keywords php-font-lock-keywords-3 | 1490 | (defvar php-font-lock-keywords php-font-lock-keywords-3 |
| 1757 | "Default expressions to highlight in PHP Mode.") | 1491 | "Default expressions to highlight in PHP Mode.") |
| 1758 | 1492 | ||
| 1759 | ;;; Provide support for Flymake so that users can see warnings and | 1493 | (add-to-list |
| 1760 | ;;; errors in real-time as they write code. | 1494 | (eval-when-compile |
| 1761 | 1495 | (if (boundp 'flymake-proc-allowed-file-name-masks) | |
| 1762 | (defun php-flymake-php-init () | 1496 | 'flymake-proc-allowed-file-name-masks |
| 1763 | "PHP specific init-cleanup routines. | 1497 | 'flymake-allowed-file-name-masks)) |
| 1764 | 1498 | '("\\.php[345s]?\\'" php-flymake-php-init)) | |
| 1765 | This is an alternative function of `flymake-php-init'. | ||
| 1766 | Look at the `php-executable' variable instead of the constant \"php\" command." | ||
| 1767 | (let* ((temp-file | ||
| 1768 | (funcall | ||
| 1769 | (eval-when-compile | ||
| 1770 | (if (fboundp 'flymake-proc-init-create-temp-buffer-copy) | ||
| 1771 | 'flymake-proc-init-create-temp-buffer-copy | ||
| 1772 | 'flymake-init-create-temp-buffer-copy)) | ||
| 1773 | 'flymake-create-temp-inplace)) | ||
| 1774 | (local-file (file-relative-name | ||
| 1775 | temp-file | ||
| 1776 | (file-name-directory buffer-file-name)))) | ||
| 1777 | (list php-executable (list "-f" local-file "-l")))) | ||
| 1778 | |||
| 1779 | (add-to-list 'flymake-allowed-file-name-masks | ||
| 1780 | '("\\.php[345s]?\\'" | ||
| 1781 | php-flymake-php-init | ||
| 1782 | flymake-simple-cleanup | ||
| 1783 | flymake-get-real-file-name)) | ||
| 1784 | |||
| 1785 | (add-to-list 'flymake-err-line-patterns | ||
| 1786 | '("\\(Parse\\|Fatal\\) error: \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)" 3 4 nil 2)) | ||
| 1787 | 1499 | ||
| 1788 | 1500 | ||
| 1789 | (defun php-send-region (start end) | 1501 | (defun php-send-region (start end) |
| @@ -1836,46 +1548,6 @@ The output will appear in the buffer *PHP*." | |||
| 1836 | 1548 | ||
| 1837 | (ad-activate 'fixup-whitespace) | 1549 | (ad-activate 'fixup-whitespace) |
| 1838 | 1550 | ||
| 1839 | |||
| 1840 | (defcustom php-class-suffix-when-insert "::" | ||
| 1841 | "Suffix for inserted class." | ||
| 1842 | :group 'php | ||
| 1843 | :type 'string) | ||
| 1844 | |||
| 1845 | (defcustom php-namespace-suffix-when-insert "\\" | ||
| 1846 | "Suffix for inserted namespace." | ||
| 1847 | :group 'php | ||
| 1848 | :type 'string) | ||
| 1849 | |||
| 1850 | (defvar php--re-namespace-pattern | ||
| 1851 | (php-create-regexp-for-classlike "namespace")) | ||
| 1852 | |||
| 1853 | (defvar php--re-classlike-pattern | ||
| 1854 | (php-create-regexp-for-classlike (regexp-opt '("class" "interface" "trait")))) | ||
| 1855 | |||
| 1856 | (defun php-get-current-element (re-pattern) | ||
| 1857 | "Return backward matched element by RE-PATTERN." | ||
| 1858 | (save-excursion | ||
| 1859 | (when (re-search-backward re-pattern nil t) | ||
| 1860 | (match-string-no-properties 1)))) | ||
| 1861 | |||
| 1862 | ;;;###autoload | ||
| 1863 | (defun php-current-class () | ||
| 1864 | "Insert current class name if cursor in class context." | ||
| 1865 | (interactive) | ||
| 1866 | (let ((matched (php-get-current-element php--re-classlike-pattern))) | ||
| 1867 | (when matched | ||
| 1868 | (insert (concat matched php-class-suffix-when-insert))))) | ||
| 1869 | |||
| 1870 | ;;;###autoload | ||
| 1871 | (defun php-current-namespace () | ||
| 1872 | "Insert current namespace if cursor in namespace context." | ||
| 1873 | (interactive) | ||
| 1874 | (let ((matched (php-get-current-element php--re-namespace-pattern))) | ||
| 1875 | (when matched | ||
| 1876 | (insert (concat matched php-namespace-suffix-when-insert))))) | ||
| 1877 | |||
| 1878 | |||
| 1879 | ;;;###autoload | 1551 | ;;;###autoload |
| 1880 | (add-to-list 'auto-mode-alist | 1552 | (add-to-list 'auto-mode-alist |
| 1881 | (cons | 1553 | (cons |
