[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` c
From: |
G. Branden Robinson |
Subject: |
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call. |
Date: |
Sat, 16 Mar 2024 17:02:30 -0500 |
Hi Thomas,
I've root-caused the problem.
It was way easier than I thought.
At 2024-03-16T16:35:37-0500, G. Branden Robinson wrote:
> At 2024-03-16T17:17:03-0400, Thomas Dickey wrote:
> > troff: backtrace: '/usr/share/groff/1.23.0/tmac/an.tmac':512: while loop
> > troff: backtrace: '/usr/share/groff/1.23.0/tmac/an.tmac':516: macro
> > 'an*scan-string-for-backslash'
[...]
> Yeah, that's my footer abbreviator all right (a new groff 1.23 feature,
> to say nothing of the suggestive path, so thanks to RMS for once for
> mandating the versioned subdirectory that so many people hate).
Here is the macro in question.
.\" Iterate through concatenation of arguments as a string. If a bare
.\" backslash is found, make `an*string-contains-backslash` true. Our
.\" caller should delete this register when done with it.
.de an*scan-string-for-backslash
. nr an*string-contains-backslash 0
. nr an*index 0
. length an*max-index \\$*
. while (\\n[an*index] < \\n[an*max-index]) \{\
. ds an*char \\$*
. substring an*char \\n[an*index] \\n[an*index]
. ec @
. \" Use a weird delimiter to reduce lexical colorizer confusion.
. if _@*[an*char]_\\_ .nr an*string-contains-backslash 1
. ec
. if \\n[an*string-contains-backslash] .break
. nr an*index +1
. \}
. rm an*char
. rr an*max-index
. rr an*index
..
Experienced *roff users will spot the problem instantly.
. ec @
I'm changing the escape character to an implausible value so that I can
scan a string for a backslash, which is the _default_ *roff escape
character.
My idea of "implausible" was...an at sign.
Evidently my imagination was failing me badly when I wrote this, because
@-bracketed sed replacements are something we use _IN GROFF_.
Even in `TH` macro calls!
.TH groff_man_style @MAN7EXT@ "@MDATE@" "groff @VERSION@"
But I never stepped on my own land mine because I _never_ run the
formatter on man pages before all text transformations on them are
complete.
There is no such thing as index(3) or strchr(3) in *roff.[1] To scan
the string for an '@' first and avoid it, perhaps using '#' instead, I'd
have to write a whole 'nother macro much like the above, or add a layer
of indirection that risks making things even more baffling.
So like Bartleby the Scrivener, I would prefer not to.
How badly do you need to keep running your "doit" sanity-checker on the
non-final versions of the man pages?
Do you feel that this is a real bug, or just noise?
Regards,
Branden
[1] I do actually have plans in this department.
https://savannah.gnu.org/bugs/index.php?62264
But I don't know if I'll have time to land them in groff 1.24, so
other people will likely encounter this issue. They have to turn on
a non-default warning category and use the '@' sign in the 4th
argument to their `TH` calls to hit it.
signature.asc
Description: PGP signature
- [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/15
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., Thomas Dickey, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., Thomas Dickey, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., Thomas Dickey, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call.,
G. Branden Robinson <=
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., Thomas Dickey, 2024/03/16
- Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call., G. Branden Robinson, 2024/03/16
- Prev by Date:
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call.
- Next by Date:
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call.
- Previous by thread:
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call.
- Next by thread:
Re: [PATCH 4/4] man/*.{1,1m,3x,5,7}: Soft-code ncurses version in `TH` call.
- Index(es):