John Ciolfi writes: > Given the following org file, on the #+end_src line, I get "Org mode > fontification error in #<buffer foo.org> at 9". If I place a newline > before the #+end_src line, the error goes away. This is a recent > regression. This worked fine in 9.2.6 and prior. > > #+begin_src C++ > #include <iostream> > int main() { > std::cout << "hello"; > return 0; > } > > // The results: > #+end_src > > #+RESULTS:
Thanks for the report. This bisects to 04d2828ad (org: Fix verbatim block fontification to end blocks on headlines, 2019-12-11). Reverting different parts of that patch, it seems this is the problematic hunk: diff --git a/lisp/org.el b/lisp/org.el index 68ca5839a..14840d8ca 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5320,10 +5320,14 @@ (defun org-fontify-meta-lines-and-blocks-1 (limit) (add-text-properties beg (if whole-blockline bol-after-beginline end-of-beginline) '(face org-block-begin-line)) - (add-text-properties - beg-of-endline - (min (point-max) (if whole-blockline (min (point-max) (1+ end-of-endline)) end-of-endline)) - '(face org-block-end-line)) + (unless (string-prefix-p "*" (match-string 1)) + (add-text-properties + beg-of-endline + (if whole-blockline + (let ((beg-of-next-line (1+ end-of-endline))) + (min (point-max) beg-of-next-line)) + (min (point-max) end-of-endline)) + '(face org-block-end-line))) t)) ((member dc1 '("+title:" "+author:" "+email:" "+date:")) (org-remove-flyspell-overlays-in I'll try to take a closer look tomorrow.