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))
(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.
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.
(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