[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ce0a1f1 172/399: ivy.el (ivy--filter): Fix matcher not cal
From: |
Oleh Krehel |
Subject: |
[elpa] master ce0a1f1 172/399: ivy.el (ivy--filter): Fix matcher not called on input "" |
Date: |
Sat, 20 Jul 2019 14:57:17 -0400 (EDT) |
branch: master
commit ce0a1f1832320350ffdb2790fdd5e0cfeb16b87a
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
ivy.el (ivy--filter): Fix matcher not called on input ""
Fixes #2013
---
ivy.el | 104 ++++++++++++++++++++++++++++++++---------------------------------
1 file changed, 52 insertions(+), 52 deletions(-)
diff --git a/ivy.el b/ivy.el
index 4cc60d4..3d917d2 100644
--- a/ivy.el
+++ b/ivy.el
@@ -3051,62 +3051,62 @@ In any Ivy completion session, the case folding starts
with
RE is a list of cons cells, with a regexp car and a boolean cdr.
When the cdr is t, the car must match.
Otherwise, the car must not match."
- (ignore-errors
- (dolist (re (if (stringp re) (list (cons re t)) re))
- (let* ((re-str (car re))
- (pred
- (if mkpred
- (funcall mkpred re-str)
- (lambda (x) (string-match-p re-str x)))))
- (setq candidates
- (cl-remove nil candidates
- (if (cdr re) :if-not :if)
- pred))))
- candidates))
+ (if (string= re "")
+ candidates
+ (ignore-errors
+ (dolist (re (if (stringp re) (list (cons re t)) re))
+ (let* ((re-str (car re))
+ (pred
+ (if mkpred
+ (funcall mkpred re-str)
+ (lambda (x) (string-match-p re-str x)))))
+ (setq candidates
+ (cl-remove nil candidates
+ (if (cdr re) :if-not :if)
+ pred))))
+ candidates)))
(defun ivy--filter (name candidates)
"Return all items that match NAME in CANDIDATES.
CANDIDATES are assumed to be static."
- (if (string= name "")
- candidates
- (let ((re (funcall ivy--regex-function name)))
- (if (and
- ivy--old-re
- ivy--old-cands
- (equal re ivy--old-re))
- ;; quick caching for "C-n", "C-p" etc.
- ivy--old-cands
- (let* ((re-str (ivy-re-to-str re))
- (matcher (ivy-state-matcher ivy-last))
- (case-fold-search (ivy--case-fold-p name))
- (cands (cond
- ((and ivy--old-re
- (stringp re)
- (stringp ivy--old-re)
- (not (string-match-p "\\\\" ivy--old-re))
- (not (equal ivy--old-re ""))
- (memq (cl-search
- (if (string-match-p "\\\\)\\'"
ivy--old-re)
- (substring ivy--old-re 0 -2)
- ivy--old-re)
- re)
- '(0 2)))
- (ivy--re-filter re ivy--old-cands))
- (matcher
- (funcall matcher re candidates))
- (t
- (ivy--re-filter re candidates)))))
- (if (memq (cdr (assq (ivy-state-caller ivy-last)
- ivy-index-functions-alist))
- '(ivy-recompute-index-swiper
- ivy-recompute-index-swiper-async))
- (progn
- (ivy--recompute-index name re-str cands)
- (setq ivy--old-cands (ivy--sort name cands)))
- (setq ivy--old-cands (ivy--sort name cands))
- (ivy--recompute-index name re-str ivy--old-cands))
- (setq ivy--old-re re)
- ivy--old-cands)))))
+ (let ((re (funcall ivy--regex-function name)))
+ (if (and
+ ivy--old-re
+ ivy--old-cands
+ (equal re ivy--old-re))
+ ;; quick caching for "C-n", "C-p" etc.
+ ivy--old-cands
+ (let* ((re-str (ivy-re-to-str re))
+ (matcher (ivy-state-matcher ivy-last))
+ (case-fold-search (ivy--case-fold-p name))
+ (cands (cond
+ ((and ivy--old-re
+ (stringp re)
+ (stringp ivy--old-re)
+ (not (string-match-p "\\\\" ivy--old-re))
+ (not (equal ivy--old-re ""))
+ (memq (cl-search
+ (if (string-match-p "\\\\)\\'" ivy--old-re)
+ (substring ivy--old-re 0 -2)
+ ivy--old-re)
+ re)
+ '(0 2)))
+ (ivy--re-filter re ivy--old-cands))
+ (matcher
+ (funcall matcher re candidates))
+ (t
+ (ivy--re-filter re candidates)))))
+ (if (memq (cdr (assq (ivy-state-caller ivy-last)
+ ivy-index-functions-alist))
+ '(ivy-recompute-index-swiper
+ ivy-recompute-index-swiper-async))
+ (progn
+ (ivy--recompute-index name re-str cands)
+ (setq ivy--old-cands (ivy--sort name cands)))
+ (setq ivy--old-cands (ivy--sort name cands))
+ (ivy--recompute-index name re-str ivy--old-cands))
+ (setq ivy--old-re re)
+ ivy--old-cands))))
(defun ivy--set-candidates (x)
"Update `ivy--all-candidates' with X."
- [elpa] master 1b13ee8 162/399: ivy.el (ivy--use-selectable-prompt): Cache ivy--prompt-selected-p, (continued)
- [elpa] master 1b13ee8 162/399: ivy.el (ivy--use-selectable-prompt): Cache ivy--prompt-selected-p, Oleh Krehel, 2019/07/20
- [elpa] master 92ec03c 163/399: ivy-test.el (ivy-use-selectable-prompt): Add tests, Oleh Krehel, 2019/07/20
- [elpa] master b2693d1 160/399: counsel.el (counsel-locate-db-path): New defcustom, Oleh Krehel, 2019/07/20
- [elpa] master 44ea8b5 166/399: counsel.el (counsel-git-grep-cmd-function): Add, Oleh Krehel, 2019/07/20
- [elpa] master 502eae6 159/399: counsel.el (counsel--call): Rename to counsel--command, Oleh Krehel, 2019/07/20
- [elpa] master 115efb7 170/399: ivy.el (ivy--sorted-files): Work around all-completions returning $$, Oleh Krehel, 2019/07/20
- [elpa] master 6c858c1 168/399: ivy.el (ivy--filter): Improve performance with :matcher, Oleh Krehel, 2019/07/20
- [elpa] master ba849e5 173/399: ivy.el (ivy--re-filter): Fix for ivy--regex-ignore-order, Oleh Krehel, 2019/07/20
- [elpa] master 5458f93 169/399: ivy.el (ivy--filter): Avoid a filter on empty input, Oleh Krehel, 2019/07/20
- [elpa] master 9c53320 174/399: swiper.el (swiper-isearch-function): Fix for strings with trailing \|, Oleh Krehel, 2019/07/20
- [elpa] master ce0a1f1 172/399: ivy.el (ivy--filter): Fix matcher not called on input "",
Oleh Krehel <=
- [elpa] master 39759cf 180/399: ivy-test.el (ivy-with): Save current buffer, Oleh Krehel, 2019/07/20
- [elpa] master fa87b97 182/399: ivy-test.el: Print version, Oleh Krehel, 2019/07/20
- [elpa] master 8482f62 179/399: swiper.el (swiper-isearch-function): Fix str is " ", Oleh Krehel, 2019/07/20
- [elpa] master 482088c 178/399: swiper.el (swiper--avy-candidates): Fix for swiper-background-faces, Oleh Krehel, 2019/07/20
- [elpa] master 0e62f0d 185/399: counsel.el (counsel-switch-buffer-other-window): Update prompt, Oleh Krehel, 2019/07/20
- [elpa] master 5115df3 184/399: counsel.el: counsel-switch-buffer-other-window: new command., Oleh Krehel, 2019/07/20
- [elpa] master 0a12708 164/399: swiper.el: Add swiper background faces, Oleh Krehel, 2019/07/20
- [elpa] master 7e73580 171/399: ivy-test.el (counsel-find-file-with-dollars): Add test, Oleh Krehel, 2019/07/20
- [elpa] master c47a7dc 176/399: ivy.el (ivy--filter): Don't cache if the result of matching cache is empty, Oleh Krehel, 2019/07/20
- [elpa] master 4171364 183/399: ivy-test.el (counsel-find-file-with-dotfiles): Disable for emacs27, Oleh Krehel, 2019/07/20