groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] .if !dTS - GNU extension?


From: Ingo Schwarze
Subject: Re: [Groff] .if !dTS - GNU extension?
Date: Fri, 29 Apr 2016 10:56:52 +0200
User-agent: Mutt/1.5.24 (2015-08-30)

Hi James,

James K. Lowden wrote on Thu, Apr 28, 2016 at 08:18:51PM -0400:
> On Thu, 28 Apr 2016 19:10:22 +0200
> Ingo Schwarze <address@hidden> wrote:

>> Take a large manual, for example ksh(1).
>> With the mandoc-based implementation of man(1), type
>> 
>>   $ man ksh
>> 
>> Then inside less(1), type
>> 
>>   :t read
>> 
>> to jump straight to the description of the "read" builtin command,

> That's very inviting.  Why doesn't it work for *me*?  ;-)  
> 
>       $ /usr/bin/mandoc $(man -w ksh) | less -t read
>       No tags file

It can't work when you pipe by hand.  The order of processing needs
to be:

 1. Let the parser parse the file.
 2. Let the formatter format the file and collect information.
 3. Let the formatter write the ctags file.
 4. Let the man(1) steering program fork and exec less(1).

It is crucial to have step 4 after step step 3 because before that,
the ctags file simply doesn't exist yet.

Your order of evens is:

 1. Let the shell set up the pipe.
 2. Let the shell fork and exec mandoc.
 3. Let the shell fork and exec less (likely before the parser
    is even finished and before the formatter even started.

You try can be improved a bit as

        $ man ksh | less -t read

but even that won't work.  When stdout is not a terminal (but, for
example, a pipe or a regular file), indexing isn't attempted, and
when called as mandoc(1) rather than man(1), it isn't at all.
Only :t from inside less(1) can work.

Well, i could implement a -t option for man(1) itself, such that
man(1) would pass it on to less(1) during exec(3).  But that doesn't
reduce the number of keystrokes required, so it would be additional
code providing little new value.

Yours,
  Ingo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]