emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master fef96f4 139/399: counsel.el (counsel--find-file-1): Extrac


From: Oleh Krehel
Subject: [elpa] master fef96f4 139/399: counsel.el (counsel--find-file-1): Extract
Date: Sat, 20 Jul 2019 14:57:10 -0400 (EDT)

branch: master
commit fef96f414ee00a836a7ebd173a6d90297640a4f0
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel--find-file-1): Extract
---
 counsel.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/counsel.el b/counsel.el
index 970da1b..6b9a8ba 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1837,20 +1837,26 @@ The preselect behaviour can be customized via user 
options
         buffer-file-name
         (file-name-nondirectory buffer-file-name))))
 
-;;;###autoload
-(defun counsel-find-file (&optional initial-input)
-  "Forward to `find-file'.
-When INITIAL-INPUT is non-nil, use it in the minibuffer during completion."
-  (interactive)
-  (ivy-read "Find file: " #'read-file-name-internal
+(defun counsel--find-file-1 (prompt initial-input action caller)
+  (ivy-read prompt #'read-file-name-internal
             :matcher #'counsel--find-file-matcher
             :initial-input initial-input
-            :action #'counsel-find-file-action
+            :action action
             :preselect (counsel--preselect-file)
             :require-match 'confirm-after-completion
             :history 'file-name-history
             :keymap counsel-find-file-map
-            :caller 'counsel-find-file))
+            :caller caller))
+
+;;;###autoload
+(defun counsel-find-file (&optional initial-input)
+  "Forward to `find-file'.
+When INITIAL-INPUT is non-nil, use it in the minibuffer during completion."
+  (interactive)
+  (counsel--find-file-1
+   "Find file: " initial-input
+   #'counsel-find-file-action
+   'counsel-find-file))
 
 (ivy-set-occur 'counsel-find-file 'counsel-find-file-occur)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]