Subject: bug#55511: 13.1.3; TeX-auto-store issues with complex paths

From: Cyril Arnould <[email-masked]>
Date: Wed, 18 May 2022 21:44:52 +0000

As far as I've gathered, TeX-auto-store can be used to automatically
detect any \newcommand{} in files and create an .el file in the auto
directory which adds the commands to the TeX-symbol-list. From there
they can be used for things like auto-completion. I've also seen that if
the command is declared in a separate file but the TeX-master is set, it
will create the .el file in the auto folder of the TeX-master.

When the TeX-master file is parsed on the other hand, any .tex files
added via \input{} or \include{} seem to be added to the list of style
hooks to run. As far as I've seen, this has the effect that the
auto-completion for the \newcommand{} declared in a separate file is
also available in the TeX-master.

The problems start when the \input{} and \include{} commands are more
complex. In the following examples, preamble2.el to preamble5.el are not
run because the files are not found at the paths specified in the
master.el file.:

\input{preamble0}         % This works fine
\input{prea mble1}        % This works fine
\input{../../preamble2}   % This is not added to the TeX-run-style-hooks
                          % list at all
\input{"preamble3"}       % This gets added with quotes escaped,
                          % i.e. "\"preamble2\""
\input{folder/preamble4}  % This gets added as "folder/preamble3"
\input{../preamble5}      % This gets added as "../preamble4"

Another issue is that if several files are included that have the same
name but are in different subfolders, the generated .el files will end
up overwriting each other, so the symbol list of only one of the .tex
files will be available. Granted, this is probably quite the edge case
but it would be nice to solve nonetheless.

Somewhat related to this topic but not really a bug, more of a feature
request: it would be nice if files added via \import{}{} and
\subimport{}{} commands from the import package were added as well when parsing.

Emacs  : GNU Emacs 28.1 (build 2, x86_64-w64-mingw32)
of 2022-04-09
Package: 13.1.3

current state:
==============
(setq
AUCTeX-date "2022-04-16"
window-system 'w32
LaTeX-version "2e"
TeX-style-path '("~/.emacs.d/auctex" "c:/Users/Cyril/AppData/Roaming/.emacs.d/elpa/auctex-13.1.3/style"
                  "c:/Users/Cyril/AppData/Roaming/.emacs.d/auctex/auto" "c:/Users/Cyril/AppData/Roaming/.emacs.d/auctex/style" "auto" "style")
TeX-auto-save t
TeX-parse-self t
TeX-master t
TeX-command-list '(("TeX" "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %(output-dir) %t" TeX-run-TeX nil
                     (plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX")
                    ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX")
                    ("Makeinfo" "makeinfo %(extraopts) %(o-dir) %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output")
                    ("Makeinfo HTML" "makeinfo %(extraopts) %(o-dir) --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output")
                    ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %(output-dir) %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
                    ("ConTeXt" "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
                    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion")
                    ("BibTeX" "bibtex %(O?aux)" TeX-run-BibTeX nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode context-mode) :help
                     "Run BibTeX")
                    ("Biber" "biber %(output-dir) %s" TeX-run-Biber nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Run Biber")
                    ("Texindex" "texindex %s.??" TeX-run-command nil (texinfo-mode) :help "Run Texindex")
                    ("Texi2dvi" "%(PDF)texi2dvi %t" TeX-run-command nil (texinfo-mode) :help "Run Texi2dvi or Texi2pdf")
                    ("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file")
                    ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command)
                    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Generate PostScript file")
                    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Convert DVI file to PostScript")
                    ("Dvipdfmx" "dvipdfmx -o %(O?pdf) %d" TeX-run-dvipdfmx nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Convert DVI file to PDF with dvipdfmx")
                    ("Ps2pdf" "ps2pdf %f %(O?pdf)" TeX-run-ps2pdf nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Convert PostScript file to PDF")
                    ("Glossaries" "makeglossaries %(d-dir) %s" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode)
                     :help "Run makeglossaries to create glossary file")
                    ("Index" "makeindex %(O?idx)" TeX-run-index nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Run makeindex to create index file")
                    ("upMendex" "upmendex %(O?idx)" TeX-run-index t (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Run upmendex to create index file")
                    ("Xindy" "texindy %s" TeX-run-command nil (plain-tex-mode latex-mode doctex-mode ams-tex-mode texinfo-mode) :help
                     "Run xindy to create index file")
                    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness")
                    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for common mistakes")
                    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document")
                    ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files")
                    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files")
                    ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))
)