emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals-release/org 6a558fc 19/22: org: Fix potential modified


From: ELPA Syncer
Subject: [elpa] externals-release/org 6a558fc 19/22: org: Fix potential modified src match-data issue
Date: Mon, 27 Sep 2021 15:57:36 -0400 (EDT)

branch: externals-release/org
commit 6a558fc17b42911b6d01e43fcd42754345970a60
Author: TEC <tec@tecosaur.com>
Commit: TEC <tec@tecosaur.com>

    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 be7ddcd..ae0e84c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5289,7 +5289,8 @@ by a #."
            (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]