Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

jtamagnan opened this issue Jan 5, 2016 · 7 comments

Comments

@jtamagnan
Copy link
Contributor

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 as completed in 6051225 Jan 5, 2016
@abo-abo
Copy link
Owner

abo-abo commented Jan 5, 2016

Good idea, thanks.

@jtamagnan
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor Author

Thank you!

@jtamagnan
Copy link
Contributor Author

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
Copy link
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
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants