From 31bc48e244a9aacf817e6009c5789ae55849022d Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 10 Sep 2018 12:06:30 +0200 Subject: Upgrade php-mode --- .emacs.d/lisp/php-mode.el | 38 ++++++++++++++++++++++++-------------- .emacs.d/lisp/php-project.el | 2 +- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.emacs.d/lisp/php-mode.el b/.emacs.d/lisp/php-mode.el index 6b9e2ee..e1b2597 100644 --- a/.emacs.d/lisp/php-mode.el +++ b/.emacs.d/lisp/php-mode.el @@ -6,7 +6,7 @@ ;; Author: Eric James Michael Ritz ;; Maintainer: USAMI Kenta -;; URL: https://github.com/ejmr/php-mode +;; URL: https://github.com/emacs-php/php-mode ;; Keywords: languages php ;; Version: 1.19.1 ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) @@ -15,7 +15,7 @@ (defconst php-mode-version-number "1.19.1" "PHP Mode version number.") -(defconst php-mode-modified "2018-05-12" +(defconst php-mode-modified "2018-08-28" "PHP Mode build date.") ;; This file is free software; you can redistribute it and/or @@ -101,7 +101,7 @@ (if (and (= emacs-major-version 24) (>= emacs-minor-version 4)) (require 'cl))) -;; Work around https://github.com/ejmr/php-mode/issues/310. +;; Work around https://github.com/emacs-php/php-mode/issues/310. ;; ;; In emacs 24.4 and 24.5, lines after functions with a return type ;; are incorrectly analyzed as member-init-cont. @@ -126,8 +126,8 @@ :tag "PHP" :prefix "php-" :group 'languages - :link '(url-link :tag "Official Site" "https://github.com/ejmr/php-mode") - :link '(url-link :tag "PHP Mode Wiki" "https://github.com/ejmr/php-mode/wiki")) + :link '(url-link :tag "Official Site" "https://github.com/emacs-php/php-mode") + :link '(url-link :tag "PHP Mode Wiki" "https://github.com/emacs-php/php-mode/wiki")) (defcustom php-executable (or (executable-find "php") "/usr/bin/php") @@ -1190,7 +1190,7 @@ After setting the stylevars run hooks according to STYLENAME (require 'pkg-info nil t) (php-mode-debug--buffer 'init) (php-mode-debug--message "Feel free to report on GitHub what you noticed!") - (php-mode-debug--message "https://github.com/ejmr/php-mode/issues/new") + (php-mode-debug--message "https://github.com/emacs-php/php-mode/issues/new") (php-mode-debug--message "") (php-mode-debug--message "Pasting the following information on the issue will help us to investigate the cause.") (php-mode-debug--message "```") @@ -1635,13 +1635,14 @@ a completion list." ;; with type, like in arglist) ("\\(\\$\\)\\(\\sw+\\)" 1 'php-variable-sigil) - ;; Array is a keyword, except in the following situations: - ;; - when used as cast, so that (int) and (array) look the same + ;; 'array' and 'callable' are keywords, except in the following situations: ;; - when used as a type hint ;; - when used as a return type + ("\\b\\(array\\|callable\\)\\s-+&?\\$" 1 font-lock-type-face) + (")\\s-*:\\s-*\\??\\(array\\|callable\\)\\b" 1 font-lock-type-face) + ;; For 'array', there is an additional situation: + ;; - when used as cast, so that (int) and (array) look the same ("(\\(array\\))" 1 font-lock-type-face) - ("\\b\\(array\\)\\s-+&?\\$" 1 font-lock-type-face) - (")\\s-*:\\s-*\\??\\(array\\)\\b" 1 font-lock-type-face) ;; namespaces ("\\(\\([a-zA-Z0-9_]+\\\\\\)+[a-zA-Z0-9_]+\\|\\(\\\\[a-zA-Z0-9_]+\\)+\\)[^:a-zA-Z0-9_\\\\]" 1 'font-lock-type-face) @@ -1697,12 +1698,21 @@ a completion list." " \\(\\sw+\\)") 1 font-lock-type-face) - ;; Highlight return types in functions and methods. - ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) - (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) + ;; Highlight the ? character for nullable return types. + ("function.+:\\s-*\\(\\?\\)\\(?:\\sw\\|\\s_\\|\\\\\\)+" 1 font-lock-type-face) + (")\\s-*:\\s-*\\(\\?\\)\\(?:\\sw\\|\\s_\\|\\\\\\)+\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) - ;; Highlight class names used as nullable type hints + ;; Highlight the ? character for nullable type hints. + ("\\(\\?\\)\\(:?\\sw\\|\\s_\\|\\\\\\)+\\s-+\\$" 1 font-lock-type-face) + + ;; Class names without a namespace are not highlighted at all when they + ;; are used as nullable type hints or return types (both nullable and + ;; non-nullable). We have to use separate regular expressions, because + ;; we want to capture the class name as well, not just the ? character + ;; like the regexps above. ("\\?\\(\\(:?\\sw\\|\\s_\\)+\\)\\s-+\\$" 1 font-lock-type-face) + ("function.+:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)" 1 font-lock-type-face) + (")\\s-*:\\s-*\\??\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*\\(?:\{\\|;\\)" 1 font-lock-type-face) )) "Detailed highlighting for PHP Mode.") diff --git a/.emacs.d/lisp/php-project.el b/.emacs.d/lisp/php-project.el index 53275b9..2f4d571 100644 --- a/.emacs.d/lisp/php-project.el +++ b/.emacs.d/lisp/php-project.el @@ -4,7 +4,7 @@ ;; Author: USAMI Kenta ;; Keywords: tools, files -;; URL: https://github.com/ejmr/php-mode +;; URL: https://github.com/emacs-php/php-mode ;; Version: 1.19.1 ;; Package-Requires: ((emacs "24.3") (cl-lib "0.5")) ;; License: GPL-3.0-or-later -- cgit v1.3