]> code.delx.au - gnu-emacs-elpa/commitdiff
Merge commit '0cffcacdb0e0a035aa75f5276ca0c4cba688fc6f' from swiper
authorOleh Krehel <ohwoeowho@gmail.com>
Thu, 16 Apr 2015 16:39:13 +0000 (18:39 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Thu, 16 Apr 2015 16:39:13 +0000 (18:39 +0200)
1  2 
packages/swiper/ivy.el

diff --combined packages/swiper/ivy.el
index f4e368e2931a666aa5f7d9b8dbc6229f37d196c5,bb0306a1e41cc3a5b4704a1fb6709687954c10ed..bb0306a1e41cc3a5b4704a1fb6709687954c10ed
--- 2/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