瀏覽代碼

Copy all font-lock properties in org-src, not just face

* lisp/org-src (org-src-font-lock-fontify-block): Loop over
  `font-lock-extra-managed-props', thus copying other properties that
  might be applied using font-lock.  An example is composition, applied
  by `prettify-symbols-mode'.
Clément Pit--Claudel 8 年之前
父節點
當前提交
4b9a634774
共有 1 個文件被更改,包括 8 次插入5 次删除
  1. 8 5
      lisp/org-src.el

+ 8 - 5
lisp/org-src.el

@@ -503,11 +503,14 @@ as `org-src-fontify-natively' is non-nil."
 	  (unless (eq major-mode lang-mode) (funcall lang-mode))
 	  (org-font-lock-ensure)
 	  (let ((pos (point-min)) next)
-	    (while (setq next (next-single-property-change pos 'face))
-	      (let ((new-face (get-text-property pos 'face)))
-		(put-text-property
-		 (+ start (1- pos)) (1- (+ start next)) 'face new-face
-		 org-buffer))
+	    (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))
+		(let ((new-prop (get-text-property pos prop)))
+		  (put-text-property
+		   (+ start (1- pos)) (1- (+ start next)) prop new-prop
+		   org-buffer)))
 	      (setq pos next))))
 	;; Add Org faces.
 	(let ((face-name (intern (format "org-block-%s" lang))))