branch: elpa/flymake-collection commit 55e2aa793ab505072cb8d682fa17667832c78a5e Author: Mohsin Kaleem <mohk...@kisara.moe> Commit: Mohsin Kaleem <mohk...@kisara.moe>
(flymake-rest-hook): Add ignore-modes configuration Allows you to suppress the hooking of flymake backends based on certain major or minor modes. For example eglot sets the backends themselves so flymake-rest doesn't have to. --- flymake-rest-hook.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/flymake-rest-hook.el b/flymake-rest-hook.el index 41f188ec42..7faa05e7ed 100644 --- a/flymake-rest-hook.el +++ b/flymake-rest-hook.el @@ -64,10 +64,19 @@ (warn "Unknown checker config in `flymake-rest-config': %s" conf))))) (nreverse checkers))) +(defcustom flymake-rest-hook-ignore-modes nil + "List of modes in which `flymake-rest-hook' is inhibited." + :type '(list symbol)) + (defun flymake-rest-hook-set-backends () "Setup `flymake-diagnostic-functions' using `flymake-rest-config'." - (dolist (it (flymake-rest-configured-checkers major-mode)) - (add-hook 'flymake-diagnostic-functions (car it) (cdr it) t))) + (unless (cl-find-if (lambda (mode) + (or (eq major-mode mode) + (and (boundp mode) + (eval mode)))) + flymake-rest-hook-ignore-modes) + (dolist (it (flymake-rest-configured-checkers major-mode)) + (add-hook 'flymake-diagnostic-functions (car it) (cdr it) t)))) ;;;###autoload (defun flymake-rest-hook-setup ()