瀏覽代碼

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 <ciolfi@mathworks.com>
<r9r1ulpctz.fsf@ah-ciolfi-lah-ciolfi-l.dhcp.mathworks.com>
Kyle Meyer 5 年之前
父節點
當前提交
ba6ca79af5
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      lisp/org.el

+ 1 - 1
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