From ba6ca79af5722e0ff4a9eb34611fa5ef0a0ca1fa Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 13 Jun 2020 15:17:58 -0400 Subject: [PATCH] org.el: Fix #+end_src fontification error * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Rewrite the "line begins with *" check so that it does not assume that match data has remained intact. The upstream call to org-src-font-lock-fontify-block overwrites the match data in some cases. As a result, (match-string 1) signals an error and #+end_src is not fontified. Wrapping the call to org-src-font-lock-fontify-block with save-match-data would fix the reported issue. However, the position at the beginning of the line is already stored in a variable, so use that information instead to check whether the line starts with "*". Reported-by: John Ciolfi --- lisp/org.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index f8d867549..c03aa0c49 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5317,7 +5317,7 @@ by a #." (add-text-properties beg (if whole-blockline bol-after-beginline end-of-beginline) '(face org-block-begin-line)) - (unless (string-prefix-p "*" (match-string 1)) + (unless (eq (char-after beg-of-endline) ?*) (add-text-properties beg-of-endline (if whole-blockline