On Wed, Sep 23, 2026 at 06:24:18PM +0100, Gavin Smith wrote:
> On Wed, Sep 23, 2026 at 11:18:34AM +0200, Patrice Dumas wrote:
> I question whether this behaviour is useful:
> 
>      If FILE is a directory or ends with a ‘/’ the usual rules are used
>      to determine the output file name (namely, use ‘@setfilename’ or
>      the input file name) but the files are written to the FILE
>      directory.  For example, ‘texi2any -o bar/ foo.texi’, with or
>      without ‘--no-split’, will write ‘bar/foo.info’, and possibly other
>      files, under ‘bar/’.
> 
> It seems that -o has two different modes, which would be easily confused
> by users.  The one which is the obvious mode is to give the name of the
> output file, or if the output is a directory, to give the name of the output
> directory.  The other mode is to give the directory location if
> the output is a file.  (The rules for EPUB are different again and specific
> to EPUB.)
> 
> Based on the description in the manual, the same invocation of texi2any
> can switch from one mode to another based on what files exist in the
> file system.

Indeed, I agree that this could be very confusing.  However, if the -o
argument ends with a /, the risk of confusion is much less.

> I'd suggest making it an error if the output should be a single file and the
> argument of -o exists and is a directory.

I agree if there is no / in the end, but if there is, it could be
debatable.

> (I'm not sure what -o would do
> with split Info output, but presumably the most obvious behaviour would be
> to use the argument as the stem to which "-1", "-2" suffixes etc. are
> be added.)

It should do that.

> I don't feel this would take away from the flexibility of the program any,
> as the user can easily specify the base file name as part of the -o argument:
> e.g. "texi2any -o dir/base".

I think that it is useful to be able to specify the directory, but leave
out the file name, including the extension, to be automatically
determined by texi2any.  Only if there is a / at the end of the -o
argument, however.  But I do not have a firm  position on that matter,
I also agree that having -o specify either a file name or a directory
when a file name is the end result could be somewhat confusing.

> If the current behaviour is broken or harmful and isn't much used, then
> it would be better to change it now to reduce the chance that somebody
> starts relying on it in the future.

I agree.

> > As a side note, having an (unused) @setfilename consistent with the output
> > directory for emacs manuals is told in a comment in doc/emacs/Makefile.in:
> >  ## Where the output files go.
> >  ## Note that the setfilename command in the .texi files assumes this.
> > I would still suggest using a simpler @setfilename, like
> >   @setfilename emacs-xtra.info
> > in the emacs manuals, mainly for clarity.
> 
> Sorry, I can't follow what you are proposing here.  What makes the 
> @setfilename
> unused, for example?

It is something for the emacs developers, the already use -o, so they
could set @setfilename to the base file name, which is more expected
than what they do.

-- 
Pat

Reply via email to