[feature discussion] ivy-set-actions universal #337

Closed
jtamagnan opened this Issue Jan 5, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@jtamagnan
Contributor

jtamagnan commented Jan 5, 2016

Would it be possible to have a a sort of universal ivy-set-actions to add an action to everything that uses ivy-read. My particular use case would be to hit "M-o i" to insert whatever text I have selected in the ivy-buffer at my point. I imagine that this feature could have other uses.

I was able to add this feature by changing some 3 lines of code. I can make a pull request if this seems like a feature that others would want.

@abo-abo abo-abo closed this in 6051225 Jan 5, 2016

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Jan 5, 2016

Owner

Good idea, thanks.

Owner

abo-abo commented Jan 5, 2016

Good idea, thanks.

@jtamagnan

This comment has been minimized.

Show comment
Hide comment
@jtamagnan

jtamagnan Jan 28, 2016

Contributor

I have the following code in my init file:

  (ivy-set-actions
   t
   '(("z" insert "insert")))

It works fine (allows me to insert the selected text, or do the default action) when I use some functions such as counsel-describe-function, counsel-describe-variable and ivy-switch-buffer but when I use kill-buffer or various other functions (some that call ivy-completing-read and other that call completing-read) I get

ivy-call: Wrong type argument: integerp, ("z" insert "insert")

when I hit enter. Also when using those functions that give a bug, if I hit M-o in the search buffer no list of keybindings appear. No matter which key I hit, be it "o" or "z" I get the same message "key is not bound"

Contributor

jtamagnan commented Jan 28, 2016

I have the following code in my init file:

  (ivy-set-actions
   t
   '(("z" insert "insert")))

It works fine (allows me to insert the selected text, or do the default action) when I use some functions such as counsel-describe-function, counsel-describe-variable and ivy-switch-buffer but when I use kill-buffer or various other functions (some that call ivy-completing-read and other that call completing-read) I get

ivy-call: Wrong type argument: integerp, ("z" insert "insert")

when I hit enter. Also when using those functions that give a bug, if I hit M-o in the search buffer no list of keybindings appear. No matter which key I hit, be it "o" or "z" I get the same message "key is not bound"

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Jan 28, 2016

Owner

Thanks, should be better now. However, e.g for describe-funtion, even if you select the "insert" action, the default action will still be called. Not much I can do to stop that, short of calling keyboard-quit (which I prefer not to do).

Owner

abo-abo commented Jan 28, 2016

Thanks, should be better now. However, e.g for describe-funtion, even if you select the "insert" action, the default action will still be called. Not much I can do to stop that, short of calling keyboard-quit (which I prefer not to do).

@jtamagnan

This comment has been minimized.

Show comment
Hide comment
@jtamagnan

jtamagnan Jan 28, 2016

Contributor

Thank you!

Contributor

jtamagnan commented Jan 28, 2016

Thank you!

@jtamagnan

This comment has been minimized.

Show comment
Hide comment
@jtamagnan

jtamagnan Feb 1, 2016

Contributor

It seems to do both actions (the default, and insert) for any function that is not in ivy--actions-list, this includes inserting text before killing a buffer ('kill-buffer), this raises an issue in read only buffers (makes them unclosable unless being killed from some different buffer). Any function that already has an entry in ivy--actions-list seems to work perfectly.

Contributor

jtamagnan commented Feb 1, 2016

It seems to do both actions (the default, and insert) for any function that is not in ivy--actions-list, this includes inserting text before killing a buffer ('kill-buffer), this raises an issue in read only buffers (makes them unclosable unless being killed from some different buffer). Any function that already has an entry in ivy--actions-list seems to work perfectly.

@abo-abo

This comment has been minimized.

Show comment
Hide comment
@abo-abo

abo-abo Feb 1, 2016

Owner

Please try to be more precise when describing a problem. It would make things easier for me if each issue had:

  1. Initial conditions that include any custom code setup, window/buffer/point layout and a sequence of actions.
  2. What you expect to occur.
  3. What actually happens.

Right now, since some of the info is missing, I don't really know what you want me to do, if anything.

It's also nice, if possible, to divide the issue into smaller independent pieces, rather piling new stuff onto an existing issue. So a follow up to your previous message should go into a new issue.

Owner

abo-abo commented Feb 1, 2016

Please try to be more precise when describing a problem. It would make things easier for me if each issue had:

  1. Initial conditions that include any custom code setup, window/buffer/point layout and a sequence of actions.
  2. What you expect to occur.
  3. What actually happens.

Right now, since some of the info is missing, I don't really know what you want me to do, if anything.

It's also nice, if possible, to divide the issue into smaller independent pieces, rather piling new stuff onto an existing issue. So a follow up to your previous message should go into a new issue.

@jtamagnan

This comment has been minimized.

Show comment
Hide comment
@jtamagnan

jtamagnan Feb 1, 2016

Contributor

Thank you for the guidance, I didn't really know the proper format about how issues are addressed on github, I'm pretty new to this all, I'll be clearer in the future and explain the issue I'm experiencing in a new issue with more explanation.

Contributor

jtamagnan commented Feb 1, 2016

Thank you for the guidance, I didn't really know the proper format about how issues are addressed on github, I'm pretty new to this all, I'll be clearer in the future and explain the issue I'm experiencing in a new issue with more explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment