On Sun Feb 23, 2025 at 1:50 PM CET, Dave Kemper wrote:
> On Sat, Feb 22, 2025 at 7:29 PM onf <o...@disroot.org> wrote:
> > I won't mind too much if this change ends up in groff as it's
> > currently being proposed. I would just find it unfortunate, because
> > I am pretty sure neatroff won't adopt it as it currently stands.
>
> I'm in favor of cross-roff compatibility whenever possible.  But
> notably, for this particular change, any roff file modified to work
> with the new restriction groff imposes will still work with another
> roff.  So it's breaking *backwards* compatibility (with all roffs) but
> not cross-compatibility: Having no space between the filename and the
> comment symbol has always been legal syntax in any roff.

Yes, this is a more accurate description. With that said, the stripping
of a leading quote is breaking cross-compatibility. Not that filenames
beginning with a quote are common.

> Concerning neatroff specifically:
>  - Does it support specifying a file with spaces in its name?

It does support it for requests of its own invention (co<, co>), which
use the same approach as Branden suggested -- that is, the same as ds.

For all the other requests which use filenames (hpf, hpfa, lf -- am I
mistaken, or did we forget about lf? --, nx, so), it treats spaces as
an argument separator.

>  - If not, and if it wanted to add such support, what syntax would it
> use for this that would maintain the strict back compatibility it
> strives for?
>
> That is, do you have a counterproposal for a syntax that neatroff
> either accepts or would be willing to?

First off, I need to emphasize that only Ali has control over which
direction neatroff takes and what gets into its master. I have not
talked with him about this matter yet because communication with him
tends to be quite slow.

With that said, I have been working on neatroff's source code for a
while now (although most of it has yet to be upstreamed), and I have
had the opportunity to discuss some of my changes with Ali, so I feel
like I have some feel for what changes he is and isn't comfortable
making to neatroff.

I will reach out to him so that you can get a more authoritative
response on the matter.

Anyway, as I said, I expect that he wouldn't want to break backwards
compatibility. Also, parsing arguments differently depending on
whether compatibility mode is enabled would be messy in neatroff,
so I doubt he would like that part either.

I think parsing the arguments to the aforementioned "old style"
requests so that they skip any leading spaces, treat the rest
of the line as an argument, and then trim any trailing spaces,
would not break any existing usage, and it wouldn't be that
hard to implement. (Obviously, lf would first parse its first
argument as usual.)

To give an example,
  .so   foo bar  baz \" comment

would be interpreted as loading the file 'foo bar  baz'
(without the quotes).

I just tried making the necessary changes, and...
  $ echo '.ab done \" ok' > 'foo bar  baz'
  $ ./roff -F.. << EOF >/dev/null
  .so   foo bar  baz \" comment
  EOF
  done
  $ git diff --stat
  1 file changed, 8 insertions(+), 5 deletions(-)

Seems simple enough, although it doesn't handle lf yet.

~ onf

Reply via email to