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

Add option to control setting of completion-in-region-function #223

Closed
tsdh opened this issue Nov 1, 2020 · 11 comments
Closed

Add option to control setting of completion-in-region-function #223

tsdh opened this issue Nov 1, 2020 · 11 comments

Comments

@tsdh
Copy link

tsdh commented Nov 1, 2020

I just started using selectrum with prescient and I like it very much. However, one thing I would like to disable is the feature that normal in-buffer completion (completion-at-point-functions) is now also transferred into the minibuffer. How can I do that?

As an example of what I mean, here's a recipe for shell:

  1. M-x shell RET
  2. cd ~/R<TAB>

Now the path is going to be read from the minibuffer instead being normally TAB-completed in place (with possibly a *Completions* buffer if there are many choices starting with the current prefix or cycling if there are just a few).

@tsdh
Copy link
Author

tsdh commented Nov 1, 2020

Ah, to answer my own question: That does the trick.

(selectrum-mode 1)
  (setq-default completion-in-region-function
                selectrum--old-completion-in-region-function)

Maybe there should be a variable controlling if selectrum should activate itself for in-buffer completion, so I let that issue open for now.

@clemera
Copy link
Collaborator

clemera commented Nov 1, 2020

Having an option for this is a good idea, icomplete and ivy have this as well. BTW file completions act like find-file with selectrum so you can navigate through the path levels via completion.

@clemera clemera changed the title How to keep in-buffer completion (completion-at-point-functions) in-buffer? Add option to control setting of completion-in-region-function Nov 1, 2020
@clemera
Copy link
Collaborator

clemera commented Nov 2, 2020

If there is only one file candidate the minibuffer shouldn't open and the result should be inserted in place, we have to update that, too.

@tsdh
Copy link
Author

tsdh commented Nov 3, 2020

@clemera Yes, that in-buffer file completion completes the whole path in one go is actually nice but still I'm distracted by the input switching from one very specific position in a buffer to the bottom left minibuffer. That might be mitigated with a posframe, though, if you need ideas for things to play with. ;-)

@clemera
Copy link
Collaborator

clemera commented Nov 3, 2020

There is also mini-frame but it doesn't feature an "at point" option AFAIK.

@clemera
Copy link
Collaborator

clemera commented Nov 4, 2020

If there is only one file candidate the minibuffer shouldn't open and the result should be inserted in place, we have to update that, too.

After some experimentation I think it's better to pop to the minibuffer even if there is only one candidate (for file completion). Inserting the single candidate immediately will only help if you wanted to stop completion there but I think it is more common to navigate through several path levels and in this case the current behaviour has an advantage.

@clemera
Copy link
Collaborator

clemera commented Dec 9, 2020

When #261 got merged you only get prompted if there are multiple candidates for the current input.

@clemera
Copy link
Collaborator

clemera commented Dec 9, 2020

As mentioned over there I also added the option you asked for named selectrum-complete-in-buffer.

@clemera
Copy link
Collaborator

clemera commented Dec 9, 2020

Inserting the single candidate immediately will only help if you wanted to stop completion there but I think it is more common to navigate through several path levels and in this case the current behaviour has an advantage.

After reconsideration I think the behaviour of #261 is a good compromise, pressing TAB again will let you drop into the minibuffer after single candidate insertion if needed. This is also more similar to how default completion works and is generally better if the single candidate is a file and not directory.

@clemera
Copy link
Collaborator

clemera commented Dec 9, 2020

Should be fixed by #261?

@clemera clemera added the waiting on response Needs more info or follow-up, will be closed after 90 days if no response label Dec 9, 2020
@tsdh
Copy link
Author

tsdh commented Dec 10, 2020

@clemera The new option selectrum-complete-in-buffer does the trick for me. Thanks!

@clemera clemera closed this as completed Dec 10, 2020
@raxod502 raxod502 removed the waiting on response Needs more info or follow-up, will be closed after 90 days if no response label Dec 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants