这是indexloc提供的服务,不要输入任何密码
Skip to content

ivy-next-history-element breaks future history when there's no symbol at point #3034

@catern

Description

@catern

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions