On 28/02/2021, Ikumi Keita wrote: > > My other concern is that error parsing of AUCTeX. Please test whether it > is affected or not when _region_.tex is placed in sub directory. > Just tested it for region and for the master file. Seems to work as expected.
>> Regarding your proposed solution of splicing the output-directory in >> the correct location in the `name` variable which contains the path of >> the tex file. While certainly doable, it seems to me that keeping all >> path splicing in one place (i.e., in the case of my implementation, in >> TeX-master-file) is the more consistent solution (it is also more >> consistent with the region treatment I mentioned above). > > That's what I suggested before :-) > Ah sorry, I misunderstood your suggestion. > I think you misunderstand the meaning of `name' argument of TeX-command. > It isn't the file name to be processed but rather "LaTeX", "View", > "Print" etc. > Yes, you are right. In any case, I think those functions that I mentioned above should have access to the file-fn. I just pushed a new version of the patch to my public repo (rebased to master) https://github.com/haji-ali/auctex Tasillo, I would be grateful if you can pull those changes when you get a chance. Here are the changes: 1. Cleaning files now works for both master file and region with and without an output directory. Thank you Ikumi for noticing this mistake. 2. The _region_.tex and all output files along with all preview files (from both master and _region_.tex) are now placed in TeX-output-dir when non-nil. 3. I undid my previous implementation which relied on the variable `TeX-command-file-function`. Instead, I made TeX-save-document, TeX-command-query and TeX-command-default accept the variable `name-or-file-fn` instead of `name`. When the argument is a string it is treated as the filename (this is the old behaviour, so the new implementation should be backward compatible for users who directly use these functions). Otherwise the argument is assumed to be TeX-master-file or TeX-region-file. This functionality is facilitated through the new function `TeX--concat-ext`. I also accordingly made all calls to TeX-save-document, TeX-command-query and TeX-command-default in AUCTeX pass the correct file-fn rather than the filename. I am happy to change the implementation if others disagree with it, but I thought it is reasonable. BTW, I added a note in `TeX-command-default` where the filename `name` is compared to the output of `TeX-region-file` to determine if the file comes from TeX-region-file or TeX-master-file. This is another reason why I believe passing file-fn to TeX-command-default is more appropriate. Finally, another point I want to discuss are the latex packages that output files in the output directory but assume that it is in the master directory instead (For example, Uwe noticed that biblatex does this when bibtex is used as a backend. Another package is of course filecontents). I propose that we deal with this situation the same way TeXLive's latexmk does: by setting the two environment variables TEXINPUTS and BIBINPUTS to include the output directory when non-nil. What do you think? Best regards, -- Al
