Add shortdoc entries and clean up code and documentations.

This commit is contained in:
Gerard Vermeulen 2022-08-22 08:18:39 +02:00
parent 15bec52664
commit 54d6c33824

View File

@ -713,7 +713,11 @@ defined in this Org file.
(org-eval-emacs-lisp-setup-blocks :no-manual t)
(org-eval-python-setup-blocks :no-manual t)
(org-eval-infixed-blocks :no-manual t)
(org-latex-engraved-source-block-filter :no-manual t)
(org-syntax-convert-keyword-case-to-lower :no-manual t)
(smart-latex-engrave-org-source-blocks :no-manual t)
(toggle-engrave-faces-latex-face-apply-override :no-manual t)
(toggle-engrave-faces-latex-face-mapper-override :no-manual t)
(toggle-org-babel-python-format-session-value-override :no-manual t))))
#+end_src
@ -2174,13 +2178,13 @@ configuration.
(setq start (match-end 0))
(when-let ((pc (match-string 1 protected-content)))
(if (stringp slug)
(setq stack (cons (concat "\\EF" slug "{" pc "}") stack))
(setq stack
(cons (engrave-faces-latex-face-apply faces pc) stack))))
(push (concat "\\EF" slug "{" pc "}") stack)
(push (engrave-faces-latex-face-apply faces pc) stack)))
(when-let ((pc (match-string 2 protected-content)))
(setq stack (cons pc stack))))
(apply #'concat (nreverse stack))))))
(push pc stack)))
(apply #'concat (nreverse stack)))))))
(with-eval-after-load 'emacs
(defun toggle-engrave-faces-latex-face-mapper-override ()
"Toggle `engrave-faces-latex-face-mapper' advice."
(interactive)
@ -2194,9 +2198,9 @@ configuration.
#+caption: Ensure =engrave-faces= installation and fix symbolic colors.
#+name: lst:ensure-engrave-faces-with-latex-face-apply-fix
#+begin_src emacs-lisp
(when (ensure-package-installation 'engrave-faces)
(require 'engrave-faces-latex nil t)
(defun engrave-faces-latex--html-color (color)
(when (and (ensure-package-installation 'engrave-faces)
(require 'engrave-faces-latex nil t))
(defun engrave-faces-latex--color (color)
"Convert COLOR loosely to a string of six hexadecimal digits."
(if (char-equal ?# (aref color 0))
(substring color 1 7)
@ -2205,7 +2209,7 @@ configuration.
(color-values color)))))
(defun engrave-faces-latex-face-apply-override (faces content)
"Convert each compatible parameter of FACES to a LaTeX command applied to CONTENT."
"Convert attributes of FACES to LaTeX commands applied to CONTENT."
(let ((attrs (engrave-faces-merge-attributes faces)))
(let ((bg (plist-get attrs :background))
(fg (plist-get attrs :foreground))
@ -2214,13 +2218,14 @@ configuration.
(st (plist-get attrs :strike-through)))
(concat
(when bg (concat "\\colorbox[HTML]{"
(engrave-faces-latex--html-color bg) "}{"))
(engrave-faces-latex--color bg) "}{"))
(when fg (concat "\\textcolor[HTML]{"
(engrave-faces-latex--html-color fg) "}{"))
(engrave-faces-latex--color fg) "}{"))
(when st "\\sout{") (when bl "\\textbf{") (when it "\\textit{")
content
(when bg "}") (when fg "}") (when st "}") (when bl "}") (when it "}")))))
(when bg "}") (when fg "}") (when st "}") (when bl "}") (when it "}"))))))
(with-eval-after-load 'emacs
(defun toggle-engrave-faces-latex-face-apply-override ()
"Toggle `engrave-faces-latex-face-apply' advice."
(interactive)
@ -2239,13 +2244,15 @@ configuration.
(defun org-latex-engraved-source-block-filter (data _backend _info)
"Replace \"Code\" with \"Breakable\" in non-floating environments.
Customize `org-latex-engraved-preamble' to define a Breakable environment."
Customize `org-latex-engraved-preamble' to define a Breakable (non-floating)
environment and an unbreakable Code (floating) environment."
(unless (string-match "^\\\\DeclareTColorBox\\[\\]{Breakable}"
org-latex-engraved-preamble)
(user-error "`org-latex-engraved-preamble' defines no `Breakable' environment"))
(when (eq org-latex-src-block-backend 'engraved)
(let ((enter "^\\\\begin{Code}\n\\\\begin{Verbatim}")
(leave "^\\\\end{Verbatim}\n\\\\end{Code}"))
;; Transform only blocks matching the enter regexp at position 0.
(when (and (string-match enter data) (eql 0 (match-beginning 0)))
(setq data (replace-match
"\\begin{Breakable}\n\\begin{Verbatim}" t t data))