Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
Showing
1 changed file
with
6 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
abo-abo
Owner
|
||
(symbol-value (car history))))) | ||
(setq history (car history))) | ||
(ivy-read (replace-regexp-in-string "%" "%%" prompt) | ||
collection | ||
:predicate predicate | ||
|
According to the documentation of completing-read: "Positions are counted starting from 1 at the beginning of the list". However, the documentation of nth states that: "N counts from zero"
Then, you should use (1- (nth ...)) here or the initial-input will not be correct.