emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/auctex def20e7 05/57: Make AUCTeX and RefTeX aware of f


From: Tassilo Horn
Subject: [elpa] externals/auctex def20e7 05/57: Make AUCTeX and RefTeX aware of file loading macro \subfile
Date: Wed, 11 Jan 2017 18:01:37 +0000 (UTC)

branch: externals/auctex
commit def20e774e6d3f9f9d3ca24e2e17a8c126d8137c
Author: Uwe Brauer <address@hidden>
Commit: Arash Esbati <address@hidden>

    Make AUCTeX and RefTeX aware of file loading macro \subfile
    
    * style/subfiles.el ("subfiles"): Make subfile macro be recognized
    as a paragraph command.  For AUCTeX, add argument of subfile to
    `TeX-auto-file'.  For RefTeX, append subfile to
    `reftex-include-file-commands' and run `reftex-compile-variables'
    only once.  Code rearrangement.
---
 style/subfiles.el |   41 +++++++++++++++++++++++++++++++----------
 1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/style/subfiles.el b/style/subfiles.el
index 604e4f9..44f897a 100644
--- a/style/subfiles.el
+++ b/style/subfiles.el
@@ -24,7 +24,7 @@
 ;; 02110-1301, USA.
 
 ;; Acknowledgements
-;; Mosè Giordano  <address@hidden>
+;; Mosè Giordano <address@hidden>
 ;; Arash Esbati <address@hidden>
 
 ;;; Commentary:
@@ -39,18 +39,39 @@
 (TeX-add-style-hook
  "subfiles"
  (lambda ()
-   ;; The following code will fontify `\subfile{}' like  include.
-   (when (and (featurep 'font-latex)
-              (eq TeX-install-font-lock 'font-latex-setup))
-     (font-latex-add-keywords '(("subfile" "{"))
-                              'reference))
-   ;; The following code will run `TeX-run-style-hooks' on the subfile master 
file.
-   ;; Thanks to Mosè Giordano <address@hidden> for presenting a better 
solution using `assoc'.
+
+   ;; The following code will run `TeX-run-style-hooks' on the subfile
+   ;; master file.  Thanks to Mosè Giordano <address@hidden> for
+   ;; presenting a better solution using `assoc'.
    (TeX-run-style-hooks
     (file-name-base (cadr (assoc "subfiles" LaTeX-provided-class-options))))
+
    (TeX-add-symbols
-    '("subfile" TeX-arg-file)))
- LaTeX-dialect)
+    '("subfile" TeX-arg-file))
+
+   ;; Ensure that \subfile stays in one line
+   (LaTeX-paragraph-commands-add-locally "subfile")
 
+   ;; Tell AUCTeX that \subfile loads a file.  regexp is the same as
+   ;; for \input or \include.  This will run `TeX-run-style-hooks' on
+   ;; subfile(s) when master file is loaded.
+   (TeX-auto-add-regexp
+    `(,(concat
+       "\\\\subfile"
+       "{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}")
+      1 TeX-auto-file))
+
+   ;; Tell RefTeX the same thing.
+   (when (and (boundp 'reftex-include-file-commands)
+             (not (member "subfile" reftex-include-file-commands)))
+     (add-to-list 'reftex-include-file-commands "subfile" t)
+     (reftex-compile-variables))
+
+   ;; The following code will fontify `\subfile{}' like \input.
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("subfile" "{"))
+                             'reference)))
+ LaTeX-dialect)
 
 ;;; subfiles.el ends here



reply via email to

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