branch: elpa/php-mode
commit 0ed7faa0b504d9fea62e66d52de9d8c85d29a43d
Author: USAMI Kenta <[email protected]>
Commit: USAMI Kenta <[email protected]>

    Add -traditional and -standard faces to call faces
---
 CHANGELOG.md     |  5 +++++
 lisp/php-face.el | 28 ++++++++++++++++++++++------
 lisp/php-mode.el |  6 +++---
 lisp/php.el      | 18 ++++++++++++++++++
 4 files changed, 48 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 84abbfb5b0..8a62ff7a24 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,11 @@ All notable changes of the PHP Mode 1.19.1 release series 
are documented in this
    * `php-$this` → `php-this`
    * `php-$this-sigil` → `php-this-sigil`
  * Add `php-function-call-standard` face inherit 
`font-lock-function-call-face` on Emacs 29.1 and above ([#782], thanks 
[@bricka]!)
+ * Add `-tranditional` suffix to the `php-*-call` faces.
+   * `php-function-call` → `php-function-call-traditional`
+   * `php-method-call` → `php-method-call-traditional`
+   * `php-static-method-call` → `php-static-method-call-traditional`
+ * Add variables for the `php-function-call`, `php-method-call`, and 
`php-static-method-call` faces, defaulting to the `-traditional` face.
 
 ### Removed
 
diff --git a/lisp/php-face.el b/lisp/php-face.el
index bb07e5317f..4f16a8160f 100644
--- a/lisp/php-face.el
+++ b/lisp/php-face.el
@@ -61,20 +61,36 @@
   :group 'php-faces
   :tag "PHP Function Call Standard")
 
-(defface php-function-call '((t ()))
+(defface php-function-call-traditional '((t ()))
   "PHP Mode face used to highlight function names in calles."
   :group 'php-faces
-  :tag "PHP Function Call")
+  :tag "PHP Function Call Traditional")
 
-(defface php-method-call '((t (:inherit php-function-call)))
+(define-obsolete-face-alias 'php-function-call 'php-function-call-traditional 
"1.26.0")
+
+(defface php-method-call-standard '((t (:inherit php-function-call-standard)))
   "PHP Mode face used to highlight method names in calles."
   :group 'php-faces
-  :tag "PHP Method Call")
+  :tag "PHP Method Call Standard")
+
+(defface php-method-call-traditional '((t (:inherit 
php-function-call-traditional)))
+  "PHP Mode face used to highlight method names in calles."
+  :group 'php-faces
+  :tag "PHP Method Call Traditional")
+
+(define-obsolete-face-alias 'php-method-call 'php-method-call-traditional 
"1.26.0")
 
-(defface php-static-method-call '((t (:inherit php-method-call)))
+(defface php-static-method-call-standard '((t (:inherit 
php-method-call-standard)))
   "PHP Mode face used to highlight static method names in calles."
   :group 'php-faces
-  :tag "PHP Static Method Call")
+  :tag "PHP Static Method Call Standard")
+
+(defface php-static-method-call-traditional '((t (:inherit 
php-method-call-traditional)))
+  "PHP Mode face used to highlight static method names in calles."
+  :group 'php-faces
+  :tag "PHP Static Method Call Traditional")
+
+(define-obsolete-face-alias 'php-static-method-call 
'php-static-method-call-traditional "1.26.0")
 
 (defface php-variable-name '((t (:inherit font-lock-variable-name-face)))
   "PHP Mode face used to highlight variable names."
diff --git a/lisp/php-mode.el b/lisp/php-mode.el
index 3ec28d66e3..cfb1f17f04 100644
--- a/lisp/php-mode.el
+++ b/lisp/php-mode.el
@@ -1371,7 +1371,7 @@ for \\[find-tag] (which see)."
 
      ;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but
      ;; not in $obj->var()
-     ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call))
+     ("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 php-method-call))
      ("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 
'php-constant-assign))
 
      ;; Logical operator (!)
@@ -1413,7 +1413,7 @@ for \\[find-tag] (which see)."
 
      ;; Highlight static method calls as such. This is necessary for method
      ;; names which are identical to keywords to be highlighted correctly.
-     ("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call)
+     ("\\sw+::\\(\\sw+\\)(" 1 php-static-method-call)
      ;; Multiple catch (FooException | BarException $e)
      (,(rx symbol-start "catch" symbol-end
            (* (syntax whitespace)) "(" (* (syntax whitespace))
@@ -1457,7 +1457,7 @@ for \\[find-tag] (which see)."
       (1 'php-import-declaration)
       (,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil 
nil (1 'php-constant-assign t)))
      ;; Highlight function calls
-     ("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call)
+     ("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 php-function-call)
      ;; Highlight all upper-cased symbols as constant
      ("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant)
 
diff --git a/lisp/php.el b/lisp/php.el
index 32142cb010..e78c7c97dd 100644
--- a/lisp/php.el
+++ b/lisp/php.el
@@ -209,6 +209,24 @@ a completion list."
   :group 'php
   :tag "PHP Topsy Separator"
   :type 'string)
+
+(defcustom php-function-call 'php-function-call-traditional
+  "Face name to use for method call."
+  :group 'php
+  :tag "PHP Function Call"
+  :type 'face)
+
+(defcustom php-method-call 'php-method-call-traditional
+  "Face name to use for method call."
+  :group 'php
+  :tag "PHP Method Call"
+  :type 'face)
+
+(defcustom php-static-method-call 'php-static-method-call-traditional
+  "Face name to use for method call."
+  :group 'php
+  :tag "PHP Static Method Call"
+  :type 'face)
 
 ;;; PHP Keywords
 (defconst php-magical-constants

Reply via email to