ivy-next-history-element (run by M-n) contains a condition which inserts the symbol at point if (and (= minibuffer-history-position 0) (equal ivy-text "")).
If there is a symbol at point, then subsequent M-ns will skip that conditional and insert the actual future history. (aka, the list of defaults in this minibuffer session)
However, if there's no symbol at point, the first M-n will insert nothing. Since it also doesn't update minibuffer-history-position, the conditional will be hit every time, and so future history will never be used.
The fix is to delete this conditional in ivy-next-history-element; it's not the correct way to add a default. Instead, a default should be added in the normal way, either by adding values to minibuffer-default or by using minibuffer-default-add-function.
An example of one function that's broken by this is project-find-file (bound by default to C-x p f). Future history contains the current file path, so M-n is supposed to insert that, but ivy breaks this.
ivy-next-history-element (run by
M-n
) contains a condition which inserts the symbol at point if(and (= minibuffer-history-position 0) (equal ivy-text ""))
.If there is a symbol at point, then subsequent
M-n
s will skip that conditional and insert the actual future history. (aka, the list of defaults in this minibuffer session)However, if there's no symbol at point, the first
M-n
will insert nothing. Since it also doesn't update minibuffer-history-position, the conditional will be hit every time, and so future history will never be used.The fix is to delete this conditional in ivy-next-history-element; it's not the correct way to add a default. Instead, a default should be added in the normal way, either by adding values to minibuffer-default or by using minibuffer-default-add-function.
An example of one function that's broken by this is
project-find-file
(bound by default toC-x p f
). Future history contains the current file path, soM-n
is supposed to insert that, but ivy breaks this.