>From 146146df02434f8b224b21293753f260d0d624b2 Mon Sep 17 00:00:00 2001 From: TEC Date: Sun, 8 May 2022 02:01:34 +0800 Subject: [PATCH 08/10] ox-latex: Support setting the engraved theme * lisp/ox-latex.el (org-latex-generate-engraved-preamble, org-latex-engraved-theme): Introduce the new export keyword LATEX_ENGRAVED_THEME with default value given by `org-latex-engraved-theme'. This is used to set the engraved theme used in org-latex-engraved-theme. This bumps the minimum required version of engrave-faces from v0.2 to v0.3. --- lisp/ox-latex.el | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index cc6ac291a..21541e9aa 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -129,6 +129,7 @@ (org-export-define-backend 'latex (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format) (:latex-engraved-options nil nil org-latex-engraved-options) (:latex-engraved-preamble nil nil org-latex-engraved-preamble) + (:latex-engraved-theme "LATEX_ENGRAVED_THEME" nil org-latex-engraved-theme) (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format) (:latex-footnote-separator nil nil org-latex-footnote-separator) (:latex-format-drawer-function nil nil org-latex-format-drawer-function) @@ -1267,6 +1268,14 @@ (defcustom org-latex-engraved-options :type '(alist :key-type (string :tag "option") :value-type (string :tag "value"))) +(defcustom org-latex-engraved-theme nil + "The theme that should be used for engraved code, when non-nil. +This can be set to any theme defined in `engrave-faces-themes' or +loadable by Emacs. When set to t, the current Emacs theme is +used." + :group 'org-export-latex + :type 'symbol) + (defun org-latex-generate-engraved-preamble (info syntax-colours-p) "Generate the preamble to setup engraved code. The result is constructed from the :latex-engraved-preamble and @@ -1275,7 +1284,8 @@ (defun org-latex-generate-engraved-preamble (info syntax-colours-p) `org-latex-engraved-options' respectively." (let* ((engraved-options (plist-get info :latex-engraved-options)) - (engraved-preamble (plist-get info :latex-engraved-preamble))) + (engraved-preamble (plist-get info :latex-engraved-preamble)) + (engraved-theme (plist-get info :latex-engraved-theme))) (when (string-match "^[ \t]*\\[FVEXTRA-SETUP\\][ \t]*\n?" engraved-preamble) (setq engraved-preamble (replace-match @@ -1307,7 +1317,8 @@ (defun org-latex-generate-engraved-preamble (info syntax-colours-p) engraved-preamble "\n\n% Setup for code blocks [2/2]: syntax highlighting colors\n" (if (require 'engrave-faces-latex nil t) - (engrave-faces-latex-gen-preamble) + (engrave-faces-latex-gen-preamble + (when engraved-theme (intern engraved-theme))) (message "Cannot engrave source blocks. Consider installing `engrave-faces'.") "% WARNING syntax highlighting unavailible as engrave-faces-latex was missing.\n") "\n") -- 2.35.3