[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 4d533b2 178/184: counsel.el (counsel-dired): Filter to dir
From: |
Oleh Krehel |
Subject: |
[elpa] master 4d533b2 178/184: counsel.el (counsel-dired): Filter to directories only |
Date: |
Wed, 16 Oct 2019 13:15:18 -0400 (EDT) |
branch: master
commit 4d533b25bdb7e8335ce47e64c4c357957317e1a1
Author: Hong Xu <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-dired): Filter to directories only
Allow `counsel-find-file' to accept a file with its type limited to
regular files or directories.
It also enables more features in ivy in a directory selector in the
future than `read-directory-name' (e.g., #1646).
Fixes #2275
---
counsel.el | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/counsel.el b/counsel.el
index efac1ee..8f92523 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1880,6 +1880,9 @@ but the leading dot is a lot faster."
,(regexp-opt completion-ignored-extensions))
(regexp :tag "Regex")))
+(defvar counsel--find-file-predicate nil
+ "When non-nil, `counsel--find-file-matcher' will use this predicate.")
+
(defun counsel--find-file-matcher (regexp candidates)
"Return REGEXP matching CANDIDATES.
Skip some dotfiles unless `ivy-text' requires them."
@@ -1889,6 +1892,9 @@ Skip some dotfiles unless `ivy-text' requires them."
(lambda (re-str)
(lambda (x)
(string-match re-str (directory-file-name x)))))))
+ (when counsel--find-file-predicate
+ (let ((default-directory ivy--directory))
+ (setq res (cl-remove-if-not counsel--find-file-predicate res))))
(if (or (null ivy-use-ignore)
(null counsel-find-file-ignore-regexp)
(string-match-p "\\`\\." ivy-text))
@@ -2183,10 +2189,11 @@ result as a URL."
"Forward to `dired'.
When INITIAL-INPUT is non-nil, use it in the minibuffer during completion."
(interactive)
- (counsel--find-file-1
- "Dired (directory): " initial-input
- (lambda (d) (dired (expand-file-name d)))
- 'counsel-dired))
+ (let ((counsel--find-file-predicate #'file-directory-p))
+ (counsel--find-file-1
+ "Dired (directory): " initial-input
+ (lambda (d) (dired (expand-file-name d)))
+ 'counsel-dired)))
(ivy-configure 'counsel-dired
:display-transformer-fn #'ivy-read-file-transformer)
- [elpa] master 3bd1d87 182/184: counsel.el (counsel-locate-cmd-es): Encode command to local codepage, (continued)
- [elpa] master 3bd1d87 182/184: counsel.el (counsel-locate-cmd-es): Encode command to local codepage, Oleh Krehel, 2019/10/16
- [elpa] master 8b4693c 169/184: counsel.el (counsel-imenu-action and -get-canditates-from): Revert., Oleh Krehel, 2019/10/16
- [elpa] master 882d6c4 161/184: counsel.el (counsel-imenu): Work with :update-fn 'auto, Oleh Krehel, 2019/10/16
- [elpa] master 1a9002b 168/184: ivy.el: Clean up obsolete aliases, Oleh Krehel, 2019/10/16
- [elpa] master c2d3a4c 184/184: Merge commit 'cd634c6f51458f81898ecf2821ac3169cb65a1eb' from ivy, Oleh Krehel, 2019/10/16
- [elpa] master 12f4771 124/184: ivy.el (ivy-completion-in-region): Add workaround for package-menu-filter, Oleh Krehel, 2019/10/16
- [elpa] master 2b974b4 139/184: ivy.el (ivy-update-fns-alist): New defcustom, Oleh Krehel, 2019/10/16
- [elpa] master 57e0b94 146/184: swiper.el (swiper--action): Set case-fold-search, Oleh Krehel, 2019/10/16
- [elpa] master cdca2fc 141/184: counsel.el (counsel-switch-buffer): Re-use ivy-switch-buffer, Oleh Krehel, 2019/10/16
- [elpa] master a5701a9 159/184: ivy.el (ivy-configure): Add :format-fn, Oleh Krehel, 2019/10/16
- [elpa] master 4d533b2 178/184: counsel.el (counsel-dired): Filter to directories only,
Oleh Krehel <=
- [elpa] master ec1ed07 171/184: counsel.el (counsel--find-file-1): Use dired-current-directory for dired, Oleh Krehel, 2019/10/16
- [elpa] master 1d8803e 181/184: Ensure that ripgrep on windows uses '/' as the path-separator, Oleh Krehel, 2019/10/16
- [elpa] master 7854d03 129/184: counsel.el (counsel-google): Add, Oleh Krehel, 2019/10/16
- [elpa] master cd634c6 183/184: doc/Changelog.org: Release 0.13.0, Oleh Krehel, 2019/10/16
- [elpa] master 0dfd70d 135/184: counsel.el (counsel-google-function): Require json, Oleh Krehel, 2019/10/16
- [elpa] master eed1f06 138/184: counsel.el (counsel--py-action): Don't auto-insert parens, Oleh Krehel, 2019/10/16
- [elpa] master 52295c4 137/184: swiper.el (swiper-isearch): Fix searching for "$^", Oleh Krehel, 2019/10/16
- [elpa] master 80c2669 142/184: ivy.el (ivy--alist-set): Work-around emacs-24.3 not having alist-get, Oleh Krehel, 2019/10/16
- [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