auctex-devel
[Top][All Lists]
Advanced

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

Re: Output to directory patch


From: Ikumi Keita
Subject: Re: Output to directory patch
Date: Tue, 23 Feb 2021 22:17:06 +0900

Hi Al,

There are other problems with respect to subfile in the current patch.

1. When a subfile is located in subdirectory, region typeset causes
error, even when TeX-output-dir is nil.
---- main.tex --------------------------------------------------------
\documentclass{article}
\begin{document}
main

\input{subdir/subfile}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
----------------------------------------------------------------------
---- subdir/subfile.tex ----------------------------------------------
dummy

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../main"
%%% End:
----------------------------------------------------------------------
Try C-c C-b RET in the buffer of subfile.tex.

2. Suppose that TeX-output-dir is non-nil in the subfile while it is
nil in the main file. This inconsistency can lead to endless loop in
`TeX-master-file'.
---- main.tex --------------------------------------------------------
\documentclass{article}
\begin{document}
main

\input{subfile}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-output-dir: nil
%%% End:
----------------------------------------------------------------------
---- subfile.tex ----------------------------------------------
dummy

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% TeX-output-dir: "build"
%%% End:
----------------------------------------------------------------------
Try C-c C-c in the buffer of subfile.tex.

I don't think it's a good idea to modify `TeX-master-file' and
`TeX-region-file'. Their usage and implementation in AUCTeX have a lot
of subtleness, so modifying them is fragile in general. I can't
guarantee that shortcomings other than the above two don't come out
later.

Hence I'd recommend to make the basic design more similar to Mosè's
approach:
(1) Keep `TeX-master-file' and `TeX-region-file' as-is.
(2) Make a function dedicated to build a path (including the file name)
    for generated files such as .pdf, .dvi, .aux etc.
(3) Use that dedicated function for "%o" and alikes in
    `TeX-expand-list(-builtin)' and everywhere AUCTeX calls
    `TeX-check-path'.
(4) Adjust `TeX-clean' and `TeX-view' to accomodate those changes.

I suppose that (1)-(4) would be almost inevitable to implement reliably
the output-diretory feature. In addtion, they would gain another
advantage of being free of complication discussed below.

>> Also, I wonder whether it can be simplified or not. Is it really
>> necessary to introduce a new variable TeX-command-file-function and
>> tweak the argument of TeX-save-document? It seems that Mosè's approach
>> doesn't need such complexity. Are TeX-active-master function and
>> TeX-current-process-region-p variable deficient for those purposes?
> I agree that introducing the new variable is excessive. However, I was
> trying to conform to the implementation of TeX-save-document which
> accepts the name of the document instead of using TeX-active-master or
> TeX-master-file and the implementation of TeX-command which accepts
> the filename along with a file function. I could certainly instead
> call TeX-active-master instead, but then (at least in theory)
> TeX-command or TeX-save-document might be called with a filename or a
> file-function that is different from TeX-master-file and
> TeX-region-file and their outputs (I thought that was the reason these
> functions accept such arguments) and then my code would break or have
> an unintended behaviour.

Regards,
Ikumi Keita



reply via email to

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