Hi Al, >>>>> Al Haji-Ali <[email protected]> writes: > On 07/03/2021, Ikumi Keita wrote: >> Obviously the remaining cross dependency between `TeX-master-file' and >> `TeX-master-output-dir' is the origin of these troubles. I recommend to >> restrict call on `TeX-master-output-dir' in `TeX-master-file' within >> cases that the extension matches output files. > The inter-dependency between `TeX-master-output-dir' and > `TeX-master-file` is not real, as you previously pointed out.
The cross dependency I talk about here is an implicit one through `find-file-hook'. `TeX-master-file' calls `TeX-master-output-dir', which calls `find-file-noselect', which in turn calls `find-file-hook'. AUCTeX has the following code at the last of `VirTeX-common-initialization'. ,---- | (add-hook 'find-file-hook | (lambda () | ;; Check if we are looking at a new or shared file. | (when (or (not (file-exists-p (buffer-file-name))) | (eq TeX-master 'shared)) | (TeX-master-file nil nil t)) | (TeX-update-style t)) nil t)) `---- I suppose that you observed emacs asked the master file name when opening compressed tex files. That inquiry was caused by this `TeX-master-file' in the above `find-file-hook'. I realized that it isn't precise to say that is the "origin" of the troubles, nevertheless the dependency exists for sure. >> Or it would be much nice if it is possible to remove the cross >> dependency completely. Isn't it possible to implement >> `TeX-master-output-dir' without calling `TeX-master-file' at all? > The reason `TeX-master-output-dir' needs the name of master file (and > the buffer of the master file) is because the value of TeX-output-dir > should be obtained from that file and not from other sub-files. How about stopping trying to obtain the value of `TeX-output-dir' from master file? The purpose of my report 2[1] is to draw attention to the existence of cross dependency (and to suggest to work on eliminating it), and not to recommend to identify the proper value of `TeX-output-dir'. In my point of view, - it is the user's responsibility to make sure that the main and sub files share the common value of `TeX-output-dir' and - it's OK that your patch has some troubles such as ending up with error when the value of `TeX-output-dir' isn't coherent over the main and sub files (unless it causes serious problem such as deleting tex files or killing emacs session, of course). [1] https://lists.gnu.org/r/auctex-devel/2021-02/msg00046.html > Please find a patch to the `tex-build-only` branch attached. If you > think the changes are reasonable, I will push them to my local repo so > that Tassilo can pull them. I confirmed that the updated patch doesn't have the problem I reported in my last message, but I can't yet be sure whether other subtle implicit cross dependency problem still remains and emerges under unexpected circumstance or not... >>> 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. >> >> Agreed. The current (unmodified) implementation is ugly, IMHO. >> > I am happy to change it to a comparison based on the `file-fn` > argument instead, if there's no better solution. That's fine with me. Please go ahead. I expect other maintainers won't oppose to it. > In any case, if changing environment variables in AUCTeX is not > desirable, Changing environment varible itself is fine, but it seems that there is no end if you deal with such small incompatibilities one by one. > then maybe we can just mention in the eventual documentation of > TeX-output-dir that adding the output directory to `TEXINPUTS` and > `BIBINPUTS` might be needed in some cases (I personally do this in my > private configuration). Looks reasonable. Regards, Ikumi Keita
