abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

ivy-read-action hydra doesn't exit after calling ivy-done, it hides itself and continues to trap user input #2759

Closed AloisJanicek closed 3 years ago

AloisJanicek commented 3 years ago

When setting (setq ivy-read-action-format-function #'ivy-hydra-read-action)

Steps to reproduce:

  1. call counsel-recentf
  2. M-o on the desired candidate
  3. chose j "other window" action on desired candidate
  4. [files opens, hydra disappears, user input remains trapped]
  5. pressing j to navigate one line down in newly opened file leads to complete buffer content deletion with an error:
    ivy--done: No catch for tag: exit, nil
  6. pressing any other key which is not listed in the teal ivy-actions hydra leads to:
    An amaranth Hydra can only exit through a blue head

Unless user press some of the keys specified in ivy-dispatching-done-hydra-exit-keys or some of the head keys, user input remains trapped while hydra is nowhere to see. This is very confusing.

I verified this behavior on vanilla-ish (init.el) emacs 27.1 setup.

basil-conto commented 3 years ago

Any chance of a reproduction recipe starting from emacs -Q or make plain? Is the bug specific to counsel-recentf, or can you also reproduce it with e.g. counsel-find-file, which also has find-file-other-window bound to the j action?

I tried the following:

  1. emacs -Q
  2. (setq ivy-read-action-format-function #'ivy-read-action-format-columns) C-j
  3. M-x package-initialize RET
  4. M-x counsel-find-file RET ~/.emacs.d/init.el M-o j C-n

This visits my user-init-file in a second window without issue. So more details would be welcome. TIA.

AloisJanicek commented 3 years ago

Oh sorry for misleading you, of course I meant ivy-hydra-read-action. ivy-read-action-format-columns is working fine.

I am able to reproduce it with counsel-find-file and j other window action in HOME=/tmp/asdf emacs -Q session if I enable MELPA and install counsel, hydra and ivy-hydra from there. If I stay with ELPA, issue doesn't occur. Interesting.

basil-conto commented 3 years ago

(setq ivy-read-action-format-function #'ivy-hydra-read-action)

Shouldn't you be setting ivy-read-action-function instead?

AloisJanicek commented 3 years ago

Shouldn't you be setting ivy-read-action-function instead?

Of course I should! I apologize again for the confusion. Thank you for your help, it works now.

(setq ivy-read-action-function #'ivy-hydra-read-action)
(setq ivy-read-action-format-function #'ivy-read-action-format-columns)
basil-conto commented 3 years ago

No worries! Thanks for confirming.