Skip to content

Commit e072156

Browse files
committed
Add -traditional and -standard faces to call faces
1 parent ee88d59 commit e072156

File tree

4 files changed

+54
-9
lines changed

4 files changed

+54
-9
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this
1919
* `php-$this``php-this`
2020
* `php-$this-sigil``php-this-sigil`
2121
* Add `php-function-call-standard` face inherit `font-lock-function-call-face` on Emacs 29.1 and above ([#782], thanks [@bricka]!)
22+
* Add `-tranditional` suffix to the `php-*-call` faces.
23+
* `php-function-call``php-function-call-traditional`
24+
* `php-method-call``php-method-call-traditional`
25+
* `php-static-method-call``php-static-method-call-traditional`
26+
* Add variables for the `php-function-call`, `php-method-call`, and `php-static-method-call` faces, defaulting to the `-traditional` face.
2227

2328
### Removed
2429

Diff for: lisp/php-face.el

+22-6
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,36 @@
6161
:group 'php-faces
6262
:tag "PHP Function Call Standard")
6363

64-
(defface php-function-call '((t ()))
64+
(defface php-function-call-traditional '((t ()))
6565
"PHP Mode face used to highlight function names in calles."
6666
:group 'php-faces
67-
:tag "PHP Function Call")
67+
:tag "PHP Function Call Traditional")
6868

69-
(defface php-method-call '((t (:inherit php-function-call)))
69+
(define-obsolete-face-alias 'php-function-call 'php-function-call-traditional "1.26.0")
70+
71+
(defface php-method-call-standard '((t (:inherit php-function-call-standard)))
7072
"PHP Mode face used to highlight method names in calles."
7173
:group 'php-faces
72-
:tag "PHP Method Call")
74+
:tag "PHP Method Call Standard")
75+
76+
(defface php-method-call-traditional '((t (:inherit php-function-call-traditional)))
77+
"PHP Mode face used to highlight method names in calles."
78+
:group 'php-faces
79+
:tag "PHP Method Call Traditional")
80+
81+
(define-obsolete-face-alias 'php-method-call 'php-method-call-traditional "1.26.0")
7382

74-
(defface php-static-method-call '((t (:inherit php-method-call)))
83+
(defface php-static-method-call-standard '((t (:inherit php-method-call-standard)))
7584
"PHP Mode face used to highlight static method names in calles."
7685
:group 'php-faces
77-
:tag "PHP Static Method Call")
86+
:tag "PHP Static Method Call Standard")
87+
88+
(defface php-static-method-call-traditional '((t (:inherit php-method-call-traditional)))
89+
"PHP Mode face used to highlight static method names in calles."
90+
:group 'php-faces
91+
:tag "PHP Static Method Call Traditional")
92+
93+
(define-obsolete-face-alias 'php-static-method-call 'php-static-method-call-traditional "1.26.0")
7894

7995
(defface php-variable-name '((t (:inherit font-lock-variable-name-face)))
8096
"PHP Mode face used to highlight variable names."

Diff for: lisp/php-mode.el

+3-3
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ for \\[find-tag] (which see)."
13711371

13721372
;; Highlight variables, e.g. 'var' in '$var' and '$obj->var', but
13731373
;; not in $obj->var()
1374-
("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 'php-method-call))
1374+
("\\(->\\)\\(\\sw+\\)\\s-*(" (1 'php-object-op) (2 php-method-call))
13751375
("\\<\\(const\\)\\s-+\\(\\_<.+?\\_>\\)" (1 'php-keyword) (2 'php-constant-assign))
13761376

13771377
;; Logical operator (!)
@@ -1413,7 +1413,7 @@ for \\[find-tag] (which see)."
14131413

14141414
;; Highlight static method calls as such. This is necessary for method
14151415
;; names which are identical to keywords to be highlighted correctly.
1416-
("\\sw+::\\(\\sw+\\)(" 1 'php-static-method-call)
1416+
("\\sw+::\\(\\sw+\\)(" 1 php-static-method-call)
14171417
;; Multiple catch (FooException | BarException $e)
14181418
(,(rx symbol-start "catch" symbol-end
14191419
(* (syntax whitespace)) "(" (* (syntax whitespace))
@@ -1457,7 +1457,7 @@ for \\[find-tag] (which see)."
14571457
(1 'php-import-declaration)
14581458
(,(rx (group (+ (or (syntax word) (syntax symbol) "\\" "{" "}")))) nil nil (1 'php-constant-assign t)))
14591459
;; Highlight function calls
1460-
("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 'php-function-call)
1460+
("\\(\\_<\\(?:\\sw\\|\\s_\\)+?\\_>\\)\\s-*(" 1 php-function-call)
14611461
;; Highlight all upper-cased symbols as constant
14621462
("\\<\\([A-Z_][A-Z0-9_]+\\)\\>" 1 'php-constant)
14631463

Diff for: lisp/php.el

+24
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,24 @@ a completion list."
209209
:group 'php
210210
:tag "PHP Topsy Separator"
211211
:type 'string)
212+
213+
(defcustom php-function-call 'php-function-call-traditional
214+
"Face name to use for method call."
215+
:group 'php
216+
:tag "PHP Function Call"
217+
:type 'face)
218+
219+
(defcustom php-method-call 'php-method-call-traditional
220+
"Face name to use for method call."
221+
:group 'php
222+
:tag "PHP Method Call"
223+
:type 'face)
224+
225+
(defcustom php-static-method-call 'php-static-method-call-traditional
226+
"Face name to use for method call."
227+
:group 'php
228+
:tag "PHP Static Method Call"
229+
:type 'face)
212230

213231
;;; PHP Keywords
214232
(defconst php-magical-constants
@@ -782,6 +800,12 @@ When `DOCUMENT-ROOT' is NIL, the document root is obtained from `ROUTER-OR-DIR'.
782800
nil nil nil
783801
#'file-exists-p))))
784802
(find-file file))
803+
804+
;;;###autoload
805+
(progn
806+
(add-to-list 'auto-mode-alist '("\\.\\(?:php\\.inc\\|stub\\)\\'" . php-mode-maybe))
807+
(add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode-maybe))
808+
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . php-mode-maybe)))
785809

786810
(provide 'php)
787811
;;; php.el ends here

0 commit comments

Comments
 (0)