I just started trying out ivy. I took the following example from the ivy tutorial:

(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 mih ()
  (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"))))

My problem is, no matter which option I select, only the default function is invoked. Say, I selected option "j" above, I still the message:

"action-1 bar" 

My expectation was that I would get:

"action-2 bar"

Since I did not make any changes to the code from the tutorial, I think I am missing something here.

Any ideas?

  • If you don't get a definitive answer here, maybe ask the Ivy maintainer. It's possible that the tutorial has a bug or is unclear. – Drew Aug 19 at 4:27
  • 1
    Tried your code, works as it should. M-x mih, select foo, M-o k, messages action-3: foo. – Hubisan Aug 19 at 20:57
  • 1
    I agree with @Hubisan, things seem to work here. Evaluate everything again. If it still doesn't work, please give us the exact steps to reproduce. – Damien Cassou Aug 20 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.