-
-
Notifications
You must be signed in to change notification settings - Fork 102
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 a ‘consult-info’ command. #128
Conversation
This looks pretty good already! Maybe nested sections should be presented flattemed as in the imenu? There is a completing-read in the source. Please replace that with consult--read too for consistency. How does it differ from the selectrum wiki version? |
I think that they should, but I don't know of a good way to do it. Do you have any ideas? For example, below is the contents of an Info buffer. The challenge is that I don't know how guaranteed the formatting is. It looks like each sub-node in a node is listed, and then the contents of each sub-node. It would be easy with something like Org or Markdown, but there isn't much formatting information to work with in an Info buffer.
Fixed.
It differs in the following ways:
|
I wonder how you extract the headlines right now such that it is reliable. Why is it not possible to extract all the headlines as some kind of nested datastructure and then flatten it afterwards? Thank you for the changes and the further explanations! |
Right now, the function From what I can tell (though I am not very familiar with the Info format), I don't think that there is any tree structure available, just a flat list of links. |
What I meant is - if there is a nested list like this:
we can fold it to I tried the following org file:
and this is what I got, there is the flat menu and the detailed node listing. Seems not too hard to parse, however I am not sure how stable this format is. And in the end there is this tag table?
|
@okamsn Note that consult-outline also works in the info buffer, so I wonder about the specific advantages of this command. If we cannot make it significantly better than that by specializing in info we should not add this here. |
Based on ‘selectrum-info’ from the Selectrum wiki.
The purpose of the I have updated the regexp to work with your example, and have copied into the code a comment from the
One visual difference between
|
Thank you for the response! I will try this out soon. Then I can tell more if it is valuable to have over the default info command or consult-outline. Maybe we can make it more useful by providing a preview function too? |
Ok I tried it now, and it is good. I would definitely like to have such a command in Consult. But I would like to see a few enhancements in order to make this really a major improvement over the existing infrastructure, the My wishlist:
Regarding the descriptions - there is also the questios if the descriptions could somehow be provided as Marginalia annotators such that they are useful also for the builtin commands (point 2 and point 3). But then the description would not be searchable without going to an Embark Collect or Completions buffer. What do you think? |
0e8f273
to
6511012
Compare
Friendly ping @okamsn |
Sorry, I got caught up with work. I'm still working on this. Getting the descriptions by opening the file was too slow, so I'm trying to get candidates from the top-level Info buffer. Many of these candidates are links to subsections within an Info document, instead of just candidates that would open a file, like the command does now. I have not yet tried caching the links on first run. I still believe that the descriptions should be part of the candidate and not added by Marginalia |
Closing this PR until I have more time to work on this. |
Okay! I hope you can pick this up again! |
I wonder if the code to pull out the description would be better off as an annotation in marginalia? |
I think I made this suggestion before, but it is not very easy since you have to parse the info files extract the description etc. In any case this will require caching and someone coming forward with a PR ;) |
See above. |
Based on ‘selectrum-info’ from the Selectrum wiki, but simplified and without
cl-loop
.This goes through an Info buffer and matches against links in the table of contents.
This works well for most cases, but is a bit odd when dealing with TOCs with multiple sub levels, as seen in the following images. I'd prefer that child nodes immediately follow parent nodes, but I'm not sure how to do that.
This command adds the node description (if any) to the candidate, to allow for better searching.