Skip to content

Commit

Permalink
refactor(flymake): define menu with transient instead of hydra
Browse files Browse the repository at this point in the history
  • Loading branch information
abougouffa committed Nov 20, 2023
1 parent af3566f commit e615b37
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 24 deletions.
13 changes: 12 additions & 1 deletion core/me-builtin.el
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,18 @@ or file path may exist now."
"fN" #'flymake-goto-prev-error
"fs" #'flymake-start
"fb" #'flymake-show-buffer-diagnostics
"fp" #'flymake-show-project-diagnostics)
"fp" #'flymake-show-project-diagnostics
"ff" #'+flymake-transient)

(transient-define-prefix +flymake-transient ()
"Transient for dape."
[[("n" "Next error" flymake-goto-next-error :transient t)
("N" "Prev error" flymake-goto-prev-error :transient t)]
[("B" "Buffer diagnostics" flymake-show-buffer-diagnostics :transient t)
("P" "Project diagnostics" flymake-show-project-diagnostics :transient t)
("L" "Log buffer" flymake-switch-to-log-buffer :transient t)]
[("S" "Start" flymake-start :transient t)
("Q" "Quit" ignore :transient t)]])

;; Use the session's load-path with flymake
(setq elisp-flymake-byte-compile-load-path (append elisp-flymake-byte-compile-load-path load-path))
Expand Down
24 changes: 1 addition & 23 deletions core/me-keybindings.el
Original file line number Diff line number Diff line change
Expand Up @@ -273,29 +273,7 @@
(provide 'me-general-ready))

(use-package hydra
:straight t
:after minemacs-loaded
:config
;; Make hydra bindings for `flymake'
(with-eval-after-load 'flymake
(defhydra +flymake-main (:color red :hint nil :foreign-keys warn)
"
[Flymake] [_q_] quit
├──────────────────────────────────────────────────────────────────────╮
│ [_B_] Buffer diagnostics [_P_] Project diagnostics [_L_] Log buffer │
│ [_n_] Next error [_N_] Prev error [_S_] Start │
╰──────────────────────────────────────────────────────────────────────╯
"
("B" flymake-show-buffer-diagnostics)
("P" flymake-show-project-diagnostics)
("L" flymake-switch-to-log-buffer)
("n" flymake-goto-next-error)
("N" flymake-goto-prev-error)
("S" flymake-start)
("q" nil :color blue))

(+map-local! :keymaps 'flymake-mode-map
"ff" #'+flymake-main/body)))
:straight t)

(use-package avy
:straight t
Expand Down
17 changes: 17 additions & 0 deletions modules/me-checkers.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,23 @@
:hook (plantuml-mode . flymake-plantuml-setup))


;; Make hydra bindings for `flymake'
(with-eval-after-load 'flymake
(+map-local! :keymaps 'flymake-mode-map "ff" #'+flymake-transient)
(transient-define-prefix +flymake-transient ()
"Transient for dape."
[[""
("n" "Next error" flymake-goto-next-error :transient t)
("N" "Prev error" flymake-goto-prev-error :transient t)]
[""
("B" "Buffer diagnostics" flymake-show-buffer-diagnostics :transient t)
("P" "Project diagnostics" flymake-show-project-diagnostics :transient t)
("L" "Log buffer" flymake-switch-to-log-buffer :transient t)]
[""
("S" "Start" flymake-start :transient t)
("Q" "Quit" ignore :transient t)]]))


(provide 'me-checkers)

;;; me-checkers.el ends here

0 comments on commit e615b37

Please sign in to comment.