>From 5d39108d319dc321af95e22c6cb25164dd61e891 Mon Sep 17 00:00:00 2001 From: Rasmus Date: Thu, 9 Jun 2016 16:52:05 +0200 Subject: [PATCH] org-src: Allow per language block face * lisp/org-src.el (org-src-font-lock-fontify-block): * lisp/org.el (org-fontify-meta-lines-and-blocks-1): Allow per-block face. --- lisp/org-src.el | 9 ++++++--- lisp/org.el | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 2f96fdf..d8c0541 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -494,7 +494,10 @@ as `org-src-fontify-natively' is non-nil." (when (fboundp lang-mode) (let ((string (buffer-substring-no-properties start end)) (modified (buffer-modified-p)) - (org-buffer (current-buffer))) + (org-buffer (current-buffer)) + (block-faces (let ((face-name (intern (format "org-block-%s" lang)))) + (append (and (facep face-name) (list face-name)) + '(org-block))))) (remove-text-properties start end '(face nil)) (with-current-buffer (get-buffer-create @@ -510,12 +513,12 @@ as `org-src-fontify-natively' is non-nil." (put-text-property (+ start (1- pos)) (1- (+ start next)) 'face (list :inherit (append (and new-face (list new-face)) - (list 'org-block))) + block-faces)) org-buffer)) (setq pos next)) ;; Add the face to the remaining part of the text. (put-text-property (1- (+ start pos)) end 'face - '(:inherit org-block) org-buffer))) + (list :inherit block-faces) org-buffer))) (add-text-properties start end '(font-lock-fontified t fontified t font-lock-multiline t)) diff --git a/lisp/org.el b/lisp/org.el index 206ebad..d00de1e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5976,7 +5976,9 @@ by a #." (add-text-properties beg1 block-end '(src-block t))) (quoting (add-text-properties beg1 (min (point-max) (1+ end1)) - '(face org-block))) ; end of source block + (let ((face-name (intern (format "org-block-%s" lang)))) + (append (and (facep face-name) (list face-name)) + '(face org-block))))) ; end of source block ((not org-fontify-quote-and-verse-blocks)) ((string= block-type "quote") (add-text-properties beg1 (min (point-max) (1+ end1)) '(face org-quote))) -- 2.8.3