Improve readability of the Org customization section
This commit is contained in:
parent
d8df141bde
commit
12c4350787
189
README.org
189
README.org
@ -1926,11 +1926,14 @@ zeromatrix zmat")))
|
|||||||
(when (ensure-package-installation 'markdown-mode))
|
(when (ensure-package-installation 'markdown-mode))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Writing Org files
|
** Writing [[info:org#Top][Org (info)]] files
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: sec:writing-org-files
|
:CUSTOM_ID: sec:writing-org-files
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
|
The [[https://org-babel.readthedocs.io/en/latest/][Org Babel reference card]] complements section [[info:org#Working with Source Code][Working with Source Code (info)]]
|
||||||
|
of the [[info:org#Top][Org (info)]] manual.
|
||||||
|
|
||||||
*** [[info:org#Activation][Org activation (info)]]
|
*** [[info:org#Activation][Org activation (info)]]
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: sec:activate-org
|
:CUSTOM_ID: sec:activate-org
|
||||||
@ -1953,69 +1956,32 @@ zeromatrix zmat")))
|
|||||||
:CUSTOM_ID: sec:customize-org
|
:CUSTOM_ID: sec:customize-org
|
||||||
:END:
|
:END:
|
||||||
|
|
||||||
Listing [[lst:customize-org-babel]], [[lst:customize-org]], [[lst:customize-org-link]], and
|
I have split the initial customization of [[https://orgmode.org/][Org-mode]] over several listings. Here,
|
||||||
[[lst:customize-org-src]] handle basic customization of [[https://orgmode.org/][Org-mode]] variables, where:
|
follows a list detailing and motivating each listing:
|
||||||
1. listing [[lst:customize-org-babel]] selects the Python interpreter by means of
|
1. Listing [[lst:customize-org]] handles basic customization of [[https://orgmode.org/][Org-mode]] variables
|
||||||
|
2. Listing [[lst:customize-org-babel]] handles basic customization of [[https://orgmode.org/][Org-mode]]
|
||||||
|
variables specific to [[info:org#Working with Source Code][working with source code (info)]] and it selects the
|
||||||
|
Python interpreter by means of
|
||||||
src_emacs-lisp{(choose-common-python-interpreter)} defined in listing
|
src_emacs-lisp{(choose-common-python-interpreter)} defined in listing
|
||||||
[[lst:choose-common-python-interpreter]].
|
[[lst:choose-common-python-interpreter]].
|
||||||
2. listing [[lst:customize-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]] and
|
3. Listing [[lst:customize-org-link]] handle basic customization of [[https://orgmode.org/][Org-mode]]
|
||||||
provides a function to remove the indentation of all =org-src-mode= blocks
|
variables specific to [[info:org#Hyperlinks][hyperlinks (info)]].
|
||||||
without =-i= switch.
|
4. Listing [[lst:configure-org-mode-map]] extends the =org-mode-map= with useful
|
||||||
Listing [[lst:configure-org-mode-map]] extends the =org-mode-map= with useful
|
key-bindings.
|
||||||
key-bindings. Listing [[lst:customize-ob-python]] allows to pretty-print Python
|
5. Listing [[lst:customize-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]],
|
||||||
session source block values with [[https://github.com/psf/black#readme][black]] instead of [[https://docs.python.org/3/library/pprint.html][pprint]]. Listing
|
and it provides a function to remove the indentation of all =org-src-mode=
|
||||||
[[lst:customize-org-export-ui]] selects the expert user interface for export
|
blocks without =-i= switch.
|
||||||
dispatching. Listing [[lst:customize-org-for-lualatex-export]], and
|
6. Listing [[lst:customize-ob-python]] allows to pretty-print Python session source
|
||||||
[[lst:customize-ox-latex-for-lualatex-export]] configure [[https://orgmode.org/][Org-mode]] for export to
|
block values with [[https://github.com/psf/black#readme][black]] instead of [[https://docs.python.org/3/library/pprint.html][pprint]].
|
||||||
LuaLaTeX. Listing [[lst:customize-org-link]] configures =org-link= to use relative
|
7. Listing [[lst:customize-org-export-ui]] selects the =non-intrusive= expert user
|
||||||
file path links.
|
interface for export dispatching.
|
||||||
Listing [[lst:customize-org-latex-classes]] defines [[info:org#LaTeX
|
8. Listing [[lst:customize-org-for-lualatex-export]] and
|
||||||
specificexportsettings][org-latex-classes (info)]] for backward
|
[[lst:customize-ox-latex-for-lualatex-export]] configure [[https://orgmode.org/][Org-mode]] to generate
|
||||||
compatibility. See table [[tab:org-latex-class-tag-placeholder]] and type {{{kbd(C-h
|
output for the LuaLaTeX compiler.
|
||||||
v org-latex-classes)}}} for an explanation of the code in listing
|
9. Listing [[lst:customize-org-latex-classes]] defines [[info:org#LaTeXspecificexportsettings][org-latex-classes (info)]] for
|
||||||
[[lst:customize-org-latex-classes]].
|
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
|
||||||
#+attr_latex: :booktabs yes :float table
|
listing [[lst:customize-org-latex-classes]].
|
||||||
#+caption[The relation tag-placeholder in listing [[lst:customize-org-latex-classes]]]:
|
|
||||||
#+caption: The relation tag-placeholder in listing [[lst:customize-org-latex-classes]].
|
|
||||||
#+name: tab:org-latex-class-tag-placeholder
|
|
||||||
| tag | placeholder |
|
|
||||||
|-----+-----------------------|
|
|
||||||
| +1 | [DEFAULT-PACKAGES] |
|
|
||||||
| +2 | [PACKAGES] |
|
|
||||||
| +3 | [EXTRA] |
|
|
||||||
| -1 | [NO-DEFAULT-PACKAGES] |
|
|
||||||
| -2 | [NO-PACKAGES] |
|
|
||||||
| -3 | [NO-EXTRA] |
|
|
||||||
|
|
||||||
#+caption[Customize =org-babel=]:
|
|
||||||
#+caption: Customize =org-babel=.
|
|
||||||
#+name: lst:customize-org-babel
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(with-eval-after-load 'ob-core
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-confirm-babel-evaluate nil)))
|
|
||||||
|
|
||||||
(with-eval-after-load 'ob-latex
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-babel-latex-preamble
|
|
||||||
(lambda (_)
|
|
||||||
"\\documentclass[preview]{standalone}\n"))
|
|
||||||
'(org-babel-latex-begin-env
|
|
||||||
(lambda (_)
|
|
||||||
"\\begin{document}\n"))
|
|
||||||
'(org-babel-latex-end-env
|
|
||||||
(lambda (_)
|
|
||||||
"\\end{document}\n"))))
|
|
||||||
|
|
||||||
(with-eval-after-load 'ob-lisp
|
|
||||||
(with-eval-after-load 'sly
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-babel-lisp-eval-fn #'sly-eval))))
|
|
||||||
|
|
||||||
(with-eval-after-load 'ob-python
|
|
||||||
(choose-common-python-interpreter 'python))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+caption[Customize =Org=]:
|
#+caption[Customize =Org=]:
|
||||||
#+caption: Customize =Org=.
|
#+caption: Customize =Org=.
|
||||||
@ -2067,6 +2033,34 @@ v org-latex-classes)}}} for an explanation of the code in listing
|
|||||||
("v" . "verse")))))
|
("v" . "verse")))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+caption[Customize =org-babel=]:
|
||||||
|
#+caption: Customize =org-babel=.
|
||||||
|
#+name: lst:customize-org-babel
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(with-eval-after-load 'ob-core
|
||||||
|
(custom-set-variables
|
||||||
|
'(org-confirm-babel-evaluate nil)))
|
||||||
|
|
||||||
|
(with-eval-after-load 'ob-latex
|
||||||
|
(custom-set-variables
|
||||||
|
'(org-babel-latex-preamble
|
||||||
|
(lambda (_)
|
||||||
|
"\\documentclass[preview]{standalone}\n"))
|
||||||
|
'(org-babel-latex-begin-env
|
||||||
|
(lambda (_)
|
||||||
|
"\\begin{document}\n"))
|
||||||
|
'(org-babel-latex-end-env
|
||||||
|
(lambda (_)
|
||||||
|
"\\end{document}\n"))))
|
||||||
|
|
||||||
|
(with-eval-after-load 'ob-lisp
|
||||||
|
(with-eval-after-load 'sly
|
||||||
|
(custom-set-variables
|
||||||
|
'(org-babel-lisp-eval-fn #'sly-eval))))
|
||||||
|
|
||||||
|
(with-eval-after-load 'ob-python
|
||||||
|
(choose-common-python-interpreter 'python))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+caption[Customize =org-link=]:
|
#+caption[Customize =org-link=]:
|
||||||
#+caption: Customize =org-link=.
|
#+caption: Customize =org-link=.
|
||||||
@ -2077,35 +2071,6 @@ v org-latex-classes)}}} for an explanation of the code in listing
|
|||||||
'(org-link-file-path-type 'relative)))
|
'(org-link-file-path-type 'relative)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+caption[Customize =org-src=]:
|
|
||||||
#+caption: Customize =org-src=.
|
|
||||||
#+name: lst:customize-org-src
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(with-eval-after-load 'emacs
|
|
||||||
(custom-set-variables
|
|
||||||
'(org-src-preserve-indentation t))
|
|
||||||
|
|
||||||
(declare-function org-babel-map-src-blocks "ext:ob-core" (file &rest body))
|
|
||||||
(declare-function org-do-remove-indentation "ext:org-macs" (n skip-fl))
|
|
||||||
|
|
||||||
(defun zero-all-org-src-blocks-indentation ()
|
|
||||||
"Remove the indentation of all `org-src-mode' blocks without `-i' switch."
|
|
||||||
(interactive)
|
|
||||||
(when (derived-mode-p 'org-mode)
|
|
||||||
(save-excursion
|
|
||||||
(org-babel-map-src-blocks
|
|
||||||
nil
|
|
||||||
(unless (or (string-match "-i " switches)
|
|
||||||
(string-match (rx (or bos bol) graph) body))
|
|
||||||
(when-let ((new (with-temp-buffer
|
|
||||||
(insert body)
|
|
||||||
(org-do-remove-indentation)
|
|
||||||
(buffer-string))))
|
|
||||||
(goto-char beg-body)
|
|
||||||
(delete-region beg-body end-body)
|
|
||||||
(insert new))))))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+caption[Configure =org-mode-map=]:
|
#+caption[Configure =org-mode-map=]:
|
||||||
#+caption: Configure =org-mode-map=.
|
#+caption: Configure =org-mode-map=.
|
||||||
#+name: lst:configure-org-mode-map
|
#+name: lst:configure-org-mode-map
|
||||||
@ -2152,6 +2117,35 @@ When called twice, replace the previously inserted \\(\\) by one $."
|
|||||||
(define-key org-mode-map (kbd "M-q") #'org-fill-paragraph)))
|
(define-key org-mode-map (kbd "M-q") #'org-fill-paragraph)))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+caption[Customize =org-src=]:
|
||||||
|
#+caption: Customize =org-src=.
|
||||||
|
#+name: lst:customize-org-src
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
(with-eval-after-load 'emacs
|
||||||
|
(custom-set-variables
|
||||||
|
'(org-src-preserve-indentation t))
|
||||||
|
|
||||||
|
(declare-function org-babel-map-src-blocks "ext:ob-core" (file &rest body))
|
||||||
|
(declare-function org-do-remove-indentation "ext:org-macs" (n skip-fl))
|
||||||
|
|
||||||
|
(defun zero-all-org-src-blocks-indentation ()
|
||||||
|
"Remove the indentation of all `org-src-mode' blocks without `-i' switch."
|
||||||
|
(interactive)
|
||||||
|
(when (derived-mode-p 'org-mode)
|
||||||
|
(save-excursion
|
||||||
|
(org-babel-map-src-blocks
|
||||||
|
nil
|
||||||
|
(unless (or (string-match "-i " switches)
|
||||||
|
(string-match (rx (or bos bol) graph) body))
|
||||||
|
(when-let ((new (with-temp-buffer
|
||||||
|
(insert body)
|
||||||
|
(org-do-remove-indentation)
|
||||||
|
(buffer-string))))
|
||||||
|
(goto-char beg-body)
|
||||||
|
(delete-region beg-body end-body)
|
||||||
|
(insert new))))))))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
#+caption[Customize =ob-python=]:
|
#+caption[Customize =ob-python=]:
|
||||||
#+caption: Customize =ob-python=.
|
#+caption: Customize =ob-python=.
|
||||||
#+name: lst:customize-ob-python
|
#+name: lst:customize-ob-python
|
||||||
@ -2329,6 +2323,19 @@ else:
|
|||||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))))))
|
("\\subsubsection{%s}" . "\\subsubsection*{%s}")))))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
#+attr_latex: :booktabs yes :float table
|
||||||
|
#+caption[The relation tag-placeholder in listing [[lst:customize-org-latex-classes]]]:
|
||||||
|
#+caption: The relation tag-placeholder in listing [[lst:customize-org-latex-classes]].
|
||||||
|
#+name: tab:org-latex-class-tag-placeholder
|
||||||
|
| tag | placeholder |
|
||||||
|
|-----+-----------------------|
|
||||||
|
| +1 | [DEFAULT-PACKAGES] |
|
||||||
|
| +2 | [PACKAGES] |
|
||||||
|
| +3 | [EXTRA] |
|
||||||
|
| -1 | [NO-DEFAULT-PACKAGES] |
|
||||||
|
| -2 | [NO-PACKAGES] |
|
||||||
|
| -3 | [NO-EXTRA] |
|
||||||
|
|
||||||
*** [[https://github.com/bdarcus/citar][Citar: citing bibliography]] with [[https://orgmode.org/][Org Mode]]
|
*** [[https://github.com/bdarcus/citar][Citar: citing bibliography]] with [[https://orgmode.org/][Org Mode]]
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:CUSTOM_ID: sec:citing-bibliography
|
:CUSTOM_ID: sec:citing-bibliography
|
||||||
|
Loading…
x
Reference in New Issue
Block a user