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

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

[elpa] master 16eb4a2 31/57: When completing file names, defer to `minib


From: Oleh Krehel
Subject: [elpa] master 16eb4a2 31/57: When completing file names, defer to `minibuffer-complete' for "TAB"
Date: Tue, 19 May 2015 14:21:32 +0000

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

    When completing file names, defer to `minibuffer-complete' for "TAB"
    
    * ivy.el (ivy-partial-or-done): Call `minibuffer-complete'. If the
      resulting text is a valid directory, move there.
    (ivy-read): Setup `minibuffer-completion-table' and
    `minibuffer-completion-predicate'. This makes `minibuffer-complete'
    work.
    
    Fixes #92
---
 ivy.el |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ivy.el b/ivy.el
index 9b6ef69..fc6759a 100644
--- a/ivy.el
+++ b/ivy.el
@@ -293,10 +293,16 @@ When ARG is t, exit with current text, ignoring the 
candidates."
 When called twice in a row, exit the minibuffer with the current
 candidate."
   (interactive)
-  (or (ivy-partial)
-      (if (eq this-command last-command)
-         (ivy-done)
-       (ivy-alt-done))))
+  (if (eq (ivy-state-collection ivy-last) 'read-file-name-internal)
+      (progn
+        (minibuffer-complete)
+        (setq ivy-text (ivy--input))
+        (when (file-directory-p ivy-text)
+          (ivy--cd ivy-text)))
+    (or (ivy-partial)
+        (if (eq this-command last-command)
+            (ivy-done)
+          (ivy-alt-done)))))
 
 (defun ivy-partial ()
   "Complete the minibuffer text as much as possible."
@@ -685,6 +691,8 @@ RE-BUILDER is a lambda that transforms text into a regex."
              (minibuffer-with-setup-hook
                  #'ivy--minibuffer-setup
                (let* ((hist (or history 'ivy-history))
+                      (minibuffer-completion-table collection)
+                      (minibuffer-completion-predicate predicate)
                       (res (read-from-minibuffer
                             prompt
                             initial-input



reply via email to

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