branch: externals/ivy-hydra
commit 83f04c0ec54a3627c3d1476006787f91ca176e17
Author: Rudi Grinberg <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-flycheck): Add
Signed-off-by: Rudi Grinberg <[email protected]>
---
counsel.el | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/counsel.el b/counsel.el
index f8e94db..ea1374a 100644
--- a/counsel.el
+++ b/counsel.el
@@ -6324,6 +6324,29 @@ Local bindings (`counsel-mode-map'):
(when (fboundp 'advice-remove)
(advice-remove #'describe-bindings #'counsel-descbinds))))
+(defun counsel-flycheck-errors-cands ()
+ (seq-map
+ (lambda (error)
+ (propertize
+ (format "%s:%d:%s"
+ (file-name-base (flycheck-error-filename error))
+ (flycheck-error-line error)
+ (flycheck-error-message error)) 'error error))
+ flycheck-current-errors))
+
+(defun counsel-flycheck-errors-action (error)
+ (flycheck-jump-to-error (get-text-property 0 'error error)))
+
+;;;###autoload
+(defun counsel-flycheck ()
+ "Flycheck errors."
+ (interactive)
+ (require 'flycheck)
+ (ivy-read "flycheck errors: " (counsel-flycheck-errors-cands)
+ :require-match t
+ :action #'counsel-flycheck-errors-action
+ :history 'counsel-flycheck-errors-history))
+
(provide 'counsel)
;;; counsel.el ends here