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

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

[elpa] master 2d7f287 09/57: Improve "TAB" interaction with `confirm-non


From: Oleh Krehel
Subject: [elpa] master 2d7f287 09/57: Improve "TAB" interaction with `confirm-nonexistent-file-or-buffer'
Date: Tue, 19 May 2015 14:21:22 +0000

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

    Improve "TAB" interaction with `confirm-nonexistent-file-or-buffer'
    
    * ivy.el (ivy-partial-or-done): When
      `confirm-nonexistent-file-or-buffer' is t, and there are no
      candidates, modify the prompt to "(confirm)" right after the first
      "TAB".
    
    Re #76
---
 ivy.el |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ivy.el b/ivy.el
index fb1b74c..7838ab3 100644
--- a/ivy.el
+++ b/ivy.el
@@ -280,11 +280,17 @@ candidate."
            (new (try-completion postfix
                                 (mapcar (lambda (str) (substring str 
(string-match postfix str)))
                                         ivy--old-cands))))
-      (when new
-        (delete-region (minibuffer-prompt-end) (point-max))
-        (setcar (last parts) new)
-        (insert (mapconcat #'identity parts " ")
-                (if ivy-tab-space " " ""))))))
+      (if new
+          (progn
+            (delete-region (minibuffer-prompt-end) (point-max))
+            (setcar (last parts) new)
+            (insert (mapconcat #'identity parts " ")
+                    (if ivy-tab-space " " "")))
+        (when (and (eq confirm-nonexistent-file-or-buffer t)
+                   (memq (ivy-state-collection ivy-last)
+                         '(read-file-name-internal
+                           internal-complete-buffer)))
+          (ivy-done))))))
 
 (defun ivy-immediate-done ()
   "Exit the minibuffer with the current input."



reply via email to

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