[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-devel] Unstable behavior in subfile in subdirectory
From: |
Ikumi Keita |
Subject: |
[AUCTeX-devel] Unstable behavior in subfile in subdirectory |
Date: |
Tue, 06 Nov 2018 21:34:37 +0900 |
[ I'm sorry if you have recieved this message multiple times. Resending
this message again (with some mistakes corrected and patch turned into
attachment rather than part of the body test) since it seems that the
previous ones were probably marked as spam and not delivered. ]
Hi all,
I found that preview-latex does not work well in subfile not located in
master directory, and propose a fix later in this message. I'd
appreciate if you could give it a try. Any feedbacks are welcome.
[How to confirm]
1. Extract the attached tar file prvbug.tar.gz under /tmp.
The file layout will be:
dir-+-parent.dvi
+-main------+-parent.tex
+-sub--------child.tex
The presense and location of parent.dvi is obviously odd. The reason
will be revealed later. Actually parent.dvi is just an empty file.
2. Be sure to set `TeX-parse-self' to t and open the child.tex by AUCTeX
with preview-latex enabled.
3. Type C-c C-p C-b and answer "y" to `Cache preamble?' question.
4. Then math formula will be displayed as an image as usual. However,
typing C-c C-l does not open the process output buffer and a message
`No process for this document.' is displayed in echo area.
At this time, two process output buffers have been created actually:
*/tmp/dir/main/sub/parent output*
*/tmp/dir/main/sub/_region_ output*
Note that the paths in the two buffer names have spurious "sub/".
C-c C-c RET and C-c C-b RET generate the buffers of similar names
with correct paths. ("sub/" is stripped off.)
5. Next type C-c C-p C-d in "child.tex" buffer. Then the image is
removed and the "Do not enter" sign appears to the left of the math
formula to indicate error. Typing C-c C-l again results in `No
process for this document.' message in echo area.
6. Then type C-c C-t C-p to turn off TeX-PDF-mode and type C-c C-p C-d
again. This time, the expected image appears on the math formula.
Though C-c C-l is still useless, the buffer "*...parent ...*"
records normal activity of relavant tools including pdflatex and
dvips.
However, a strange phenomenon has occured outside emacs. The odd
file /tmp/dir/parent.dvi was erased and /tmp/dir/main/parent.dvi,
which should have been deleted during a normal run of preview-latex,
was left behind. In other words, emacs deleted totally irrelavant
file without any confirmation!
7. Quit emacs with C-x C-c and clean the intermediate files and
directories such as parent.log, *.prv. Launch a new emacs session
and open child.tex again.
Then type C-c C-p C-d and answer "n" to `Cache preamble?' this time.
The expected image does not come out and the "Do not enter" sign
appears again. Typing C-c C-l is useless. This shows that caching
is not related essentially in the series of the above strange
behaviors.
[Analysis]
The series of strange behaviors strongly suggests that preview-latex
does not handle relative paths correctly in some aspects.
(1) Comparing preview.el and tex-buf.el closely, I found that the
ways to call `TeX-run-command' have small discrepancy between
them: the former drops the directory part of the third argument FILE
while the latter does not.
(2) Some codes aren't compatible with the fact that
`TeX-master-file' returns relative path like "../main.dvi" by
default when `TeX-command-buffer' is the subfile not in master dir
and `TeX-master' is set to a relative path. The deletion of dvi file
and recognition of generated pdf file is done in the process output
buffer where `default-directory' is master dir, so the relative path
is not suitable. Directory part should be simply stripped off by
giving optional second argument to `TeX-master-file'.
[Propose of fix]
According to the above diagnosis, I created a fix attached at the
last of this message. After applying this change locally, all the
above symptoms disappeared.
I'd appreciate if you could review this patch. Any feedbacks are
welcome.
Best regards,
Ikumi Keita
prvbug.tar.gz
Description: bug test kit
0001-Adjust-preview-latex-in-case-sub-file-isn-t-in-maste.patch.gz
Description: proposed patch
- [AUCTeX-devel] Unstable behavior in subfile in subdirectory,
Ikumi Keita <=