Skip to content

Commit

Permalink
On Emacs >= 29.1, php-function-call face inherits from `font-lock-f…
Browse files Browse the repository at this point in the history
…unction-call-face`

Resolves emacs-php#782
  • Loading branch information
bricka committed Jun 20, 2024
1 parent c8e4c16 commit 987e724
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lisp/php-face.el
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@
:group 'php-faces
:tag "PHP Function Name")

(defface php-function-call '((t ()))
;; `font-lock-function-call-face' was added in Emacs 29.1
(defface php-function-call (eval-when-compile
(if (get 'font-lock-function-call-face 'face-defface-spec)
'((t (:inherit font-lock-function-call-face)))
'((t ()))))
"PHP Mode face used to highlight function names in calles."
:group 'php-faces
:tag "PHP Function Call")
Expand Down
6 changes: 6 additions & 0 deletions tests/php-mode-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ Meant for `php-mode-test-issue-503'."
(with-php-mode-test ("indent/issue-702.php" :indent t :magic t))
(with-php-mode-test ("indent/issue-726.php" :indent t :magic t)))

(ert-deftest php-mode-test-issue-782 ()
"Test that function calls are fontified."
(if (version< emacs-version "29.1")
(should (eq (face-attribute 'php-function-call :inherit) nil))
(should (eq (face-attribute 'php-function-call :inherit) 'font-lock-function-call-face))))

(ert-deftest php-mode-test-php74 ()
"Test highlighting language constructs added in PHP 7.4."
(with-php-mode-test ("7.4/arrow-function.php" :faces t))
Expand Down

0 comments on commit 987e724

Please sign in to comment.