quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] [patch 07/26] Escape ASCII hyphen-minus characters used


From: G. Branden Robinson
Subject: Re: [Quilt-dev] [patch 07/26] Escape ASCII hyphen-minus characters used as such.
Date: Tue, 12 Jul 2022 09:40:52 -0500

Hi Jean,

At 2018-06-20T11:33:25+0200, Jean Delvare wrote:
> On Sat, 16 Jun 2018 12:22:39 -0400, g.branden.robinson@gmail.com wrote:
> > When a "literal" ASCII 45 hyphen-minus character is desired, it has
> > to be escaped; this is a requirement going all the way back to Bell
> > Labs Troff, but is frequently overlooked.  Getting it right enables
> > accurate cut-and-paste of code examples, filenames, URLs, and so
> > forth from roff documents prepared for UTF-8 terminal and PDF
> > output, possibly among others.
> > 
> > See section 2.1 of CSTR #54, "Troff User's Manual", Ossanna &
> > Kernighan <https://www.troff.org/54.pdf>.
> 
> I'm curious why hyphens must be double-escaped (\\) while
> double-quotes are only escaped once (\)?

That appears to be an error on my part.  The extra layer of
backslash-escaping is necessary because the quilt.1 file is generated by
make using target rules that process quilt.1.in using the shell's 'read'
and 'echo' built-in commands.

A quick experiment reveals that extra escaping is needed in both cases.
At least with Bash.  I'd be nervous about assuming other shells will
behave exactly the same, even if they claim POSIX-conformance.

$ cat > infile
foo\\bar
foo\"bar
$ while read line; do echo "$line"; done < infile
foo\bar
foo"bar

The second line certainly does not remain a *roff comment.

> Also, I see a number of non-escaped hyphens left, if that on purpose
> or an overlook?
> 
> 12:Patches can be applied, un-applied, refreshed, etc.
> 42:sub-directory of the source tree (see EXAMPLE OF WORKING TREE below).
> 52:directory may contain sub-directories.
> 64:directory; patches may be in sub-directories below this directory.
> 104:patches sub-directory is a convenient location.
> 106:The .pc directory and its sub-directories cannot be relocated, but it
> 133:The exit status is 0 if the sub-command was successfully executed, and
> 282:Used in 'quilt diff' to color the 15-asterisk sequence before or after a

All of the above are idiomatic English prose hyphens, and so do not need
to be escaped.  On output devices that have a separate hyphen character
(like PostScript and PDF), they'll get one.

groff 1.23 will have documentation of why, exactly, *roff systems
distinguish '-' and '\-'.

https://git.savannah.gnu.org/cgit/groff.git/tree/man/groff_char.7.man#n1873

> 247:following syntax - colon (:) separated list of elements, each
> being of

The foregoing should probably be an em dash.  In *roff you can obtain it
with the special character escape sequence '\(em'.  My understanding of
good English style would also not put spaces around it.

> Other than that, looks good, no objection.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]