Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 2.19 KB

README.org

File metadata and controls

72 lines (52 loc) · 2.19 KB

PHP Functions Highlighter for Emacs

This Emacs package provides font highlighting of all native and user defined PHP functions within php-mode.

A piece of code without php-fh loaded :

./assets/without-php-fh.png

The same piece of code with php-fh loaded :

./assets/with-php-fh.png

Important Note

This package make the fontification of the functions name by regexp using the Emacs Lisp function font-lock-add-keywords; this can slow down your computer.

So, do not use this package if you have a computer with low CPU.

Installation

From Melpa

This package is not part of Melpa for now, waiting for maturity…

Manually

This package requires that the php-mode package was installed.

To install php-fh, place/clone the php-fh directory in a directory of your choice, add it to your load path and require php-fh writing this code in your Emacs configuration file (.emacs ?) :

(add-to-list 'load-path "/place/where/you/put/php-fh")
(require 'php-fh)
(eval-after-load 'php-mode '(php-fh-highlight))

Either evaluate each statements individuality with C-x C-e or restart Emacs.

  • In the file packages.el place this code :
    (package! php-fh
      :recipe (:host github :repo "pivaldi/php-fh"))
        
  • In the file config.el place this code :
    (use-package! php-fh
      :defer t
      :autoload (php-fh-highlight)
      :init
      (after! php-mode (php-fh-highlight)))
        
  • Launch the command doom sync and restart Doom Emacs.

Customisable variables

  • php-fh-user-functions-name : list of PHP user defined functions that php-fh must also highlight.
  • php-fh-php-generate-funcs-code : the PHP code used to generate all internal PHP functions.
  • php-fh-php-cmd : The PHP command.

Regenerate the list of native PHP function

In order to regenerate the list of native PHP function used by php-hf, use the Emacs command php-fh-generate-php-func-file (M-x etc…).