Skip to content

default action vs last action #454

Description

@ericdanan

I'm not sure whether this is the intended behavior, but when I repeatedly call ivy-read with a list of actions, the default action seems to constantly update to the last action I applied.

Here is an example. As in section 6.3.5 of the ivy documentation I define the following:

 (defun my-action-1 (x)
   (message "action-1: %s" x))

 (defun my-action-2 (x)
   (message "action-2: %s" x))

 (defun my-action-3 (x)
   (message "action-3: %s" x))

 (defun my-command-with-3-actions ()
   (interactive)
   (ivy-read "test: " '("foo" "bar" "baz")
             :action '(1
                       ("o" my-action-1 "action 1")
                       ("j" my-action-2 "action 2")
                       ("k" my-action-3 "action 3"))))

If I call my-command-with-3-actions, select candidate foo and hit RET, I get action-1: foo. If I understand correctly, this is because RET applies the default action and the number 1 at the beginning of the action list identifies the first action as the default one.

But if I now call my-command-with-3-actions, select foo and apply the second action (hitting M-o j), then call my-command-with-3-actions again, select foo and hit RET, the second action is applied whereas I would expect the default, first one to be applied.

Am I getting something wrong?

Thanks

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