>>> "AE" == Arash Esbati <[email protected]> writes:

> Uwe Brauer <[email protected]> writes:
>> Here is what I did (and it worked)
>> 
>> git pull
>> git checkout master (just in case)
>> I generated the patch again (you find it attached below)
>> I run whitespace-cleanup
>> I run
>> 
>> git am --patch-format=hg ../catchfilebetweentags.patch
>> Applying: Add filename as a prefix to the counter for catchfilebetweentags
>> 
>> Git log now gives me 

> Yes, because the patch you've installed is different from what you sent
> in this message:

>   https://lists.gnu.org/archive/html/auctex-devel/2022-12/msg00046.html

>> * commit 8e42d3c5bf7cdf660b9d77b6da6ecf41af4e09f9 (master) (HEAD -> master)
>> | Author: Uwe Brauer <[email protected]>
>> |
>> |     Add filename as a prefix to the counter for catchfilebetweentags
>> |     * style/catchfilebetweentags.el:
>> |       Add filename as a prefix to the counter for catchfilebetweentags
>         ^


I have corrected the regexp (thanks), used the indentation you indicated
and run again the check I described.

I hope it is ok now!


Uwe 

# HG changeset patch
# User Uwe Brauer <[email protected]>
# Date 1671468375 -3600
#      Mon Dec 19 17:46:15 2022 +0100
# Node ID 6f365fe769c2410c9ea83393a670e7cf3b1a00e2
# Parent  2d32ca8c73c5e64d0a6d2a9713e25ac78cc55fac
Add filename as a prefix to the counter for catchfilebetweentags
* style/catchfilebetweentags.el (LaTeX-env-catchfilebetweentags):
Add filename as a prefix to the counter.

diff --git a/style/catchfilebetweentags.el b/style/catchfilebetweentags.el
--- a/style/catchfilebetweentags.el
+++ b/style/catchfilebetweentags.el
@@ -51,22 +51,30 @@
     (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)
             (setq LaTeX-catchfilebetweentags-counter fn))))))
-  (setq LaTeX-catchfilebetweentags-counter
+  (setq LaTeX-catchfilebetweentags-counter
         (1+ LaTeX-catchfilebetweentags-counter)))
 
 (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
+         (tag
+         (concat file ":"
+          (TeX-read-string
                 (if fn (format "Tag (default %s): " fn) "Tag: ")
-                nil nil (when fn (number-to-string fn)))))
+                nil nil (when fn (number-to-string fn))))))
     (unless (bolp)
       (newline)
       (delete-horizontal-space))
@@ -85,7 +93,6 @@
       [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*"

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to