Skip to content

Commit

Permalink
tweak(flymake-quickdef): advice to auto generate +flymake-*-load func
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 19, 2023
1 parent 66b23c6 commit e12c8a7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions modules/me-checkers.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@
:autoload flymake-quickdef-backend
:hook ((python-mode python-ts-mode) . +flymake-bandit-load)
:init
(defun +flymake-bandit-load ()
(add-hook 'flymake-diagnostic-functions #'flymake-check-bandit nil t))
;; Automatically generate `backend-load' function to be used as a hook
(advice-add
'flymake-quickdef-backend :after
(defun +flymake-quickdef--make-load-fn (backend &rest _)
(let ((fn (intern (format "+%s-load" backend))))
(defalias fn
(lambda () (add-hook 'flymake-diagnostic-functions backend nil t))))))
:config
;; Add Bandit support for Python (example from https://github.com/karlotness/flymake-quickdef)
(flymake-quickdef-backend flymake-bandit
Expand Down

0 comments on commit e12c8a7

Please sign in to comment.