[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 1c801a0 243/348: Ignore TAGS buffers in swiper-all
From: |
Oleh Krehel |
Subject: |
[elpa] master 1c801a0 243/348: Ignore TAGS buffers in swiper-all |
Date: |
Sat, 8 Apr 2017 11:04:06 -0400 (EDT) |
branch: master
commit 1c801a0eca80138d3080ce71cf5df9ddb74b0219
Author: Wilfred Hughes <address@hidden>
Commit: Wilfred Hughes <address@hidden>
Ignore TAGS buffers in swiper-all
Factor out the filter logic into a separate function.
Fixes #787
---
swiper.el | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/swiper.el b/swiper.el
index a0c932e..1e03445 100644
--- a/swiper.el
+++ b/swiper.el
@@ -748,16 +748,23 @@ Run `swiper' for those buffers."
(swiper--cleanup)
(swiper--add-overlays (ivy--regex ivy-text))))))))
+(defun swiper-all-buffer-p (buffer)
+ "Return non-nil if BUFFER should be considered by `swiper-all'."
+ (let ((major-mode (with-current-buffer buffer major-mode)))
+ (cond
+ ;; Ignore TAGS buffers, they tend to add duplicate results.
+ ((eq major-mode #'tags-table-mode) nil)
+ ;; Always consider dired buffers, even though they're not backed
+ ;; by a file.
+ ((eq major-mode #'dired-mode) t)
+ ;; Otherwise, only consider the file if it's backed by a file.
+ (t (buffer-file-name buffer)))))
+
;;* `swiper-all'
(defun swiper-all-function (str)
(if (and (< (length str) 3))
(list "" (format "%d chars more" (- 3 (length ivy-text))))
- (let* ((buffers (cl-remove-if-not
- (lambda (b)
- (or (buffer-file-name b)
- (eq (with-current-buffer b
- major-mode) 'dired-mode)))
- (buffer-list)))
+ (let* ((buffers (cl-remove-if-not #'swiper-all-buffer-p (buffer-list)))
(re-full (funcall ivy--regex-function str))
re re-tail
cands match)
- [elpa] master 1e96d20 201/348: ivy-overlay.el (ivy-display-function-overlay): Fix up, (continued)
- [elpa] master 1e96d20 201/348: ivy-overlay.el (ivy-display-function-overlay): Fix up, Oleh Krehel, 2017/04/08
- [elpa] master f5276b0 180/348: Add char-fold-to-regexp option to swiper, Oleh Krehel, 2017/04/08
- [elpa] master 9f5f6e0 202/348: ivy-overlay.el (ivy-overlay-cleanup): Fixup, Oleh Krehel, 2017/04/08
- [elpa] master 74d83ab 216/348: Sort virtual buffers after open buffers., Oleh Krehel, 2017/04/08
- [elpa] master 17f8fb3 219/348: ivy.el (ivy-switch-buffer-other-window): Obey ivy-ignore-buffers, Oleh Krehel, 2017/04/08
- [elpa] master 07388d0 226/348: Shrink ivy to suitable height when reading actions., Oleh Krehel, 2017/04/08
- [elpa] master 2237916 223/348: ivy.el (ivy-call): setq default-directory instead of let, Oleh Krehel, 2017/04/08
- [elpa] master 1d97984 227/348: Ensure that ivy--regex-ignore-order always returns legal regexps, Oleh Krehel, 2017/04/08
- [elpa] master 7e02815 235/348: Fix counsel-rg to follow matching candidate, Oleh Krehel, 2017/04/08
- [elpa] master 530b7de 246/348: ivy.el: Use predicate when reading file names, Oleh Krehel, 2017/04/08
- [elpa] master 1c801a0 243/348: Ignore TAGS buffers in swiper-all,
Oleh Krehel <=
- [elpa] master 6519ecc 248/348: ivy.el (ivy-call): Don't mess with default-directory, Oleh Krehel, 2017/04/08
- [elpa] master 721db4c 244/348: counsel.el (counsel-grep-post-action-hook): New hook for counsel-ag/grep/pt, Oleh Krehel, 2017/04/08
- [elpa] master 49acd4c 242/348: Remap scroll-up/down-command instead of assigning C-v/M-v so page up/down works, Oleh Krehel, 2017/04/08
- [elpa] master c322613 240/348: ivy.el (ivy--magic-file-slash): Fix pasting "/etc/", Oleh Krehel, 2017/04/08
- [elpa] master 1304925 239/348: ivy.el (ivy--directory-done): Fix broken "/ssh:", Oleh Krehel, 2017/04/08
- [elpa] master 359a6c8 241/348: Address multiple problems with counsel-rg, Oleh Krehel, 2017/04/08
- [elpa] master 2ed3da4 252/348: counsel.el: Fix byte-compile warning, Oleh Krehel, 2017/04/08
- [elpa] master 09da543 253/348: swiper.el: Ease the creation of swiper-in-region functions, Oleh Krehel, 2017/04/08
- [elpa] master 3940f17 266/348: Fix typos, Oleh Krehel, 2017/04/08
- [elpa] master 25ac29f 079/348: ivy.el (ivy-completion-in-region): Avoid error for 0 candidates, Oleh Krehel, 2017/04/08