auctex-devel
[Top][All Lists]
Advanced

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

Re: Output to directory patch


From: Al Haji-Ali
Subject: Re: Output to directory patch
Date: Wed, 24 Feb 2021 13:32:50 +0000
User-agent: mu4e 1.5.8; emacs 27.1

Hello Ikumi,

> I understand your aim, but my concern here are reliability and
> robustness of `TeX-master-file' and `TeX-region-file'. They are at the
> central part of AUCTeX, so it's difficult to incorporate changes which
> have possibility to make them unstable. I think that AUCTeX should only
> accept modification of `TeX-{master,region}-file' which are proved to be
> robust.
I completely agree with you on this point. Robustness of these methods should 
be the top priority. I am hoping that even with my changes such robustness can 
be achieved (although I understand your hesitation given my track record with 
bugs so far :) ).

> I don't understand your points well. It seems to me that it's almost
> enough to make `TeX-get-command-filename' supply 'TeX-output-dir', if
> non-nil, in the suitable position of the return value when `extension'
> is one of the output extensions. In that way, we won't need either
> (1) introducing `TeX-command-file-function' variable
> (2) extending `TeX-save-document' to accept function as its argument
> (Well, maybe even calling `TeX-active-master' is unnecessary.)
> What am I missing?
Hmmm.. I am probably missing something.

Let me try to explain what my concern is.
The function `TeX-get-command-filename` is currently called from
TeX-command-default
TeX-run-TeX
TeX-run-index
TeX-save-document

TeX-get-command-filename takes a "name" (which is passed through from the 
"file" or "name" arguments that these functions accept) and which, without my 
modifications, is just the name of a tex file.

First for TeX-run-TeX and TeX-run-index which are called from TeX-command, the 
name of the tex file could be the result of either TeX-master-file or 
TeX-region-file or any other file-fn that an AUCTeX user might have called 
TeX-command with. Note that only TeX-master should have the output directory 
functionality (this is done by TeX-master-file having the necessary 
modifications but not TeX-region-file).
If the only valid values of file-fn in TeX-command are TeX-master-file or 
TeX-region-file, then my "solution" is unnecessary in this case and I can 
inspect TeX-current-process-region-p to figure out the source. But I hasten to 
add that this should be reflected in the documentation of TeX-command and there 
should be an error when the argument is different from these two values (I am 
also then unsure why passing the filename down the call stack of these function 
is needed at all instead of calling TeX-active-master to get the name).

For TeX-command-default, it is called from TeX-command-query which is called 
with `name` equal to either the output of TeX-master-file or TeX-region-file. 
Hence, inside these function, there is no way of knowing what the source of 
"name" is (beside direct string comparison) even if these two are the only 
valid values since TeX-current-process-region-p is not set at the time of the 
call. Additionally, an AUCTeX user could technically call TeX-command-default 
with a "name" that is not output of TeX-master-file or TeX-region-file (The 
function/documentation do not prohibit this).

TeX-save-document is called in TeX-command-default and shares its problems.

As I said, I could compare the output of TeX-master-file or TeX-region-file to 
"name" to figure out which function was called, but this struck me as an even 
uglier solution than the current one.

>
> I think that the proposed implementation for `TeX-save-document' and
> codes involving `TeX-command-file-function' are not easy to read, and am
> afraid that they could become obstacles for maintainability.
I agree with the solution being ugly/hard to read. It's not what I would have 
preferred.
I just wanted to propose a possible way that would not change the interfaces of 
any functions.
If it is agreed that I can make certain changes to the function interfaces or 
if there is somehow a better solution, then I am happy to make the necessary 
changes.


As promised, here is the new patch (against 72e645f15df) with all the fixes.

https://raw.githubusercontent.com/haji-ali/auctex/tex-build-only/etc/auctex-output-dir.patch

- I no longer include the changes to allow TeX-region to be a subdirectory. I 
think I figured out how to fix it and might take another crack at it at some 
point. But I want to finalize the implementation of TeX-output-dir first.
- I tested TeX preview on the main document and on sub- (/input'ed) files. I 
also of course tested the based TeX commands.
- I did not change the region functionality, but I tested it with this new 
patch and it seems to be working as expected.

Best regards,
-- Al



reply via email to

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