On Tue, Jun 11, 2024 at 07:24:53AM GMT, G. Branden Robinson wrote: > Hi Alex, Hi Branden! > > At 2024-06-11T10:54:27+0200, Alejandro Colomar wrote: > > > > We use '\e', not '\\'. (I haven't checked whether it also works, > > > > and don't remember.) > > > > > > Change this to '\e' and tested it. It looks like it works to me :) > > > > Hmm, yep, both work the same. I remember there's a small difference > > in meaning, but I don't know why we use \e. Anyway. > > GNU troff's Texinfo manual explains: > > --snip-- > The escape character is nearly always interpreted when encountered; > it is therefore desirable to have a way to interpolate it, disable it, > or change it. > > -- Escape sequence: \e > Interpolate the escape character. '\e' is interpreted even in copy > mode (*note Copy Mode::). > ... > The complement of copy mode--a 'roff' formatter's behavior when not > defining or appending to a macro, string, or diversion--where all macros > are interpolated, requests invoked, and valid escape sequences processed > immediately upon recognition, can be termed "interpretation mode". > > -- Escape sequence: \\ > The escape character, '\' by default, can escape itself. This > enables you to control whether a given '\n', '\g', '\$', '\*', > '\V', or '\?' escape sequence is interpreted at the time the macro > containing it is defined, or later when the macro is called.(1) > (*note Copy Mode-Footnote-1::) > > .nr x 20 > .de y > .nr x 10 > \&\nx > \&\\nx > .. > .y > => 20 10 > > You can think of '\\' as a "delayed" backslash; it is the escape > character followed by a backslash from which the escape character > has removed its special meaning. Consequently, '\\' is not an > escape sequence in the usual sense. In any escape sequence '\X' > that GNU 'troff' does not recognize, the escape character is > ignored and X is output. An unrecognized escape sequence causes a > warning in category 'escape', with two exceptions--'\\' is the > first. > --end snip-- > > This matters when you use "\\" inside macro arguments, for example. > > Personally, if what you want is a _backslash_, to the Linux man-pages > project I would recommend the special character escape sequence that > _means_ "backslash". > > GNU troff, Heirloom Doctools troff, and mandoc all recognize it; that > should be (more) than enough for places where the Linux man-pages get > installed. > > groff_man_style(7): > > \(rs Reverse solidus (backslash). The backslash is the default > escape character in the roff language, so it does not > represent itself in output. Also see \e above. > > You can of course spell it \[rs], which is even better. Hmmm, so we should \e => \[rs]. Thanks! I'll try to prepare a sed script for it. BTW, how are you doing with MR.sed? :) Have a lovely day! Alex > I would not give the same advice to bash or ncurses, which must be > portable to geriatric commercial Unix, for example. > > Regards > Branden -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature