emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#25674: closed (Support for subfiles in `reftex-TeX


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#25674: closed (Support for subfiles in `reftex-TeX-master-file')
Date: Mon, 13 Feb 2017 18:28:01 +0000

Your message dated Mon, 13 Feb 2017 19:27:21 +0100
with message-id <address@hidden>
and subject line Re: bug#25674: Support for subfiles in `reftex-TeX-master-file'
has caused the debbugs.gnu.org bug report #25674,
regarding Support for subfiles in `reftex-TeX-master-file'
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
25674: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25674
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Support for subfiles in `reftex-TeX-master-file' Date: Fri, 10 Feb 2017 09:48:43 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2
Hi all,

the function `reftex-TeX-master-file' in `reftex.el' has support for
subfiles package, but I think the regexp there does not match all
cases.  Please consider a main file "subfile-main.tex" and a sub-file
"subfile-sub1.tex" like these:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{subfiles}
\begin{document}

\section{Section 1}
\label{sec:section-1}

\subfile{subfile-sub1.tex}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
\documentclass[subfile-main.tex]{subfiles}
\begin{document}

\section{Subsection 1}
\label{sec:subsection-1}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
--8<---------------cut here---------------end--------------->8---

`reftex-TeX-master-file' fails to parse the first line and find out the
main file due to first part of it:

--8<---------------cut here---------------start------------->8---
(defun reftex-TeX-master-file ()
  ;; Return the name of the master file associated with the current buffer.
  ;; When AUCTeX is loaded, we will use it's more sophisticated method.
  ;; We also support the default TeX and LaTeX modes by checking for a
  ;; variable tex-main-file.
  (let
      ((master
        (cond
         ;; Test if we're in a subfile using the subfiles document
         ;; class, e.g., \documentclass[main.tex]{subfiles}.  It's
         ;; argument is the main file, however it's not really the
         ;; master file in `TeX-master-file' or `tex-main-file's
         ;; sense.  It should be used for references but not for
         ;; compilation, thus subfiles use a setting of
         ;; `TeX-master'/`tex-main-file' being themselves.
         ((save-excursion
            (goto-char (point-min))
            (re-search-forward
             "^[[:space:]]*\\\\documentclass\\[\\([[:word:].]+\\)\\]{subfiles}"
             nil t))
          (match-string-no-properties 1))
--8<---------------cut here---------------end--------------->8---

The regexp looks for [:word:] character class and ignores anything
else.  Using `-', `_' or digits in main file name will not work.  I
think the regexp can be reduced to

--8<---------------cut here---------------start------------->8---
            (re-search-forward
             "^[[:space:]]*\\\\documentclass\\[\\([^]]+\\)\\]{subfiles}"
             nil t))
--8<---------------cut here---------------end--------------->8---

as `reftex-TeX-master-file' checks if .tex extension is given or not.
With this change, one can use `C-c )' over all files in a project and
`C-c C-c' compiles a only subfile when issued in it.

Any comments?  I would prepare a patch after confirmation here.

Best, Arash



--- End Message ---
--- Begin Message --- Subject: Re: bug#25674: Support for subfiles in `reftex-TeX-master-file' Date: Mon, 13 Feb 2017 19:27:21 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2
Tassilo Horn <address@hidden> writes:

> Arash Esbati <address@hidden> writes:
>
>> @Tassilo: Can please apply this patch to Emacs master?  TIA.
>
> Done!

Thanks, I close this one then.

Best, Arash


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]