Tangle setupfile.org

* Let minted handle org source blocks as text.
* Let org-babel-tangle-file tangle to emacs-lisp as well as org.
This commit is contained in:
Gerard Vermeulen 2021-12-28 14:08:56 +01:00
parent 436eea8582
commit f5fb65404f
3 changed files with 36 additions and 21 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@
latexmkrc
org-store-link
setupfile.org
/_minted-README
/eln-cache

View File

@ -2,17 +2,7 @@
#+author: Gerard Vermeulen
#+latex_class: article
#+latex_class_options: [11pt,a4paper,english,svgnames,tables]
#
#+babel: :cache no
#
#+macro: kbd @@html:<kbd>$1</kbd>@@@@latex:\colorbox{PaleTurquoise}{\texttt{$1}}@@
#
#+property: header-args :tangle init.el
#+property: header-args:emacs-lisp :exports code :results silent
#+property: header-args:latex-header :tangle no
#+property: header-args:latex-extra-header :tangle no
#
#+startup: content
#+setupfile: setupfile.org
* LaTeX headers :noexport:
@ -61,7 +51,7 @@
#+end_src
#+begin_src latex-header
% Make section, subsection and subsubsection implicit float barriers.
% FLOAT BARRIERS:
% https://tex.stackexchange.com/questions/118662/use-placeins-for-subsections
% Make section an implicit float barrier:
\usepackage[section]{placeins}
@ -1057,6 +1047,11 @@ The code in listing [[lst:customize-org-babel]], [[lst:customize-org]], and
urlcolor=blue,
}\n")
'(org-latex-listings 'minted)
'(org-latex-minted-langs '((cc "c++")
(cperl "perl")
(shell-script "bash")
(caml "ocaml")
(org "text")))
'(org-latex-minted-options '(("bgcolor" "LightGoldenrodYellow")))
`(org-latex-logfiles-extensions
',(cl-union '("lof" "lot") org-latex-logfiles-extensions :test #'equal))
@ -1283,22 +1278,25 @@ new [[info:org#Editing Source Code][<LANGUAGE>-modes]]: =latex-header= and =late
#+caption: easily.
#+name: lst:emacs-lisp-setup-latex-header
#+begin_src emacs-lisp
(with-eval-after-load 'org-src (defun prefix-all-lines (prefix body)
(with-temp-buffer (insert body) (string-insert-rectangle (point-min)
(point-max) prefix) (buffer-string)))
(with-eval-after-load 'org-src
(defun prefix-all-lines (prefix body)
(with-temp-buffer
(insert body)
(string-insert-rectangle (point-min) (point-max) prefix)
(buffer-string)))
(add-to-list 'org-src-lang-modes '("latex-header" . latex))
(defvar org-babel-default-header-args:latex-header '((:results
. "raw") (:exports . "results")))
(defvar org-babel-default-header-args:latex-header
'((:exports . "results") (:results . "raw")))
(defun org-babel-execute:latex-header (body _params)
(prefix-all-lines "#+latex_header: " body))
(add-to-list 'org-src-lang-modes '("latex-extra-header" . latex))
(defvar org-babel-default-header-args:latex-extra-header '((:results
. "raw") (:exports . "results")))
(defvar org-babel-default-header-args:latex-extra-header
'((:exports . "results") (:results . "raw")))
(defun org-babel-execute:latex-extra-header (body _params)
(prefix-all-lines "#+latex_extra_header: " body)))
@ -1411,7 +1409,7 @@ Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
#+caption: Use the setup macro for =ox-latex=.
#+name: lst:emacs-lisp-setup-call
#+header: :var title-page=lst/title-page
#+begin_src emacs-lisp :exports code :results silent :tangle no
#+begin_src emacs-lisp :tangle no
(my-ox-latex-export-buffer-local-variables title-page)
#+end_src
@ -1438,6 +1436,21 @@ Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
\end{titlepage}
#+end_src
*** [[info:org#Export Settings][SETUPFILE export keyword usage]]
:PROPERTIES:
:CUSTOM_ID: sec:setupfile-export-keyword-usage
:END:
#+caption[Setup file export keyword settings]:
#+caption: Setup file export keyword settings.
#+name: lst:setup-file-export-keyword-settings
#+begin_src org :tangle setupfile.org
#+babel: :cache no
#+macro: kbd @@html:<kbd>$1</kbd>@@@@latex:\colorbox{PowderBlue}{\texttt{$1}}@@
#+property: header-args:emacs-lisp :exports code :results silent :tangle init.el
#+startup: content
#+end_src
* Editing
** [[https://www.emacswiki.org/emacs/DisabledCommands][Enable disabled commands and inform]]

View File

@ -23,7 +23,8 @@ emacs -Q --batch --eval "
(setq org-confirm-babel-evaluate nil)
(setq python-indent-guess-indent-offset nil)
(org-babel-tangle-file \"$1\"))
(org-babel-tangle-file \"$1\" \"init.el\" \"emacs-lisp\")
(org-babel-tangle-file \"$1\" \"setupfile.org\" \"org\"))
"
# Local Variables: