Browse Source

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/
Ihor Radchenko 2 years ago
parent
commit
03543e17dd
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lisp/org-src.el

+ 6 - 1
lisp/org-src.el

@@ -642,7 +642,12 @@ as `org-src-fontify-natively' is non-nil."
 	    (while (setq next (next-property-change pos))
 	      ;; Handle additional properties from font-lock, so as to
 	      ;; preserve, e.g., composition.
-	      (dolist (prop (cons 'face font-lock-extra-managed-props))
+              ;; FIXME: We copy 'font-lock-face property explicitly because
+              ;; `font-lock-mode' is not enabled in the buffers starting from
+              ;; space and the remapping between 'font-lock-face and 'face
+              ;; text properties may thus not be set.  See commit
+              ;; 453d634bc.
+	      (dolist (prop (append '(font-lock-face face) font-lock-extra-managed-props))
 		(let ((new-prop (get-text-property pos prop)))
                   (when new-prop
 		    (put-text-property