Skip to content

Commit 03543e1

Browse files
committed
org-src-font-lock-fontify-block: Transfer 'font-lock-face property
* lisp/org-src.el (org-src-font-lock-fontify-block): Copy 'font-lock-face text property in addition to 'face. This is required because Emacs does not enable `font-lock-mode' inside buffers with names starting from space character (Org fontification buffers are such). Without `font-lock-mode' 'font-lock-face is not being remapped to 'face text property and we may sometimes lose the information in the major modes that do fontification by directly setting 'font-lock-face. Reported in https://teddit.net/r/orgmode/comments/w2b0tw/syntax_highlighting_in_orgsource_blocks/igqdx18/
1 parent 9917d69 commit 03543e1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lisp/org-src.el

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,12 @@ as `org-src-fontify-natively' is non-nil."
642642
(while (setq next (next-property-change pos))
643643
;; Handle additional properties from font-lock, so as to
644644
;; preserve, e.g., composition.
645-
(dolist (prop (cons 'face font-lock-extra-managed-props))
645+
;; FIXME: We copy 'font-lock-face property explicitly because
646+
;; `font-lock-mode' is not enabled in the buffers starting from
647+
;; space and the remapping between 'font-lock-face and 'face
648+
;; text properties may thus not be set. See commit
649+
;; 453d634bc.
650+
(dolist (prop (append '(font-lock-face face) font-lock-extra-managed-props))
646651
(let ((new-prop (get-text-property pos prop)))
647652
(when new-prop
648653
(put-text-property

0 commit comments

Comments
 (0)