On Mon, May 17, 2021 at 04:09:37PM +0200, Thomas Schmitt wrote:
> Hi,
> 
> Greg Wooledge wrote:
> > the inability to *search* within the
> > info page to find occurrences of your keyword can be maddening.
> 
> It's not _that_ terrible. Pressing in
>   info dd
> the "/" key, i get a prompt
>   Regexp search []:
> 
> The input "dsync" brings me to the ‘dsync’ explanation.
> Pressing "/" again and then the Enter key, brings me to its line in the
> Concept index. Doing it again brings me back to the first found occurence.

That's in the info(1) tool.  I agree, info has a better search ability
than pinfo(1).  Also, dd isn't the best choice to demonstrate the issue,
because it's basically a single page anyway.

Let's take date as an example, and let's say that we want to know what
the %F does, because we saw someone use it.

In the man page, which has everything all together, it's simple:

unicorn:~$ man date | grep %F
       %F     full date; like %+4Y-%m-%d

Done!  Now, let's try that with pinfo date.  I ran pinfo date from my
shell, which took me to one of the pages within the tree of coreutils
texinfo documentation corresponding to the date program.  This particular
page is titled "21.1 ‘date’: Print or set system date and time".

I pressed /, typed %F, pressed Enter, and I got:

"Search string not found..."

That's because pinfo doesn't search beyond the current page, and the
current page is just a menu of links to other pages.

Now, to be fair, it's a different story in info(1).  I installed the
info package, and ran "info date" from my shell, which took me to the
same page (21.1).  I pressed /%FEnter and this time, it jumped me to
the description of %F on a different page (21.1.2).

The only problem is now I'm in the info(1) tool, which sucks. ;-)

Another approach is to attempt the search from the shell:

unicorn:~$ info date | grep %F
‘%F’
‘%F’, ‘%G’, and ‘%Y’ (all without modifiers), and requires a flag to be
          date -d @946684800 +"%F %T %z"

This is working as intended, but the issue is that the info page doesn't
have a concise one-line description of the %F format.  I could use something
like "grep -A10 %F" and hope.

Another workaround that I've found, which doesn't *always* work, but
works a good deal of the time, is:

unicorn:~$ info date | less

This dumps a flattened version of several of the texinfo pages into a
regular pager (less, in this case).  From here, I can use less's search
and navigation features, which are *far* easier for me.  In this particular
example, searching for %F within less takes me directly to the desired
section, and the 5-line description is prominently visible near the top
of the terminal.

Of course, doing this loses the ability to navigate the texinfo page tree
by following hyperlinks, but for quick searches that's a totally reasonable
trade-off.

Reply via email to