[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 46c1a5a5: Add filename as a prefix to catchfilebetweentags counte
From: |
Arash Esbati |
Subject: |
master 46c1a5a5: Add filename as a prefix to catchfilebetweentags counter |
Date: |
Mon, 19 Dec 2022 14:23:41 -0500 (EST) |
branch: master
commit 46c1a5a592e702babfc7f32458dc5cc8f802f3ae
Author: Uwe Brauer <oub@mat.ucm.es>
Commit: Arash Esbati <arash@gnu.org>
Add filename as a prefix to catchfilebetweentags counter
* style/catchfilebetweentags.el (LaTeX-env-catchfilebetweentags):
Add filename as a prefix to the counter.
---
style/catchfilebetweentags.el | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/style/catchfilebetweentags.el b/style/catchfilebetweentags.el
index 27c67e23..6354f15f 100644
--- a/style/catchfilebetweentags.el
+++ b/style/catchfilebetweentags.el
@@ -51,7 +51,7 @@
(setq LaTeX-catchfilebetweentags-counter 0)
(save-excursion
(goto-char (point-min))
- (while (re-search-forward (concat "^%<\\*\\([^>]+\\)>$")
+ (while (re-search-forward "^%<\\*[^:]*:\\([^>]+\\)>$"
(point-max) t)
(let ((fn (string-to-number (match-string 1))))
(when (> fn LaTeX-catchfilebetweentags-counter)
@@ -62,11 +62,18 @@
(defun LaTeX-env-catchfilebetweentags (_environment)
"Insert a tag-skeleton defined by `LaTeX-catchfilebetweentags'.
ENVIRONMENT is ignored."
- (let* ((fn (when LaTeX-catchfilebetweentags-use-numeric-label
+ ;; The following code, adds the file name as a prefix to the tag, in
+ ;; a similar way reftex does this, which is useful for combining
+ ;; several external files to a singular one.
+ (let* ((file (file-name-sans-extension
+ (file-name-nondirectory
+ (buffer-file-name (current-buffer)))))
+ (fn (when LaTeX-catchfilebetweentags-use-numeric-label
(LaTeX-catchfilebetweentags-counter-inc)))
- (tag (TeX-read-string
- (if fn (format "Tag (default %s): " fn) "Tag: ")
- nil nil (when fn (number-to-string fn)))))
+ (tag (concat file ":"
+ (TeX-read-string
+ (if fn (format "Tag (default %s): " fn) "Tag: ")
+ nil nil (when fn (number-to-string fn))))))
(unless (bolp)
(newline)
(delete-horizontal-space))
@@ -85,7 +92,6 @@ ENVIRONMENT is ignored."
[TeX-arg-input-file "File" t] "Tag")
'("ExecuteMetaData*"
[TeX-arg-input-file "File" t] "Tag")
-
'("CatchFileBetweenTags"
TeX-arg-define-macro (TeX-arg-input-file "File-name" t) "Tag")
'("CatchFileBetweenTags*"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 46c1a5a5: Add filename as a prefix to catchfilebetweentags counter,
Arash Esbati <=