From: Oleh Krehel Date: Thu, 16 Apr 2015 16:39:13 +0000 (+0200) Subject: Merge commit '0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f' from swiper X-Git-Url: https://code.delx.au/gnu-emacs-elpa/commitdiff_plain/ef2470117d8fccea2f5200bff27d6d1a04b855b7?hp=-c Merge commit '0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f' from swiper --- ef2470117d8fccea2f5200bff27d6d1a04b855b7 diff --combined packages/swiper/ivy.el index f4e368e29,bb0306a1e..bb0306a1e --- a/packages/swiper/ivy.el +++ b/packages/swiper/ivy.el @@@ -90,12 -90,18 +90,18 @@@ This is usually meant as a quick exit o Maximum length of the history list is determined by the value of `history-length', which see.") + (defvar ivy-require-match t + "Store require-match. See `completing-read'.") + ;;** Commands (defun ivy-done () "Exit the minibuffer with the selected candidate." (interactive) (delete-minibuffer-contents) - (unless (zerop ivy--length) + (if (zerop ivy--length) + (when (memq ivy-require-match '(nil confirm confirm-after-completion)) + (insert ivy-text) + (setq ivy-exit 'done)) (insert ivy--current) (setq ivy-exit 'done)) (exit-minibuffer)) @@@ -232,7 -238,7 +238,7 @@@ UPDATE-FN is called each time the curre (funcall ivy--action)))))) (defun ivy-completing-read (prompt collection - &optional predicate _require-match initial-input + &optional predicate require-match initial-input _history def _inherit-input-method) "Read a string in the minibuffer, with completion. @@@ -243,7 -249,7 +249,7 @@@ PROMPT is a string to prompt with; norm COLLECTION can be a list of strings, an alist, an obarray or a hash table. PREDICATE limits completion to a subset of COLLECTION. - _REQUIRE-MATCH is ignored for now. + REQUIRE-MATCH is stored into `ivy-require-match'. See `completing-read'. INITIAL-INPUT is a string that can be inserted into the minibuffer initially. _HISTORY is ignored for now. DEF is the default value. @@@ -261,6 -267,7 +267,7 @@@ The history, defaults and input-method (setq collection (cl-remove-if-not predicate collection))) (when (listp def) (setq def (car def))) + (setq ivy-require-match require-match) (ivy-read prompt collection initial-input nil def)) ;;;###autoload