On Mon, Jul 12, 2021 at 2:10 PM Tassilo Horn <[email protected]> wrote: > > Hongyi Zhao <[email protected]> writes: > > > Sorry for my misunderstanding. Really, it can pinpoint the problem: > > > > (delq nil (mapcar (lambda (buf) > > (with-current-buffer buf > > (when (eq major-mode 'latex-mode) > > (cons (buffer-file-name buf) > > (TeX-master-file "pdf"))))) > > (buffer-list))) > > (("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/content/josephson.tex" > > . "josephson.pdf") > > ("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/content/appendix.tex" > > . "../thesis.pdf") > > ("/home/werner/Public/hpc/tools/thesis/gitlab.kwant-project.org/jbweston/thesis.git/thesis.tex" > > . "thesis.pdf")) > > > > As you can see, only the chapter/master files which have been set the > > correct TeX-master variable will report the correct master PDF file. > > So the issue is solved, right?
Yes. Thank you again for your insightful guidance. > >> > Why can't `(La)TeX-mode' return the correct result: > >> > > >> > (delq nil (mapcar (lambda (buf) > >> > (with-current-buffer buf > >> > (when (eq major-mode 'TeX-mode) > >> > (cons (buffer-file-name buf) > >> > (TeX-master-file "pdf"))))) > >> > (buffer-list))) > >> > >> Because the symbols latex-mode and LaTeX-mode or TeX-mode are not `eq' > >> (identical). `major-mode' is just a symbol, and in an AUCTeX LaTeX > >> buffer it'll be set to `latex-mode'. > > > > But see the following statement on > > <https://www.gnu.org/software/emacs/manual/html_node/reftex/Installation.html>: > > > > ``` > > 1.1.3 Entering RefTeX Mode > > > > To turn RefTeX Mode on and off in a particular buffer, use M-x > > reftex-mode RET. To turn on RefTeX Mode for all LaTeX files, add the > > following lines to your .emacs file: > > > > (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode > > (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode > > ``` > > > > It says that the AUCTeX LaTeX mode should be called `LaTeX-mode', > > while the Emacs latex mode is called `latex-mode' > > > > Any hints on this description? > > Yes, the AUCTeX variant of latex-mode shows up as LaTeX in the mode-line > (that's its name), and its hook is `LaTeX-mode-hook'. But still it sets > `latex-mode' as the symbol. The reason is that AUCTeX replaces the > stock tex-mode and latex-mode that comes with emacs rather than defining > new, alternative modes next to the standard ones. Got it. Best, Hongyi
