Home GitHub Patreon
Discussions RSS Twitter

Multiline fontification with org-emphasis-alist

By default org mode only fontifies spans of text wrapped in emphasis markers (customized with org-emphasis-alist) if they extend through at most one newline. This is probably a performance optimization, one wholly unnecessary on modern hardware.

As per this stack overflow post I re-set the constant to 10 lines and can probably even increase it if necessary.

(setcar (nthcdr 4 org-emphasis-regexp-components) 10)

Before this starts to work you need to re-save org-emphasis-alist through the customize interface because it is using a custom setter org-set-emph-re to compute the regexpses (or, gulp, restart Emacs).

Here I quote the answer in case it ever gets lost:

By default, org-mode allows a single newline. So if you want to be
able to add markup to text that spans more than two consecutive lines,
you'll need to modify this entry.

    (setcar (nthcdr 4 org-emphasis-regexp-components) N)

... where N is the number of newlines you want to allow.

Published at: 2018-12-23 18:24 Last updated at: 2023-02-08 15:59
Found a typo? Edit on GitHub!