diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index ac233a986..1d4527540 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -24,6 +24,21 @@ consider [[https://gitlab.com/jackkamm/ob-python-mode-mode][ob-python-mode-mode] has been ported to. ** New and changed options +*** ~org-src-block-faces~ now accepts empty string ~""~ as language name + +It is now possible to customize face of source blocks without language specifier. + +: #+begin_src +: Source block with no language +: #+end_src + +For example, to set ~highlight~ face, use + +#+begin_src emacs-lisp +(setq org-src-fontify-natively t) +(add-to-list 'org-src-block-faces '("" highlight)) +#+end_src + *** New ~org-cite-natbib-export-bibliography~ option defining fallback bibliography style ~natbib~ citation export processor now uses diff --git a/lisp/org-src.el b/lisp/org-src.el index aadd8eba5..ec2716885 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -233,7 +233,8 @@ Each element is a cell of the format (\"language\" FACE) -Where FACE is either a defined face or an anonymous face. +Where FACE is either a defined face or an anonymous face. Empty +language string refers to source blocks without specified language. For instance, the following would color the background of emacs-lisp source blocks and python source blocks in purple and @@ -247,7 +248,6 @@ green, respectability. (choice (face :tag "Face") (sexp :tag "Anonymous face")))) - :version "26.1" :package-version '(Org . "9.0")) (defcustom org-src-tab-acts-natively t diff --git a/lisp/org.el b/lisp/org.el index c6a4702ff..a6b8a30ab 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5415,9 +5415,9 @@ by a #." (org-remove-flyspell-overlays-in beg bol-after-beginline) (org-remove-flyspell-overlays-in nl-before-endline end-of-endline) (cond - ((and lang (not (string= lang "")) org-src-fontify-natively) + (org-src-fontify-natively (save-match-data - (org-src-font-lock-fontify-block lang block-start block-end)) + (org-src-font-lock-fontify-block (or lang "") block-start block-end)) (add-text-properties bol-after-beginline block-end '(src-block t))) (quoting (add-text-properties