emacs-php / php-mode

A powerful and flexible Emacs major mode for editing PHP scripts
GNU General Public License v3.0
580 stars 118 forks source link

`php-function-call` face does not inherit from `font-lock-function-call-face` #782

Open bricka opened 2 weeks ago

bricka commented 2 weeks ago

https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html#index-font_002dlock_002dfunction_002dcall_002dface

As far as I can tell, this face was added in Emacs 29.1, so it's pretty new :).

In an Emacs version with this face, we get nicer highlighting :).

I'm happy to put up an MR, but I'm not sure how we go about supporting different versions of Emacs. If I just inherit from this, will it "Just Work" in older versions of Emacs? Or do I need to do something special here?

zonuexe commented 2 weeks ago

@bricka Thanks for the suggestion!

Please refer to the php-doc-annotation-tag face, but in older Emacs versions, that face inherits nil, so you can use when instead of if.

zonuexe commented 2 weeks ago

Sorry, this face doesn't have a corresponding variable, so this code doesn't make sense. Instead, check with the following expression:

(when (get 'font-lock-function-call-face 'face-defface-spec)
  ...)