[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master efdee7a 172/184: swiper.el (swiper--occur-insert-lines): E
From: |
Oleh Krehel |
Subject: |
[elpa] master efdee7a 172/184: swiper.el (swiper--occur-insert-lines): Extract |
Date: |
Wed, 16 Oct 2019 13:15:17 -0400 (EDT) |
branch: master
commit efdee7a6e98828f4c1a9e0acfa665d428dd9aab6
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
swiper.el (swiper--occur-insert-lines): Extract
* counsel.el (counsel-grep-like-occur): Re-use `swiper--occur-insert-lines'.
Re #2203
---
counsel.el | 7 +------
swiper.el | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/counsel.el b/counsel.el
index a912a29..4164b05 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2862,12 +2862,7 @@ Works for `counsel-git-grep', `counsel-ag', etc."
switches
(shell-quote-argument regex))))))
(cands (counsel--split-string (shell-command-to-string cmd))))
- ;; Need precise number of header lines for `wgrep' to work.
- (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
- default-directory))
- (insert (format "%d candidates:\n" (length cands)))
- (ivy--occur-insert-lines
- (mapcar #'counsel--normalize-grep-match cands))))
+ (swiper--occur-insert-lines (mapcar #'counsel--normalize-grep-match
cands))))
(defun counsel-ag-occur ()
"Generate a custom occur buffer for `counsel-ag'."
diff --git a/swiper.el b/swiper.el
index 2777123..1a4f6dd 100644
--- a/swiper.el
+++ b/swiper.el
@@ -630,6 +630,16 @@ When non-nil, INITIAL-INPUT is the initial search pattern."
(setq last-pt pt))
(nreverse res)))
+(defun swiper--occur-insert-lines (cands)
+ ;; Need precise number of header lines for `wgrep' to work.
+ (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
+ default-directory))
+ (insert (format "%d candidates:\n" (length cands)))
+ (ivy--occur-insert-lines cands)
+ (goto-char (point-min))
+ (forward-line 4)
+ (setq-local next-error-function #'ivy-occur-next-error))
+
(defun swiper-occur (&optional revert)
"Generate a custom occur buffer for `swiper'.
When REVERT is non-nil, regenerate the current *ivy-occur* buffer.
@@ -668,16 +678,8 @@ When capture groups are present in the input, print them
instead of lines."
(unless (eq major-mode 'ivy-occur-grep-mode)
(ivy-occur-grep-mode)
(font-lock-mode -1))
- (insert (format "-*- mode:grep; default-directory: %S -*-\n\n\n"
- default-directory))
- (insert (format "%d candidates:\n" (length cands)))
- (ivy--occur-insert-lines
- (mapcar
- (lambda (cand) (concat "./" cand))
- cands))
- (goto-char (point-min))
- (forward-line 4)
- (setq-local next-error-function #'ivy-occur-next-error))))
+ (swiper--occur-insert-lines
+ (mapcar (lambda (cand) (concat "./" cand)) cands)))))
(declare-function evil-set-jump "ext:evil-jumps")
- [elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn, (continued)
- [elpa] master 8b07572 149/184: ivy.el (ivy-configure): Add :display-transformer-fn, Oleh Krehel, 2019/10/16
- [elpa] master 9da8003 158/184: counsel.el (counsel-M-x): Don't sort by default, Oleh Krehel, 2019/10/16
- [elpa] master 8f08f38 155/184: counsel.el (counsel--grep-last-pos): Refactor from counsel-grep-last-line, Oleh Krehel, 2019/10/16
- [elpa] master 6b40d40 156/184: ivy.el (ivy--occur-press-update-window): Re-use ivy-highlight-grep-commands, Oleh Krehel, 2019/10/16
- [elpa] master 2ed4416 165/184: ivy.el (ivy-configure): Add :exit-codes, Oleh Krehel, 2019/10/16
- [elpa] master 2ce5450 177/184: counsel.el (counsel-find-file): Bind "M-o R" to find-file-read-only, Oleh Krehel, 2019/10/16
- [elpa] master c82b852 174/184: ivy.el (ivy-occur-revert-buffer): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 8bc23e6 104/184: counsel.el (counsel-compile): delete duplicates, Oleh Krehel, 2019/10/16
- [elpa] master 966525c 118/184: counsel.el (counsel-cd): Fix for counsel-ag, Oleh Krehel, 2019/10/16
- [elpa] master f628569 127/184: Make ivy--magic-file-slash less aggressive, Oleh Krehel, 2019/10/16
- [elpa] master efdee7a 172/184: swiper.el (swiper--occur-insert-lines): Extract,
Oleh Krehel <=