unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#51054: 29.0.50; [PATCH] Improve finding of external documents
@ 2021-10-06  7:26 Arash Esbati
  2021-10-06  9:14 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Arash Esbati @ 2021-10-06  7:26 UTC (permalink / raw)
  To: 51054; +Cc: Tassilo Horn

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Hi all,

attached is a small patch improving RefTeX finding external documents
for referencing.

Best, Arash

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improve-finding-external-documents.patch --]
[-- Type: text/x-patch, Size: 1668 bytes --]

From 84c5ef108e74ad1e377fcdb43823c4104630b09f Mon Sep 17 00:00:00 2001
From: Arash Esbati <arash@gnu.org>
Date: Tue, 5 Oct 2021 16:35:30 +0200
Subject: [PATCH] Improve finding external documents

* 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.
---
 lisp/textmodes/reftex-parse.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index c521a07f19..b8c75cb21b 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -345,7 +345,17 @@ reftex-parse-from-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))
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#51054: 29.0.50; [PATCH] Improve finding of external documents
  2021-10-06  7:26 bug#51054: 29.0.50; [PATCH] Improve finding of external documents Arash Esbati
@ 2021-10-06  9:14 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-06  9:14 UTC (permalink / raw)
  To: Arash Esbati; +Cc: 51054, Tassilo Horn

Arash Esbati <arash@gnu.org> writes:

> attached is a small patch improving RefTeX finding external documents
> for referencing.

Thanks; applied to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-06  9:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06  7:26 bug#51054: 29.0.50; [PATCH] Improve finding of external documents Arash Esbati
2021-10-06  9:14 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).