> Hm this is what Tassilo told me, well a couple of years ago, so maybe this 
> has changed.



   -> git am --patch-format=hg catchfilebetweentags-filename.patch


> that is strange,



> Ok,  fortunately I have now a relative recent git
> version install (2.38.1) this should work flawlessly otherwise I have to
> file a but to the hg maintainers. I will test it myself, not sure how
> git works whether I have later to strip or to stash the applied patch.
> Anyway I figure out, if not I follow this great advice 😉

 
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 

* 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
|
* commit 288665587a4fcb6b7fc356e86a86ee9670186232 (remotes/svannah/HEAD) 
(svannah/master, svannah/HEAD)
| Author: Ikumi Keita <[email protected]>
|
|     Use `symbol-value' instead of `eval'
|
* commit 3806176ba2fa11cc990e49792f9db34532c85258 (remotes/svannah/HEAD~1)
| Author: Ikumi Keita <[email protected]>
|
|     Fix argument description in doc strings
|
* commit 22fa670915fb1fb6a08b60c7bb5acfb79684dd55 (remotes/svannah/HEAD~2)
| Author: Ikumi Keita <[email protected]>
|
|     ; Fix doc strings
|

I think I should now run 


git reset --hard 8e42d3c5bf7cdf660b

Right?

Uwe 
-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/
# HG changeset patch
# User Uwe Brauer <[email protected]>
# Date 1671209191 -3600
#      Fri Dec 16 17:46:31 2022 +0100
# Node ID 3e71eb49c8465c6ba3c1b83d7fa61d781e670f42
# Parent  8950c20945ef7aca42ad63a2ff3aea83f1788423
Add filename as a prefix to the counter for catchfilebetweentags
* style/catchfilebetweentags.el:
  Add filename as a prefix to the counter for catchfilebetweentags

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 "^%<\\*\\([^>]+\\)>$")
-                                (point-max) t)
+      (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