Hello Ikumi, Thank you again for looking at my patch and giving feedback. I only recently started looking at the AUCTeX source code so there's a lot for me to learn.
On 27/02/2021, Ikumi Keita wrote: >> https://raw.githubusercontent.com/haji-ali/auctex/tex-build-only/etc/auctex-output-dir.patch > > I tried the updated patch. There is still a regression in `TeX-clean', > which I guess existed in earlier version of your patch: > `TeX-clean' includes region files, such as _region_.log and _region_.pdf, > as its targets explicitly so that "C-c C-c Clean" and "C-c C-c Clean > All" can clean the relavant files altogether. However, now C-c C-c Clean > (All) doesn't count region files as its target. > Thanks for catching this. I should have fixed this when I removed the region changes, will do so promptly. I want to take this chance to discuss TeX-region to gather feedback and suggestions. I opted to not have the output files of TeX-region in `TeX-output-dir` for one main reason. I believe that the "_region_.tex" file itself (being an AUCTeX output file that is usually cleaned) should be in a sub-directory for the same reasons that AUCTeX style files (and eventually tex output files) can be in a sub-directory. The output files can then reside in that same sub-directory. For this reason, the solution I think should be implemented is to have the variable `TeX-region` accept a path, for example, "region/_region_" or even "build/_region_". The output files from TeX-region would then reside in the same directory, for example, "region/_region_.pdf" or "build/_region_.pdf". In my experience, making this change is not difficult (in fact I tested it lightly with my patch and it seems to work without any further changes. Only tex-preview'ing a region needs one small change to make it work). Alternatively, I could also instead put both _region_.tex and its output files in TeX-output-dir directly when that variable is non-nil. What do you think? > However, the complication involving `TeX-command-file-function' still > remains. I prefer that they are sorted out. > Agreed. Happy to do this. 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). Hence, here's how I propose this complication can be fixed instead: 1. Update documentation/implementation of TeX-command to enforce file-fn being TeX-region-file or TeX-master-file. I can then inspect `TeX-current-process-region-p` to find the source function so I can call it with the correct extension. 2. Change TeX-command-query, TeX-command-default and TeX-save-document to one of three options: 2a. Make them accept 'file-fn' instead of 'name' 2b. Allow 'name' to have a string as a value or to be set to TeX-master-file or TeX-region-file 2c. Make them accept an optional 'file-fn' in addition to `name` which is the function that was called to get `name` (just like TeX-command accepts both `name` and `file-fn`). I prefer the last option for maximum compatibility and consistency, but any feedback is much appreciated. Best regards, -- Al
