Status update: I have not reached the point where almost everything is 
implemented and running smoothly. Here is an asciicast if you want to see it in 
action: https://asciinema.org/a/92884 <https://asciinema.org/a/92884>

Notice how we have both prompts (available through mappings) and commands, and 
both have tab-completion. The repository is here: 
https://gitlab.com/HiPhish/info.vim <https://gitlab.com/HiPhish/info.vim>

The features missing are index search, virtual index, text search and knowing 
all the nodes in the file (for the 'g’ Goto node equivalent). Virtual index has 
been implemented on the info-side, but what about the rest? Any ideas how I can 
get that information? I have another question as well: how do I test whether a 
file or node even exists? For example, if the user types 'info --file herp 
--node derp’, how do I tell whether the problem is that file herp does not 
exist, or that node derp does not exist? info returns error code 0 in both 
cases, so that’s no use. Should I set the output to /dev/null and then parse 
the error string?

> On 05 Nov 2016, at 12:31, Alejandro Sanchez <[email protected]> wrote:
> 
> Hello GNU,
> 
> To give some context to my question, I want to have an info reader in Vim 
> (Neovim actually, but it should work in both), similar to Emacs’s info-mode. 
> I have looked at how Emacs does it and from the looks of it, it re-implements 
> the entire standalone reader in Emacs Lisp. That’s certainly a way to do it, 
> but it’s a lot of duplicate work when the standalone info reader already 
> knows everything about info files. Here is my plugin repository so far:
> https://gitlab.com/HiPhish/info.vim
> 
> So I was planning on leveraging the standalone info as a sort of file 
> processor: you send it parameters of what you want and you receive the 
> formatted output back. Let’s say I want to read the introduction to Bash:
> 
>       > info bash introduction --output - 2>/dev/null
> 
> This works fine, I can read that into a buffer. I can also specify an entire 
> path:
> 
>       > info bash introduction 'what is bash?' --output - 2>/dev/null
> 
> That’s half of the reader already. However, the other half is finding my way 
> around the file. References and menus are fairly simple to parse, but how do 
> I get what they point to? This is where the standalone info fails, I cannot 
> do something like this:
> 
>       > info bash --x-ref 'foo bar'
> 
> and get back the name of the node plus line number. Similarly, if I want to 
> search the index for something I would like to pass this to the shell:
> 
>       > info bash --index 'foo bar'
> 
> and get back a grep-like listing of where this occurs in the file. In my Vim 
> plugin I am using a URI for specifying locations in the info file (see the 
> HACKING in my repo for details):
> 
>       info://file-name/node-1/node-2/
> 
> I don’t expect info to return a URI like that back to me (although that would 
> be pretty cool), but I should have enough information to assemble it. A line 
> number can be given as a fragment or query within the URI. And of course if 
> someone has suggestions for a better URI I’m all ear.
> 
> 
> So I guess the bottom line of my question is, can standalone info be used in 
> such a way that I can call it to get information for navigation back from it? 
> And if not, can we extend it? I am a C programmer, but I don’t know my way 
> around Texinfo, that’s why I’m asking first.

Reply via email to