Hi  Bastien,

> Okay - can you post the patch in this thread?

Ahh, I forgot to attach it didn’t I. You should find it attached to this 
message.

> After you send it here, you can push to bugfix and merge the bugfix
> branch into main.

I’ll do exactly this shortly.

> You can also add the X-Woof-Patch: applied header to your reply.

I fully intend to 😀. In fact, I’ve recently made this much easier for myself
(<https://tecosaur.github.io/emacs-config/config.html#adding-x-woof>).
In case this is of interest:
<file:~/Desktop/xwoof-tool.png>

All the best,
Timothy
>From 0c3571097bda58d1ef0fd0554322a42ff7068a67 Mon Sep 17 00:00:00 2001
From: TEC <t...@tecosaur.com>
Date: Fri, 17 Sep 2021 17:23:58 +0800
Subject: [PATCH 1/6] org: Fix potential modified src match-data issue

* lisp/org.el (org-fontify-meta-lines-and-blocks-1): When this is run on
a src block, a "leaky" major mode called in
`org-src-font-lock-fontify-block' can modify the match data.
This is problematic, as the match data already set is important for
font-lock.  To protect ourselves from this behaviour, we can wrap
`org-src-font-lock-fontify-block' in `save-match-data' to ensure that
the match data for the src block is conserved.
---
 lisp/org.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 733dda429..64f82b5ee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5330,7 +5330,8 @@ (defun org-fontify-meta-lines-and-blocks-1 (limit)
 	    (org-remove-flyspell-overlays-in nl-before-endline end-of-endline)
 	    (cond
 	     ((and lang (not (string= lang "")) org-src-fontify-natively)
-	      (org-src-font-lock-fontify-block lang block-start block-end)
+	      (save-match-data
+                (org-src-font-lock-fontify-block lang block-start block-end))
 	      (add-text-properties bol-after-beginline block-end '(src-block t)))
 	     (quoting
 	      (add-text-properties
-- 
2.33.0

Reply via email to