[TUHS] Fwd: Re: earliest Unix roff

Steffen Nurpmeso steffen at sdaoden.eu
Tue Sep 17 05:56:18 AEST 2019


Sorry, i said "yes" to the false question.

--- Forwarded from Steffen Nurpmeso <steffen at sdaoden.eu> ---
Date: Mon, 16 Sep 2019 21:12:28 +0200
From: Steffen Nurpmeso <steffen at sdaoden.eu>
To: chet.ramey at case.edu
Subject: Re: [TUHS] earliest Unix roff
Message-ID: <20190916191228.1YQHs%steffen at sdaoden.eu>
OpenPGP: id=EE19E1C1F2F7054F8D3954D8308964B51883A0DD; url=https://ftp.sdaoden.eu/steffen.asc; preference=signencrypt

Chet Ramey wrote in <95916cf9-9aa1-f949-0f37-0ae466e38aa2 at case.edu>:
 |On 9/16/19 8:10 AM, Clem Cole wrote:
 |>     I use the standalone Info reader (named info) if I want to look \
 |>     at the
 |>     Info output. 
 |> 
 |> Fair enough, but be careful, while I admit I have not looked in a while,
 |> info(gnu) relies on emacs keybindings and a number of very emacs'ish th\
 |> ings.
 |> Every time I have tried to deal with it, I have unprogram my fingers and
 |> reset them to emacs.
 |> 
 |> If it would have used more(1) [or even less(1)] then I would not \
 |> be as annoyed.
 |
 |It seems to me that the strength of info (the file format and program) is
 |the navigation of a menu-driven hierarchical document containing what are
 |essentially selectable links between sections. Something like more or less
 |is poorly suited to take advantage of those features.

But you can do that in man macros with a normal pager like
less(1), too.  I mean, i may bore people, but yes i have written
a macro extension for the mdoc macros which can be used to
generate a TOC, and which generates document local as well as
links to external manual pages.  This works for all output
formats, but particularly well for those which support links
themselves, HTML, PDF as well as grotty, the TTY output device of
groff.  There was a feature request, but it has not been included
yet.  (My own port of roff where it will ship out of the box i just
do not find time for, but i said to myself that after having
banged my head a thousand times against the wall of a totally
f....d up software code base, if i maintain yet another free
software project then this time i do not release anything until
i can say i am ready.)

You can see the manual page online if you want to, it is at [1]
(and itself the HTML output of a manual which uses the macro).
Nothing magic, it is just that the grotty device then uses
backspace escape sequences not only to embolden or otherwise
format text, but also to invisibly embed content information.
And a patched less(1) can search for these specially crafted
backspace sequences easily, in fact i use that each and every time
when i look at the manual page of the MUA i maintain, which is
even longer than the bash manual.  The patch for less is pretty
small, even though it cares for less conventions:

  #?0|kent:less.tar_bomb_git$ git diff master..mdocmx|wc -l
  413

  [1] https://www.sdaoden.eu/code-mdocmx.html

It has the deficite of not being able to dig macros as part of
headers, e.g. "HISTORY ON less(1)" where less(1) would be an
external link, this cannot work out the way the mdoc macros are
implemented in groff.  They would need to become rewritten, but no
time for that yet.  Other than that it works just fine for half
a decade, for development i have


  mdoc() (
    MDOCMX_ENABLE=1
    \export MDOCMX_ENABLE
    \: ${MDOCMXFLAGS:=-dmx-toc-force=tree}
    \mdocmx.sh "${1}" |
      \s-roff -Tutf8 -mdoc ${MDOCMXFLAGS} |
      LESS= \s-less --RAW-CONTROL-CHARS --ignore-case --no-init
  )

where s-roff and s-less are the patched version.  This is the
development version, the nice property of mdocmx is that the
preprocessing step can be shipped, in fact it is for half
a decade, too.  For such manuals you only need grotty/less to be
patched.  So then in in less i hit ^A and will be asked

  [anchor]:

then i enter the number and it scrolls into view.  And ' will
scroll back to where you have been before following the internal
link.  Likewise, if the entered number links an external manual
page you first see

  Read external manual: !man 1 sh

and if you hit return, you go there, temporarily suspending the
current less.  (This external thing is actually a compile time
option.)  So this is all i need, and it would be very nice to have
this possibility much more often.

Well.  The mandoc project has an option to generate links for
manual pages on best guess, too.  This works surprisingly well,
and does not need a patch for less as it generates the usual tag
files that you all know about.  It cannot support exact anchor
support, of course, and TOC generation it does not have too,
i think.

But anyway: it is possible.

 |You need a way to position the cursor with more flexibility than more gives
 |you.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

 -- End forward <20190916191228.1YQHs%steffen at sdaoden.eu>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the TUHS mailing list