[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3953b16 03/31: Respect `confirm-nonexistent-file-or-buffer
From: |
Oleh Krehel |
Subject: |
[elpa] master 3953b16 03/31: Respect `confirm-nonexistent-file-or-buffer' |
Date: |
Fri, 01 May 2015 14:28:41 +0000 |
branch: master
commit 3953b1612532561085740e6f421a5f09fb0fdb76
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Respect `confirm-nonexistent-file-or-buffer'
* ivy.el (ivy--extend-prompt): New defun.
(ivy-done): Ask for a confirmation if no candidates match and
`confirm-nonexistent-file-or-buffer' is t.
Re #60
---
ivy.el | 40 ++++++++++++++++++++++++++--------------
1 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/ivy.el b/ivy.el
index e1d6837..2330ac0 100644
--- a/ivy.el
+++ b/ivy.el
@@ -166,32 +166,44 @@ When non-nil, it should contain one %d.")
(defvar Info-current-file)
+(defun ivy--extend-prompt (str)
+ "Extend the current prompt with STR."
+ (unless (string-match str ivy--prompt)
+ (setq ivy--prompt
+ (if (string-match ": $" ivy--prompt)
+ (concat
+ (substring ivy--prompt 0 -2)
+ " " str ": ")
+ (concat ivy--prompt str " ")))))
+
;;** Commands
(defun ivy-done ()
"Exit the minibuffer with the selected candidate."
(interactive)
(delete-minibuffer-contents)
(when (cond (ivy--directory
- (insert
- (if (zerop ivy--length)
- (expand-file-name ivy-text ivy--directory)
- (expand-file-name ivy--current ivy--directory)))
- (setq ivy-exit 'done))
+ (if (zerop ivy--length)
+ (if (or (not (eq confirm-nonexistent-file-or-buffer t))
+ (string-match "confirm" ivy--prompt))
+ (progn
+ (insert
+ (expand-file-name ivy-text ivy--directory))
+ (setq ivy-exit 'done))
+ (ivy--extend-prompt "confirm")
+ (insert ivy-text)
+ (ivy--exhibit)
+ nil)
+ (insert
+ (expand-file-name
+ ivy--current ivy--directory))
+ (setq ivy-exit 'done)))
((zerop ivy--length)
(if (memq ivy-require-match
'(nil confirm confirm-after-completion))
(progn
(insert ivy-text)
(setq ivy-exit 'done))
- (unless (string-match "match required" ivy--prompt)
- (setq ivy--prompt
- (if (string-match ": $" ivy--prompt)
- (concat
- (substring ivy--prompt 0 -2)
- " (match required): ")
- (concat
- ivy--prompt
- "(match required) "))))
+ (ivy--extend-prompt "(match required)")
(insert ivy-text)
(ivy--exhibit)
nil))
- [elpa] master updated (fddedd2 -> 4137447), Oleh Krehel, 2015/05/01
- [elpa] master 455bea4 01/31: ivy.el (ivy--cd): Reset `ivy--old-re', Oleh Krehel, 2015/05/01
- [elpa] master 691b12c 02/31: ivy.el (ivy-read): Fixup preselect addition, Oleh Krehel, 2015/05/01
- [elpa] master 3953b16 03/31: Respect `confirm-nonexistent-file-or-buffer',
Oleh Krehel <=
- [elpa] master 948620f 04/31: Propertize remote buffers with ivy-remote face, Oleh Krehel, 2015/05/01
- [elpa] master e356df9 05/31: Reset to the first candidate when switching directories, Oleh Krehel, 2015/05/01
- [elpa] master 94fad10 06/31: Improve the match confirm while completing files, Oleh Krehel, 2015/05/01
- [elpa] master c816430 07/31: Minibuffer faces should inherit minibuffer-prompt, Oleh Krehel, 2015/05/01
- [elpa] master b2c9a20 09/31: Store the preselect and use it for empty ivy-text, Oleh Krehel, 2015/05/01
- [elpa] master 988b78f 08/31: Improve completion history using the propertize trick, Oleh Krehel, 2015/05/01
- [elpa] master eb43e4a 10/31: ivy.el (ivy-alt-done): Treat `ivy-text' with ":" verbatim, Oleh Krehel, 2015/05/01
- [elpa] master 00810d6 11/31: ivy.el (ivy--filter): Fixup, Oleh Krehel, 2015/05/01
- [elpa] master 7f04019 12/31: swiper.el (swiper-font-lock-ensure): Exclude `elfeed-search-mode', Oleh Krehel, 2015/05/01
- [elpa] master 278870e 13/31: Use alpha compositing to add ivy-current-match face, Oleh Krehel, 2015/05/01