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>
This commit is contained in:
Kyle Meyer 2020-06-13 15:17:58 -04:00
parent 3ebee03310
commit ba6ca79af5
1 changed files with 1 additions and 1 deletions

View File

@ -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