Split source block and edit the list describing the source blocks

This commit is contained in:
Gerard Vermeulen 2023-06-17 18:00:21 +02:00
parent fbf166a238
commit 573caaa529

View File

@ -2111,24 +2111,26 @@ list detailing and motivating each listing:
1. Listing [[lst:set-org-options]] handles basic [[https://orgmode.org/][Org-mode]] options.
2. Listing [[lst:setup-org-babel]] handles basic [[https://orgmode.org/][Org-mode]] options specific to
[[info:org#Working with Source Code][work with source code (info)]].
3. Listing [[lst:set-org-link-options]] handles [[https://orgmode.org/][Org-mode]] options specific to
3. Listing [[lst:ob-tangle-plus]] extends [[info:org#Noweb Reference Syntax][source code export (info)]] with user
friendly commands.
4. Listing [[lst:set-org-link-options]] handles [[https://orgmode.org/][Org-mode]] options specific to
[[info:org#Hyperlinks][hyperlinks (info)]].
4. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful
5. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful
key-bindings.
5. Listing [[lst:setup-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]],
6. Listing [[lst:setup-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]],
and it provides a function to remove the indentation of all =org-src-mode=
blocks without =-i= switch.
6. Listing [[lst:setup-ob-python]] allows to pretty-print Python session source
7. Listing [[lst:setup-ob-python]] allows to pretty-print Python session source
block values with [[https://github.com/psf/black#readme][black]] instead of [[https://docs.python.org/3/library/pprint.html][pprint]].
7. Listing [[lst:set-org-export-options]] selects the =non-intrusive= expert user
8. Listing [[lst:set-org-export-options]] selects the =non-intrusive= expert user
interface for export dispatching.
8. Listing [[lst:setup-org-for-lualatex-export]] and
9. Listing [[lst:setup-org-for-lualatex-export]] and
[[lst:set-ox-latex-options-for-lualatex-export]] configure [[https://orgmode.org/][Org-mode]] to generate
output for the LuaLaTeX compiler.
9. Listing [[lst:setup-org-latex-classes]] defines [[info:org#LaTeXspecificexportsettings][org-latex-classes (info)]] for
backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and
type {{{kbd(C-hv org-latex-classes)}}} for an explanation of the code in
listing [[lst:setup-org-latex-classes]].
10. Listing [[lst:setup-org-latex-classes]] defines [[info:org#LaTeXspecificexportsettings][org-latex-classes (info)]] for
backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and
type {{{kbd(C-hv org-latex-classes)}}} for an explanation of the code in
listing [[lst:setup-org-latex-classes]].
#+caption[Set basic =Org= options]:
#+caption: Set basic =Org= options.
@ -2193,7 +2195,12 @@ list detailing and motivating each listing:
;; Default to `sly-eval' whenever feasible:
(when (package-installed-p 'sly)
(setopt org-babel-lisp-eval-fn #'sly-eval)))
#+end_src
#+caption[Add extra functionality to =ob-tangle=]:
#+caption: Add extra functionality to =ob-tangle=.
#+name: lst:ob-tangle-plus
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun set-org-babel-language-activity (lang active)
"Set the `org-babel' activity of language LANG to ACTIVE.
@ -2221,7 +2228,20 @@ unbind the `org-babel' interface functions when ACTIVE is nil."
(interactive "SDeactivate language: ")
(if (set-org-babel-language-activity lang nil)
(message "Did deactivate `%s' for `org-babel'" lang)
(message "Can't deactivate `%s' for `org-babel'" lang))))
(message "Can't deactivate `%s' for `org-babel'" lang)))
;; https://readingworldmagazine.com/emacs/2023-06-11-introducing-org-mode/
(defun org-babel-tangle-block()
"Tangle single source blocks."
(interactive)
(let ((current-prefix-arg '(4))) ;; C-u C-c C-v t
(call-interactively 'org-babel-tangle)))
(defun org-babel-tangle-collect()
"Collect all source blocks with the same target file and tangle."
(interactive)
(let ((current-prefix-arg '(16))) ;; C-u C-u C-c C-v t
(call-interactively 'org-babel-tangle))))
#+end_src
#+caption[Set =org-link= options]: