[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ec3e062 034/184: counsel (counsel-file-jump): Use temp buf
From: |
Oleh Krehel |
Subject: |
[elpa] master ec3e062 034/184: counsel (counsel-file-jump): Use temp buffer instead of split-string |
Date: |
Wed, 16 Oct 2019 13:14:44 -0400 (EDT) |
branch: master
commit ec3e062fb13d9fd4a922b180af3ae0218889d5ea
Author: Philip K <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel (counsel-file-jump): Use temp buffer instead of split-string
counsel (counsel-dired-jump): Use temp buffer instead of split-string
counsel (counsel-{file,dired}-jump): Avoid nbutlast
counsel (counsel-{file,dired}-jump): Factored out common code
Fixes #2120
---
counsel.el | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/counsel.el b/counsel.el
index b5b195d..f7da46f 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2549,7 +2549,19 @@ FZF-PROMPT, if non-nil, is passed as `ivy-read' prompt
argument."
(message (cdr x)))
:caller 'counsel-rpm)))
-(defcustom counsel-file-jump-args ". -name '.git' -prune -o -type f -print |
cut -c 3-"
+(defun counsel--find-return-list (args skip-first)
+ (with-temp-buffer
+ (apply #'call-process find-program nil (current-buffer) nil args)
+ (goto-char (point-min))
+ (when skip-first
+ (forward-line))
+ (let ((start (point)) files)
+ (while (search-forward "\n" nil t)
+ (push (buffer-substring (+ 2 start) (1- (point))) files)
+ (setq start (point)))
+ files)))
+
+(defcustom counsel-file-jump-args ". -name .git -prune -o -type f -print"
"Arguments for the `find-command' when using `counsel-file-jump'."
:type 'string)
@@ -2567,10 +2579,7 @@ INITIAL-DIRECTORY, if non-nil, is used as the root
directory for search."
(counsel-require-program find-program)
(let ((default-directory (or initial-directory default-directory)))
(ivy-read "Find file: "
- (split-string
- (shell-command-to-string
- (concat find-program " " counsel-file-jump-args))
- "\n" t)
+ (counsel--find-return-list (split-string counsel-file-jump-args)
nil)
:matcher #'counsel--find-file-matcher
:initial-input initial-input
:action #'find-file
@@ -2586,7 +2595,7 @@ INITIAL-DIRECTORY, if non-nil, is used as the root
directory for search."
(dired (or (file-name-directory x) default-directory)))
"open in dired")))
-(defcustom counsel-dired-jump-args ". -name '.git' -prune -o -type d -print |
cut -c 3-"
+(defcustom counsel-dired-jump-args ". -name .git -prune -o -type d -print"
"Arguments for the `find-command' when using `counsel-dired-jump'."
:type 'string)
@@ -2604,10 +2613,7 @@ INITIAL-DIRECTORY, if non-nil, is used as the root
directory for search."
(counsel-require-program find-program)
(let ((default-directory (or initial-directory default-directory)))
(ivy-read "Find directory: "
- (split-string
- (shell-command-to-string
- (concat find-program " " counsel-dired-jump-args))
- "\n" t)
+ (counsel--find-return-list (split-string
counsel-dired-jump-args) t)
:matcher #'counsel--find-file-matcher
:initial-input initial-input
:action (lambda (d) (dired-jump nil (expand-file-name d)))
- [elpa] master updated (22e3e88 -> c2d3a4c), Oleh Krehel, 2019/10/16
- [elpa] master 196b4ea 001/184: doc/Makefile: Add target to install the info pages, Oleh Krehel, 2019/10/16
- [elpa] master 0a9fb0c 009/184: swiper.el (swiper--isearch-function): Refactor, Oleh Krehel, 2019/10/16
- [elpa] master f0ec850 005/184: swiper.el (swiper-isearch): Fix for ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master 2a036b8 002/184: swiper.el (swiper--isearch-function): Change., Oleh Krehel, 2019/10/16
- [elpa] master ad0f605 008/184: swiper.el (swiper--isearch-function-1): Extract, Oleh Krehel, 2019/10/16
- [elpa] master dc7f5e0 012/184: swiper.el (swiper--isearch-function): Works for ivy--regex-ignore-order, Oleh Krehel, 2019/10/16
- [elpa] master 50ead7e 013/184: ivy-test.el (swiper-thing-at-point): Add and fix test, Oleh Krehel, 2019/10/16
- [elpa] master ec3e062 034/184: counsel (counsel-file-jump): Use temp buffer instead of split-string,
Oleh Krehel <=
- [elpa] master 13be8ab 004/184: ivy.el (ivy--reset-state): Fix ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master 039353d 007/184: ivy.el (ivy--preselect-index): Fix ivy-resume for swiper-isearch, Oleh Krehel, 2019/10/16
- [elpa] master c7ffd06 016/184: swiper.el (swiper-isearch-action): Make ivy-previous-line-or-history work, Oleh Krehel, 2019/10/16
- [elpa] master b4c4a7f 011/184: swiper.el (swiper--isearch-next-item): Extract, Oleh Krehel, 2019/10/16
- [elpa] master b9f3e3b 017/184: swiper.el (swiper-isearch-action): Simplify, Oleh Krehel, 2019/10/16
- [elpa] master 38b5d83 015/184: swiper.el (swiper--isearch-filter-ignore-order): Extract, Oleh Krehel, 2019/10/16
- [elpa] master 5f99723 019/184: counsel.el (counsel--async-last-command): Add for ease of debugging, Oleh Krehel, 2019/10/16
- [elpa] master fb486d8 024/184: ivy.el (ivy-immediate-done): Add copy-sequence to fix read-directory-name, Oleh Krehel, 2019/10/16
- [elpa] master f71f89a 029/184: ivy-test.el (ivy-swiper-wgrep): Expect fail on <=24.3, Oleh Krehel, 2019/10/16
- [elpa] master 230137b 047/184: ivy.el (ivy-restrict-to-matches): Work for dynamic collection, Oleh Krehel, 2019/10/16