It seems the mailing list doesn't like my message for some reason.
Let me try again for the 3rd time...

Forwarded message from onf on Mon Jan 20, 2025 at 2:27 PM:

Hello Ingo,

On Mon Jan 20, 2025 at 3:27 AM CET, Ingo Schwarze wrote:
> onf wrote on Mon, Jan 20, 2025 at 01:48:19AM +0100:
> > On Mon Nov 4, 2024 at 4:03 PM CET, onf wrote:
> >> On Mon Nov 4, 2024 at 1:45 AM CET, Alexis wrote:
> >>> "onf" <o...@disroot.org> writes:
> >>>> While you can absolutely get a list of manpages containing a 
> >>>> specific term of a specific type with apropos (like the example
> >>>> you gave), what I was getting at is that you can't say to your
> >>>> pager "jump to the flag -e". [...]
> >>> [...]
> >> [...]
>
> > Actually, BSD mandoc does implement this, it's just documented at
> > a poorly visible place in the docs. BSD mandoc's man(1):
>
> You have a point here.  I noticed myself in the past that the
> prominence of this feature in the documentation is significantly
> smaller than its usefulness.  It's also documented in mandoc(1),
> type either of these commands to see for yourself,
>
>   $ man -O tag=tag mandoc  # works on OpenBSD and perhaps on other BSDs
>                            # maybe even on Alpine, Void, or Chimera Linux
>   $ lynx https://man.openbsd.org/mandoc#tag  /* works everywhere */

I can confirm it works on Void; that's my daily driver and it's using
mandoc to format its manpages.

I've actually discovered this feature only thanks to coming across Tg
in mdoc(7).

> Admittedly, that's not particularly discoverable either.
>
> I tried to think of a more discoverable places in the past, but all that
> came to mind so far were inacceptable from a systematic perspective.
>
> I'm open to suggestions, though; maybe you have a good idea
> for a better place?

I think putting it into the opening of man(1) might not be a bad idea,
actually:
  The man utility displays the manual page entitled name.  Pages may be
  selected according to a specific category (section) or machine
  architecture (subsection).  When MANPAGER is less (the default),
  it is possible to jump to definitions of terms defined in the
  manual using the less command :t.

That's just a draft; I'm sure it can be worder better.

> [...]
> > The definitions are generated automatically, so all manpages written
> > in mdoc benefit from it.  I assume groff mdoc + man-db doesn't
> > implement this?
>
> Not that i know of.  It would actually be much harder to implement
> in groff than in mandoc because a full roff(7) implementation, by
> the basic design of how roff(7) works, lacks a semantic parse tree.
> So by the time you get to the output processors, they have no syntactic
> information left that they could work on.  It's all presentational
> at that point.

Hm, I don't think I agree. The macros could emit device commands which
implement this.

~ onf

Reply via email to