Hi Branden, On 2026-02-22 G. Branden Robinson wrote:
> At 2026-02-22T13:09:24+0100, Morten Bo Johansen wrote: >> On 2026-02-22 dvalin--- via GNU roff typesetting system discussion wrote: >> > Excessive consistency can sometimes reduce utility, in my experience. > >> But the bottom line here is that the macro description for e.g. the .AU >> macro in groff_ms looks like this: >> >> .AU Specify an author’s name. ms collects text on input lines (...) >> >> and in groff_mm, for an identically named macro, it looks like this: >> >> AU [name [initials [loc [dept [ext [room [arg1 [arg2 [arg3]]]]]]]]] >> Specify author >> >> This is just plain inconsistent in a non-excusable way. > > I largely agree. I'm not happy with it. > > But I'd resolve the inconsistency in the opposite direction from your > preference, and leave groff_man*(7) inconsistent with the new norm on > purpose, because so many authors of man(7) documents read and learn > nothing else about *roff and, inasmuch as they don't learn it, they > really shouldn't be undertaking macro definition on their own. Let > alone renaming, removing, appending to, or aliasing macros. Those > operations demand more than a superficial understanding of the > formatter's language. (You can get away with cargo-culting until a > crate explodes...) > > In my previous response I sketched a medium- to long-term solution for > improving search operations on man page contents. Okay. Meanwhile, I think I have found a solution. To search for e.g. the "am" request in man 7 groff from the command line or from a function, one could do: man 7 groff | less -c +/"[^a-zA-Z0-9]am[^a-zA-Z0-9]" this could seem like an attempt at simulating word boundaries, but of course this expression would normally fail if "am" was at the beginning or the end of a line. The thing is that it never is, in this context. There will always be either some white space or some control characters before and after the search string, and therefore the matching will always succeed. I believe that the pagers do their matching on the raw output from the "man" command which may be seen with e.g "man 7 groff_ms | cat -A | less". At the beginning of the line, there will always be spaces and the end of the line will always be seen by less as "$". At least this is my understanding of why this works. You may of course want to set me aright. It will also work with less(1), more(1) and most(1) regardless of what regexp libraries they were built with. If passing the macro without the leading dot to the expression, it will match both occurrences with and without the dot. Regards, Morten
