all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Timothy <tecosaur@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: Yikai Zhao <yikai@z1k.dev>, emacs-orgmode@gnu.org
Subject: Re: Bug: Fontify error with markdown source block [9.4.4 (release_9.4.4 @ /usr/share/emacs/28.0.50/lisp/org/)]
Date: Sun, 26 Sep 2021 18:53:17 +0800	[thread overview]
Message-ID: <87h7e7eh8e.fsf@gmail.com> (raw)
In-Reply-To: <87mtnzbpqm.fsf@gnu.org>

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

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-org-Fix-potential-modified-src-match-data-issue.patch --]
[-- Type: text/x-patch, Size: 1353 bytes --]

From 0c3571097bda58d1ef0fd0554322a42ff7068a67 Mon Sep 17 00:00:00 2001
From: TEC <tec@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	other threads:[~2021-09-26 10:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 17:05 Bug: Fontify error with markdown source block [9.4.4 (release_9.4.4 @ /usr/share/emacs/28.0.50/lisp/org/)] Yikai Zhao
2021-09-17  9:25 ` Timothy
2021-09-22  9:32   ` Timothy
2021-09-26  9:36   ` Bastien
2021-09-26 10:14     ` Timothy
2021-09-26 10:22       ` Bastien
2021-09-26 10:53         ` Timothy [this message]
2021-09-26 11:15           ` Bastien
2022-09-30  4:12           ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7e7eh8e.fsf@gmail.com \
    --to=tecosaur@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=yikai@z1k.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.