rename case to cl-case for by-backend

This commit is contained in:
2025-12-26 12:55:12 +01:00
parent e1c69f0824
commit 0eae175df9

View File

@@ -743,8 +743,8 @@ Suggest the URL title as a description for resource."
:after (org)) :after (org))
(use-package ob-core (use-package ob-core
:defer t ;; :hook (org-babel-after-execute . org-redisplay-inline-images)
:hook (org-babel-after-execute . org-redisplay-inline-images) :commands (by-backend svg-fname)
:config :config
(setq org-babel-inline-result-wrap "%s") ;; default "=%s=" (setq org-babel-inline-result-wrap "%s") ;; default "=%s="
(setq org-confirm-babel-evaluate nil) ;; no "Evaluate this gnuplot code block on your system? (y or n)" (setq org-confirm-babel-evaluate nil) ;; no "Evaluate this gnuplot code block on your system? (y or n)"
@@ -755,20 +755,7 @@ Suggest the URL title as a description for resource."
The key of plist elements is one of the following lisp symbols: The key of plist elements is one of the following lisp symbols:
html, latex, ascii, or t (meaning all other cases). If BODY is html, latex, ascii, or t (meaning all other cases). If BODY is
nil the return value is nil" nil the return value is nil"
`(case org-export-current-backend ,@body)) `(cl-case org-export-current-backend ,@body))
;; obsolete function
(defalias 'if-latex 'by-backend)
(make-obsolete 'if-latex 'by-backend "2020.09.07")
(advice-add 'if-latex :before
(lambda (&rest r)
"Warning: Function `if-latex' is obsolete.
Probably used inside an org file for a src block and/or for an org export.
Updating an old preamble.org should remove this warning."
(message "Warning: Function `if-latex' is obsolete.
Probably used inside an org file for a src block and/or for an org export.
Updating an old preamble.org should remove this warning."))
'((name . "obsolete")))
;; TODO: still useful? ;; TODO: still useful?
(defun svg-fname (filename) (defun svg-fname (filename)
@@ -807,7 +794,7 @@ Updating an old preamble.org should remove this warning."))
(add-to-list 'org-babel-load-languages '(ditaa . t)))) (add-to-list 'org-babel-load-languages '(ditaa . t))))
(use-package ob-gnuplot (use-package ob-gnuplot
:defer t :commands (gpl-file gpl-term)
:init :init
(with-eval-after-load 'org (with-eval-after-load 'org
(add-to-list 'org-babel-load-languages '(gnuplot . t))) (add-to-list 'org-babel-load-languages '(gnuplot . t)))
@@ -831,7 +818,10 @@ set linetype 5 lc rgb '#76ab2f' lw 2 pt 5 ; \
set linetype 6 lc rgb '#4cbded' lw 2 pt 5 ; \ set linetype 6 lc rgb '#4cbded' lw 2 pt 5 ; \
set linetype 7 lc rgb '#a1132e' lw 2 pt 5 ; \ set linetype 7 lc rgb '#a1132e' lw 2 pt 5 ; \
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \ filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) ") set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
")
(defvar gnuplot-init-dark "reset ; \ (defvar gnuplot-init-dark "reset ; \
theme_type = 'dark' ; \ theme_type = 'dark' ; \
set border lc rgb '#cccccc' ; \ set border lc rgb '#cccccc' ; \
@@ -850,7 +840,10 @@ set linetype 5 lc rgb '#cc5279' lw 2 pt 5 ; \
set linetype 6 lc rgb '#76ab2f' lw 2 pt 5 ; \ set linetype 6 lc rgb '#76ab2f' lw 2 pt 5 ; \
set linetype 7 lc rgb '#ecb01f' lw 2 pt 5 ; \ set linetype 7 lc rgb '#ecb01f' lw 2 pt 5 ; \
filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \ filter(x,min,max) = (x >= min && x <= max) ? x : 1/0 ; \
set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) ") set datafile separator '\\t' # treat empty fields in a org-table as 'missing' rather than 'bad' (ignoring, shifting column) "
"usage e.g. to prepend style for all gnuplot src blocks by-backend:
#+property: header-args:gnuplot :prologue (by-backend (latex gnuplot-init-light) (t gnuplot-init-dark))
")
(defun gpl-file (filename) (defun gpl-file (filename)
"\ "\
@@ -887,7 +880,7 @@ usage: #+HEADER: :term (gpl-term \"15cm,12cm\" \"380,300\")
) )
(use-package ob-latex (use-package ob-latex
:defer t :commands (tpl-file gpl-results)
:config :config
;; tikz config for own org export projects ;; tikz config for own org export projects
(defun tpl-file (filename) (defun tpl-file (filename)
@@ -1058,7 +1051,8 @@ usage: #+HEADER: :results (tpl-results)
) )
(use-package ob-python (use-package ob-python
:after (org-src python) ;; :after (org-src python)
:commands (mpl-var mpl-prologue)
;; :commands (org-babel-execute:python ;; :commands (org-babel-execute:python
;; org-babel-variable-assignments:python) ;; org-babel-variable-assignments:python)
:init :init