branch: master
commit adac116cd79d26585263b90c4559fef8177c4a1c
Author: Samuel Loury <[email protected]>
Commit: Oleh Krehel <[email protected]>
Make ivy-completing-read handle history as cons
The ivy-read function assumes that history is a symbol, hence
ivy-completing-read now makes sure that a symbol is given to
ivy-read.
Moreover, it makes sure that the value of initial-input is
coherent with the value of the HISTPOS part of the history
variable if it exists.
Fixes #295
---
ivy.el | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/ivy.el b/ivy.el
index 92b87fd..fe2d125 100644
--- a/ivy.el
+++ b/ivy.el
@@ -1238,6 +1238,12 @@ DEF is the default value.
_INHERIT-INPUT-METHOD is ignored for now.
The history, defaults and input-method arguments are ignored for now."
+ ;; See the doc of `completing-read'.
+ (when (consp history)
+ (when (numberp (cdr history))
+ (setq initial-input (nth (cdr history)
+ (symbol-value (car history)))))
+ (setq history (car history)))
(ivy-read (replace-regexp-in-string "%" "%%" prompt)
collection
:predicate predicate