Created
September 16, 2018 03:29
-
-
Save emacswatcher/98cb5ad8c01e49a7621646413ff916ae to your computer and use it in GitHub Desktop.
counsel-flycheck (updated from a web source which was spacemacs-based and used dash)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(use-package counsel-flycheck | |
:after counsel flycheck | |
:if (not noninteractive) | |
:preface | |
(defvar counsel-flycheck-history nil | |
"History for `counsel-flycheck'") | |
(defun counsel-flycheck () | |
"Navigate to flycheck errors" | |
(interactive) | |
(if (not (bound-and-true-p flycheck-mode)) | |
(message "Flycheck mode is not available or enabled") | |
(ivy-read "Error: " | |
(let ((source-buffer (current-buffer))) | |
(with-current-buffer | |
(or (get-buffer flycheck-error-list-buffer) | |
(progn | |
(with-current-buffer | |
(get-buffer-create flycheck-error-list-buffer) | |
(flycheck-error-list-mode) | |
(current-buffer)))) | |
(flycheck-error-list-set-source source-buffer) | |
(flycheck-error-list-reset-filter) | |
(revert-buffer t t t) | |
(split-string (buffer-string) "\n" t " *"))) | |
:action | |
(lambda (s &rest _) | |
(when-let* | |
((the-error (get-text-property 0 'tabulated-list-id s)) | |
(pos (flycheck-error-pos the-error)) ) | |
(goto-char (flycheck-error-pos the-error)))) | |
:history 'counsel-flycheck-history))) | |
:commands (counsel-flycheck) | |
:bind ("C-!" . #'counsel-flycheck)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment