Swap two sections and add hyperlinks

This commit is contained in:
Gerard Vermeulen 2021-12-29 14:05:03 +01:00
parent 16133cd62c
commit ddfba322e8
1 changed files with 120 additions and 92 deletions

View File

@ -629,7 +629,7 @@ Listing [[lst:configure-company]] configures =company=.
(add-hook hook #'company-mode))))
#+end_src
** Minibuffer history completion
** [[https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00802.html][Minibuffer history completion]]
:PROPERTIES:
:CUSTOM_ID: sec:minibuffer-history-completion
:END:
@ -668,7 +668,7 @@ previous input in the minibuffer. Listing
(define-key minibuffer-local-map (kbd "C-<tab>") 'minibuffer-complete-history)
#+end_src
** Prefix key-binding help
** [[https://github.com/justbur/emacs-which-key#readme][Prefix key-binding help]]
:PROPERTIES:
:CUSTOM_ID: sec:prefix-key-binding-help
:END:
@ -1131,11 +1131,13 @@ this document to =html= and LaTeX correctly.
(message "Replaced %d keywords" count)))))
#+end_src
*** Evaluate specific source blocks at load-time
*** [[https://lists.gnu.org/archive/html/emacs-orgmode/2016-07/msg00394.html][Evaluate specific source blocks at load-time]]
:PROPERTIES:
:CUSTOM_ID: sec:load-time-specific-source-block-evaluation
:END:
[[https://emacs.stackexchange.com/questions/12938/how-can-i-evaluate-elisp-in-an-orgmode-file-when-it-is-opened][How to do load time source block evaluation]]
#+caption[Evaluate specific source blocks at load-time]:
#+caption: Evaluate specific source blocks at load-time.
#+name: lst:load-time-specific-source-block-evaluation
@ -1215,7 +1217,8 @@ new [[info:org#Editing Source Code][<LANGUAGE>-modes]]: =latex-header= and =late
The old way is to use a special export attribute as in the function
=org-latex-header-blocks-filter= in [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra.el][ox-extra.el]]. Apparently, nobody is using
this broken function (broken, since it relies on support only in org-mode before
=2014-11-11=). Listing [[lst:org-latex-header-blocks-filter]] proposes a fix.
=2014-11-11=). Listing [[lst:org-latex-header-blocks-filter]] proposes a fix for
=org-latex-header-blocks-filter=.
#+caption[Convert marked LaTeX export blocks to LaTeX header lines]:
#+caption: Convert marked LaTeX export blocks to LaTeX header lines.
@ -1263,97 +1266,31 @@ this broken function (broken, since it relies on support only in org-mode before
(reverse blocks))))))
#+end_src
*** [[info:org#LaTeX specific export settings][Advanced LaTeX export settings]]
:PROPERTIES:
:CUSTOM_ID: sec:advanced-latex-export-settings
:END:
[[https://emacs.stackexchange.com/questions/47347/customizing-org-latex-title-command-to-edit-title-page][How to customize =org-latex-title-command= only in this buffer]]
#+caption[Define =my-ox-latex-export-buffer-local-variables=]:
#+caption: Define =my-ox-latex-export-buffer-local-variables=.
#+name: lst:emacs-lisp-setup-defun
#+begin_src emacs-lisp :results silent
(defun my-ox-latex-export-buffer-local-variables (title-page)
(with-eval-after-load 'ox
(make-variable-buffer-local 'org-export-before-parsing-hook)
(cl-pushnew #'org-latex-header-blocks-filter
org-export-before-parsing-hook))
(when (require 'ox-latex nil 'noerror)
(make-variable-buffer-local 'org-latex-classes)
(cl-pushnew '("article-local"
"\\documentclass[11pt]{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
org-latex-classes :key #'car :test #'equal)
(make-variable-buffer-local 'org-latex-title-command)
(setq org-latex-title-command (concat title-page))
(make-variable-buffer-local 'org-latex-toc-command)
(setq org-latex-toc-command
(mapconcat 'identity '(""
"\\tableofcontents\\label{toc}"
"\\listoffigures"
"\\listoflistings"
"\\listoftables"
"\\newpage"
"") "\n"))
(make-variable-buffer-local 'org-latex-subtitle-format)
(setq org-latex-subtitle-format "")))
#+end_src
Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
=org-export-before-parsing-hook=, =org-latex-classes=,
=org-latex-title-command=, =org-latex-toc-command=, and
=org-latex-subtitle-format=.
#+caption[Call =my-ox-latex-export-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 :tangle no
(my-ox-latex-export-buffer-local-variables title-page)
#+end_src
#+caption[Show a title-page example for =org-latex-title-command=]:
#+caption: Show a title-page example for =org-latex-title-command=.
#+name: lst/title-page
#+begin_src latex :exports code :results silent :tangle no
\begin{titlepage}
%% https://tex.stackexchange.com/questions/506102/
%% adding-header-and-footer-to-custom-titlepage
\thispagestyle{titlepage}
\begin{center}
%% Title
\begin{Huge}
{\bf %t} \\
\vspace{1em}
\end{Huge}
%% Author
\begin{Large}
{\bf %a} \\
\vspace{1em}
\end{Large}
\end{center}
\end{titlepage}
#+end_src
This file uses the new way, while keeping the old way for backwards
compatibility, because the new way feels less hackish than the old way. A
practical difference is that new way source blocks (contrary to old way export
blocks) do not work in [[info:org#Export Settings][#+SETUPFILE: <FILE>]], but only in [[info:org#Export Settings][#+INCLUDE: <FILE>]] files.
*** [[info:org#Export Settings][#+SETUPFILE: and #+INCLUDE: usage]]
:PROPERTIES:
:CUSTOM_ID: sec:setupfile+include-usage
:END:
#+caption[Setup file export keyword settings]:
#+caption: Setup file export keyword settings.
#+name: lst:setup-file-export-keyword-settings
#+caption[Source file export keyword settings]:
#+caption: Source file export keyword settings.
#+name: lst:source-file-export-keyword-settings
#+begin_src org
,#+title: Emacs setup for use with LaTeX, Org, and Python
,#+author: Gerard Vermeulen
,#+latex_class: article
,#+latex_class_options: [11pt,a4paper,english,svgnames,tables]
,#+setupfile: "setup-include.org"
,#+include: "setup-include.org"
#+end_src
#+caption[Setup and include file export keyword settings]:
#+caption: Setup and include file export keyword settings.
#+name: lst:setup-include-export-keyword-settings
#+begin_src org
,#+babel: :cache no
,#+macro: kbd @@html:<kbd>$1</kbd>@@@@latex:\colorbox{PowderBlue}{\texttt{$1}}@@
@ -1498,6 +1435,89 @@ Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
,#+end_src
#+end_src
*** [[info:org#LaTeX specific export settings][Advanced LaTeX export settings]]
:PROPERTIES:
:CUSTOM_ID: sec:advanced-latex-export-settings
:END:
[[https://emacs.stackexchange.com/questions/47347/customizing-org-latex-title-command-to-edit-title-page][How to customize =org-latex-title-command= only in this buffer]]
#+caption[Define =my-ox-latex-export-buffer-local-variables=]:
#+caption: Define =my-ox-latex-export-buffer-local-variables=.
#+name: lst:emacs-lisp-setup-defun
#+begin_src emacs-lisp :results silent
(defun my-ox-latex-export-buffer-local-variables (title-page)
(with-eval-after-load 'ox
(make-variable-buffer-local 'org-export-before-parsing-hook)
(cl-pushnew #'org-latex-header-blocks-filter
org-export-before-parsing-hook))
(when (require 'ox-latex nil 'noerror)
(make-variable-buffer-local 'org-latex-classes)
(cl-pushnew '("article-local"
"\\documentclass[11pt]{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
org-latex-classes :key #'car :test #'equal)
(make-variable-buffer-local 'org-latex-title-command)
(setq org-latex-title-command (concat title-page))
(make-variable-buffer-local 'org-latex-toc-command)
(setq org-latex-toc-command
(mapconcat 'identity '(""
"\\tableofcontents\\label{toc}"
"\\listoffigures"
"\\listoflistings"
"\\listoftables"
"\\newpage"
"") "\n"))
(make-variable-buffer-local 'org-latex-subtitle-format)
(setq org-latex-subtitle-format "")))
#+end_src
Listing [[lst:emacs-lisp-setup-call]] initializes the buffer local variables
=org-export-before-parsing-hook=, =org-latex-classes=,
=org-latex-title-command=, =org-latex-toc-command=, and
=org-latex-subtitle-format=.
#+caption[Call =my-ox-latex-export-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 :tangle no
(my-ox-latex-export-buffer-local-variables title-page)
#+end_src
#+caption[Show a title-page example for =org-latex-title-command=]:
#+caption: Show a title-page example for =org-latex-title-command=.
#+name: lst/title-page
#+begin_src latex :exports code :results silent :tangle no
\begin{titlepage}
%% https://tex.stackexchange.com/questions/506102/
%% adding-header-and-footer-to-custom-titlepage
\thispagestyle{titlepage}
\begin{center}
%% Title
\begin{Huge}
{\bf %t} \\
\vspace{1em}
\end{Huge}
%% Author
\begin{Large}
{\bf %a} \\
\vspace{1em}
\end{Large}
\end{center}
\end{titlepage}
#+end_src
* Editing
** [[https://www.emacswiki.org/emacs/DisabledCommands][Enable disabled commands and inform]]
@ -1888,7 +1908,9 @@ Listing [[lst:configure-info]] adds a path in my home directory to the places wh
Look into:
1. [[https://github.com/douglasdavis/numpydoc.el/blob/main/numpydoc.el][Emacs extension to insert numpy style docstrings in function definitions]]
* Appearance
* [[https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00775.html][Appearance]]
** [[info:emacs#Faces][Text faces (or styles)]]
See the [[https://protesilaos.com/codelog/2020-09-05-emacs-note-mixed-font-heights/][note on mixed font heights in Emacs]] for how to setup fonts properly. It
boils down to two rules:
@ -1958,8 +1980,10 @@ colors of the default face on all frames.
(invert-face 'default)))
#+end_src
Listing [[lst:enable-rainbow-mode]] enables =rainbow-mode= to colorize color names
in buffers for debugging.
** [[https://jblevins.org/log/rainbow-mode][Visualize color codes and names]]
Listing [[lst:enable-rainbow-mode]] enables =rainbow-mode= to colorize color codes
and names in buffers for debugging.
#+caption[Enable =rainbow-mode=]:
#+caption: Enable =rainbow-mode=.
@ -1979,6 +2003,8 @@ in buffers for debugging.
(rainbow-mode +1))
#+end_src
** [[info:emacs#Custom Themes][Custom Themes (info)]]
This setup prefers the ~leuven~ and ~leuven-dark~ themes because the
~modus-operandi~ and ~modus-vivendi~ themes feel quirky: for instance those
themes fail to display ~hl-line-mode~ properly with Emacs-27.2 on Darwin.
@ -2028,6 +2054,8 @@ themes fail to display ~hl-line-mode~ properly with Emacs-27.2 on Darwin.
(add-hook hook #'my-leuven-hook-function)))
#+end_src
** [[https://karthinks.com/software/batteries-included-with-emacs/][Flash the line around point for visual feedback]]
#+caption[Implement =my-pulse-one-line=]:
#+caption: Implement =my-pulse-one-line=.
#+name: lst:my-pulse-one-line