-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Set default vaule of consult-org-heading to current heading #366
Comments
I found out that this is already implemented in With the code below live-preview as also enabled: (ivy-configure 'counsel-org-goto
:update-fn 'auto) |
Related issue #287
Counsel is a different library than Consult, which is tied to Ivy and is constructed differently than Consult/Vertico/Selectrum etc. You can use Counsel/Ivy if that ecosystem works better for you.
If you pass a default candidate, the candidate will be moved to the top in Vertico/Selectrum. This is by construction since the first candidate is selected automatically when no other input has been made. There are two possibilities to solve this:
With Selectrum you can disable the movement of the default candidate like this: (advice-add #'consult-org-heading :around
(lambda (orig)
(let ((selectrum-move-default-candidate nil))
(funcall orig)))) However this Selectrum feature is incomplete in my opinion, since the starting position is not preserved as soon as one starts filtering. But generally I think he issue should be solved in the completion UI. I move this issue to minad/vertico#92 to track this and close this issue here. |
Thanks for the thorough explanation! I actually noticed the same issue in |
This is not what I am talking about, after quitting the point should of course be preserved. This is easy to solve by correct unwinding as you point out. The main complication is the preservation of the starting point when you filter. The optimal (complicated) solution looks like this:
|
For completeness, with wrap around (option 1. from my comment above), the order is preserved naturally:
|
And Selectrum does this, which is not optimal (1 is selected instead of 4, which comes after the default 3)
|
It would be amazing if
(consult-org-heading)
would set the current org heading as its default value.I tried to mess around with
:default "..."
regardless what I set in there, I was never able to pre-select any org-heading correctly.How would one implement this? I often have large org files and if this is implemented, I would be able to quickly skim the file like a TOC.
I think sometimes I got it to work but it moves the default value as the very first index which also breaks the correct file ordering (though it might be because I am using ivy and selectrum, not sure if anyone else has the same issue) .
The text was updated successfully, but these errors were encountered: