branch: elpa/php-mode commit 0902894e21663d6e184a46e8f9defd633498b905 Author: USAMI Kenta <tad...@zonu.me> Commit: USAMI Kenta <tad...@zonu.me>
Add php-mode-replace-flymake-diag-function --- CHANGELOG.md | 1 + lisp/php-mode.el | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e19a36d1c..53d308ec65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ All notable changes of the PHP Mode 1.19.1 release series are documented in this * Psalm: [Atomic Type Reference](https://psalm.dev/docs/annotating_code/type_syntax/atomic_types/) * Psalm: [Supported Annotations](https://psalm.dev/docs/annotating_code/supported_annotations/) * Psalm: [Template Annotations](https://psalm.dev/docs/annotating_code/templated_annotations/) + * Add `php-mode-replace-flymake-diag-function` custom variable and default activated it ([#718]) ### Changed diff --git a/lisp/php-mode.el b/lisp/php-mode.el index 2f898403e1..b4088d2f89 100644 --- a/lisp/php-mode.el +++ b/lisp/php-mode.el @@ -82,6 +82,7 @@ (require 'rx) (require 'cl-lib) (require 'flymake) + (require 'php-flymake) (require 'regexp-opt) (defvar add-log-current-defun-header-regexp) (defvar add-log-current-defun-function) @@ -180,6 +181,15 @@ Turning this on will open it whenever `php-mode' is loaded." :tag "PHP Mode Page Delimiter" :type 'regexp) +(defcustom php-mode-replace-flymake-diag-function + (eval-when-compile (when (boundp 'flymake-diagnostic-functions) + #'php-flymake)) + "Flymake function to replace, if NIL do not replace." + :group 'php-mode + :tag "PHP Mode Replace Flymake Diag Function" + :type '(choice 'function + (const :tag "Disable to replace" nil))) + (define-obsolete-variable-alias 'php-do-not-use-semantic-imenu 'php-mode-do-not-use-semantic-imenu "1.20.0") (defcustom php-mode-do-not-use-semantic-imenu t "Customize `imenu-create-index-function' for `php-mode'. @@ -1262,6 +1272,10 @@ After setting the stylevars run hooks according to STYLENAME (setq-local add-log-current-defun-function nil) (setq-local add-log-current-defun-header-regexp php-beginning-of-defun-regexp) + (when (and (eval-when-compile (boundp 'flymake-diagnostic-functions)) + php-mode-replace-flymake-diag-function) + (add-hook 'flymake-diagnostic-functions php-mode-replace-flymake-diag-function nil t)) + (when (fboundp 'c-looking-at-or-maybe-in-bracelist) (advice-add #'c-looking-at-or-maybe-in-bracelist :override 'php-c-looking-at-or-maybe-in-bracelist '(local)))