]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve finding external documents in reftext
authorArash Esbati <arash@gnu.org>
Wed, 6 Oct 2021 09:14:45 +0000 (11:14 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 6 Oct 2021 09:14:45 +0000 (11:14 +0200)
* lisp/textmodes/reftex-parse.el (reftex-parse-from-file): Extend
regexp in order to support \externalcitedocument macro and a
second optional argument provided by LaTeX package xr-hyper
(bug#51054).

lisp/textmodes/reftex-parse.el

index c521a07f19287e33795b464b27529ff967029805..b8c75cb21b65876ec5f0a3cf83a05fc029d12bc5 100644 (file)
@@ -345,7 +345,17 @@ of master file."
 
              ;; Find external document specifications
              (goto-char 1)
-             (while (re-search-forward "[\n\r][ \t]*\\\\externaldocument\\(\\[\\([^]]*\\)\\]\\)?{\\([^}]+\\)}" nil t)
+             (while (re-search-forward
+                     (concat "[\n\r][ \t]*"
+                             ;; Support \externalcitedocument macro
+                             "\\\\external\\(?:cite\\)?document"
+                             ;; The optional prefix
+                             "\\(\\[\\([^]]*\\)\\]\\)?"
+                             ;; The 2nd opt. arg can only be nocite
+                             "\\(?:\\[nocite\\]\\)?"
+                             ;; Mandatory file argument
+                             "{\\([^}]+\\)}")
+                     nil t)
                (push (list 'xr-doc (reftex-match-string 2)
                            (reftex-match-string 3))
                      docstruct))