1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-26 07:33:39 +00:00

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.

Suggested-by: Karl Voit <devnull <at> Karl-Voit.at>
<http://thread.gmane.org/gmane.emacs.orgmode/103833/focus=107645
This commit is contained in:
Rasmus 2016-06-09 16:52:05 +02:00
parent 81af689d0f
commit b0def38b4b
2 changed files with 12 additions and 4 deletions

View File

@ -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))

View File

@ -5976,7 +5976,12 @@ 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
(list 'face
(list :inherit
(let ((face-name
(intern (format "org-block-%s" lang))))
(append (and (facep face-name) (list face-name))
'(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)))