[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra f16e6e2 094/395: counsel.el (counsel-flycheck
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra f16e6e2 094/395: counsel.el (counsel-flycheck-errors-cands): Show the error |
Date: |
Thu, 25 Feb 2021 08:31:39 -0500 (EST) |
branch: externals/ivy-hydra
commit f16e6e2dfcfc92827b859010ddb1198b2d65100e
Author: Oleh Krehel <ohwoeowho@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel-flycheck-errors-cands): Show the error
Also fix compile warnings.
Re #2404
---
counsel.el | 102 +++++++++++++++++++++++++++++++------------------------------
1 file changed, 52 insertions(+), 50 deletions(-)
diff --git a/counsel.el b/counsel.el
index 3553dbe..89de08e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -6272,6 +6272,58 @@ We update it in the callback with
`ivy-update-candidates'."
:action #'counsel-compilation-errors-action
:history 'counsel-compilation-errors-history))
+;;* `counsel-flycheck'
+(defvar flycheck-current-errors)
+(declare-function flycheck-error-filename "ext:flycheck")
+(declare-function flycheck-error-line "ext:flycheck")
+(declare-function flycheck-error-message "ext:flycheck")
+(declare-function flycheck-jump-to-error "ext:flycheck")
+
+(defun counsel-flycheck-errors-cands ()
+ (mapcar
+ (lambda (err)
+ (propertize
+ (format "%s:%d:%s"
+ (file-name-base (flycheck-error-filename err))
+ (flycheck-error-line err)
+ (flycheck-error-message err)) 'error err))
+ flycheck-current-errors))
+
+(defun counsel-flycheck-occur (cands)
+ "Generate a custom occur buffer for `counsel-flycheck'."
+ (unless (eq major-mode 'ivy-occur-grep-mode)
+ (ivy-occur-grep-mode)
+ (setq default-directory (ivy-state-directory ivy-last)))
+ (swiper--occur-insert-lines
+ (mapcar
+ (lambda (cand)
+ (let ((err (get-text-property 0 'error cand)))
+ (propertize
+ (format
+ "%s:%d:%s"
+ (flycheck-error-filename err)
+ (flycheck-error-line err)
+ cand)
+ 'error err)))
+ cands)))
+
+(defun counsel-flycheck-errors-action (err)
+ (flycheck-jump-to-error (get-text-property 0 'error err)))
+
+(ivy-configure 'counsel-flycheck
+ :occur #'counsel-flycheck-occur)
+
+;;;###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))
+
+
;;* `counsel-mode'
(defvar counsel-mode-map
(let ((map (make-sparse-keymap)))
@@ -6324,56 +6376,6 @@ 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-occur (cands)
- "Generate a custom occur buffer for `counsel-flycheck'."
- (require 'thingatpt)
- (unless cands
- (message "need to handle empty cands"))
- (unless (eq major-mode 'ivy-occur-grep-mode)
- (ivy-occur-grep-mode)
- (setq default-directory (ivy-state-directory ivy-last)))
- (swiper--occur-insert-lines
- (mapcar
- (lambda (cand)
- (let ((err (get-text-property 0 'error cand)))
- (propertize
- (format
- "%s:%d:%s"
- (flycheck-error-filename err)
- (flycheck-error-line err)
- (save-excursion
- (with-current-buffer (flycheck-error-buffer err)
- (goto-line (flycheck-error-line err))
- (string-trim (thing-at-point 'line)))))
- 'error err)))
- cands)))
-
-(defun counsel-flycheck-errors-action (error)
- (flycheck-jump-to-error (get-text-property 0 'error error)))
-
-(ivy-configure 'counsel-flycheck
- :occur #'counsel-flycheck-occur)
-
-;;;###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
- [elpa] externals/ivy-hydra 2ccda7e 044/395: ivy.el (ivy--directory-done): Fix "Host name must not match method ssh", (continued)
- [elpa] externals/ivy-hydra 2ccda7e 044/395: ivy.el (ivy--directory-done): Fix "Host name must not match method ssh", Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra a7ae5f0 058/395: counsel.el (counsel-geiser-doc-look-up-manual): Add., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 13a1b87 059/395: ivy.el (ivy-minibuffer-map): Bind "M-a" to ivy-toggle-marks, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 49335d2 060/395: Allow to use window configurations for ivy views, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0f61cc5 065/395: Add support for browising compilation errors, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2fb4c9f 061/395: Update test instructions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3d9c222 069/395: swiper.el (swiper--query-replace-updatefn): Fix, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c7973a8 083/395: counsel.el (counsel-set-variable): Fix killing the expression, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra e7eca37 085/395: counsel.el (counsel-switch-buffer-preview-virtual-buffers): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra eae1ccf 086/395: ivy.el (ivy-auto-shrink-minibuffer): New defcustom, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f16e6e2 094/395: counsel.el (counsel-flycheck-errors-cands): Show the error,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra 400a900 265/395: ivy.el (ivy-backward-delete-char): Forward to counsel-up-directory, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra edccbd7 270/395: ivy.el (ivy-completion-in-region): Use collection in place of all-completions, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0f4cb44 051/395: ivy.el (ivy-add-prompt-count): Account for :dynamic-collection returning 0, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra cab01f3 053/395: ivy.el (ivy--reset-state): Add listp check, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra abfb283 054/395: ivy-overlay.el (ivy-display-function-overlay): Fix for org-current-level, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 06886f1 055/395: ivy.el (ivy--tramp-prefix-p): Extract, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d2052ba 017/395: counsel.el (counsel--company-display-transformer): Add, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 1020a77 026/395: swiper.el (swiper-query-replace): Show matched groups in preview, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra c0b61ea 028/395: swiper.el (swiper--query-replace-setup): Highlight at eobp, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 412266f 038/395: swiper.el (swiper--line-at-point): Don't error on empty string, Basil L. Contovounesios, 2021/02/25