Silence the results of all Emacs Lisp source blocks explicitly

This commit is contained in:
Gerard Vermeulen 2023-02-07 07:10:26 +01:00
parent 1263846aa2
commit 923a090223

View File

@ -164,7 +164,7 @@ Try to load [[https://github.com/emacscollective/no-littering][no-littering]] as
#+caption[Tangle the early-init-file]:
#+caption: Tangle the early-init-file.
#+name: lst:tangle-early-init-file
#+begin_src emacs-lisp -n :tangle early-init.el
#+begin_src emacs-lisp -n :results silent :tangle early-init.el
;;; early-init.el --- user early-init file -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
@ -210,7 +210,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf
#+caption[Set the first set of Emacs options]:
#+caption: Set the first set of Emacs options.
#+name: lst:1st-setopt-call
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;;; init.el --- user init file -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:
@ -264,7 +264,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf
#+caption[Set the second set of Emacs options]:
#+caption: Set the second set of Emacs options.
#+name: lst:2nd-setopt-call
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(setopt
;; See https://github.com/melpa/melpa#mirrors for official Melpa mirrors.
;; ("melpa" . "https://www.mirrorservice.org/sites/melpa.org/packages/")
@ -324,7 +324,7 @@ the contents of packages and allows to update packages to the latest version.
#+caption[Install the selected packages]:
#+caption: Install the selected packages.
#+name: lst:install-selected-packages
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(unless noninteractive
(unless (require 'no-littering nil 'noerror)
(unless (bound-and-true-p package-archive-contents)
@ -367,7 +367,7 @@ the contents of packages and allows to update packages to the latest version.
#+caption[Setup Emacs Tree-sitter]:
#+caption: Setup Emacs Tree-sitter.
#+name: lst:setup-emacs-tree-sitter
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (require 'treesit nil 'noerror)
(setopt
treesit-language-source-alist
@ -431,7 +431,7 @@ theming:
#+caption[Configure =face-attributes=]:
#+caption: Configure =face-attributes=.
#+name: lst:configure-face-attributes
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Set face attributes.
(cond
@ -452,7 +452,7 @@ theming:
#+caption[Implement =set-default-face-height=]:
#+caption: Implement =set-default-face-height=.
#+name: lst:set-default-face-height
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun set-default-face-height ()
"Set the default face height in all current and future frames.
@ -472,7 +472,7 @@ Scale all other faces with a height that is a real number."
#+caption[Use =buffer-face-mode= to set fixed or variable pitch face]:
#+caption: Use =buffer-face-mode= to set fixed or variable pitch face.
#+name: lst:use-buffer-face-mode-for-fixed-or-variable-pitch-face
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; Use proportional font faces in current buffer
(defun set-buffer-variable-pitch-face ()
"Set a variable width (proportional) font in current buffer."
@ -494,7 +494,7 @@ Scale all other faces with a height that is a real number."
#+caption[Fix a `gtk' color and implement =invert-default-face=]:
#+caption: Fix a `gtk' color and implement =invert-default-face=.
#+name: lst:fix-gtk-color-for-invert-default-face
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun fix-gtk-region-face-background-color ()
(when (featurep 'gtk)
@ -516,7 +516,7 @@ Scale all other faces with a height that is a real number."
#+caption[Shadow Org font-lock faces to improve the readability]:
#+caption: Shadow Org font-lock faces to improve the readability.
#+name: lst:shadow-org-font-lock-faces
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Shadow two definitions in org-faces.el:
(defface org-block
@ -557,7 +557,7 @@ verse and quote blocks are fontified using the `org-verse' and
#+caption[Shadow Emacs font-lock faces to improve the readability]:
#+caption: Shadow Emacs font-lock faces to improve the readability.
#+name: lst:shadow-emacs-font-lock-faces
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Shadow one definition in sh-script.el:
(defface sh-heredoc
@ -582,7 +582,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Window management functions and key bindings]:
#+caption: Window management functions and key bindings.
#+name: lst:1st-window-management
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
(defun split-root-below (arg)
@ -618,7 +618,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Window management modes]:
#+caption: Window management modes.
#+name: lst:2nd-window-management
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(winner-mode +1))
#+end_src
@ -626,7 +626,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Window management variables]:
#+caption: Window management variables.
#+name: lst:3rd-window-management
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
(when (version< "29.0.0" emacs-version)
@ -663,7 +663,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Toggle any advice]:
#+caption: Toggle any advice.
#+name: lst:toggle-any-advice
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun advice-toggle (symbol where function &optional props)
"Toggle between states after `advice-remove' and `advice-add'."
@ -679,7 +679,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations.
#+caption[Toggle specific advice]:
#+caption: Toggle specific advice.
#+name: lst:toggle-specific-advice
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun toggle-eww-display-pdf-around ()
"Toggle `eww-display-advice' advice."
@ -740,7 +740,7 @@ extension.
#+caption[Set =dired= options]:
#+caption: Set =dired= options.
#+name: lst:set-dired-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'dired
(setopt dired-dwim-target t
;; | switch | action |
@ -774,7 +774,7 @@ by experienced Emacs users.
#+caption[Extra =dired= key bindings]:
#+caption: Extra =dired= key bindings.
#+name: lst:extra-dired-key-bindings
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'dired
(defun dired-eww-open-file ()
"In Dired, open the regular file named on this line with eww"
@ -827,7 +827,7 @@ minibuffer completion]].
#+caption[Set =minibuffer= options]:
#+caption: Set =minibuffer= options.
#+name: lst:set-minibuffer-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (require 'minibuffer nil 'noerror)
;; https://www.masteringemacs.org/article/understanding-minibuffer-completion
(setopt
@ -848,7 +848,7 @@ output to =stdout=.
#+caption[Process utilities]:
#+caption: Process utilities.
#+name: lst:process-utilities
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; https://gitlab.com/howardabrams/spacemacs.d/blob/master/layers/ha-org/funcs.el#L418
(defun shell-command-with-exit-code (program &rest args)
"Run PROGRAM with ARGS and return exit-code and output in a list."
@ -881,7 +881,7 @@ or {{{kbd(C-h v)}}}.
| info | help-map | {{{kbd(C-h i)}}} |
|------------------------------+----------+------------------|
#+begin_src emacs-lisp -n :tangle no
#+begin_src emacs-lisp -n :results silent :tangle no
(defun org-key-binding-macro (cmd)
(let* ((sym (intern-soft cmd))
(keys (and (commandp sym) (where-is-internal sym nil 'first-only)))
@ -905,7 +905,7 @@ defined in this Org file.
#+caption[Configure =shortdoc=]:
#+caption: Configure =shortdoc=.
#+name: lst:configure-shortdoc
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp 'shortdoc-display-group)
(define-key help-map (kbd "y") #'shortdoc-display-group)
(with-eval-after-load 'shortdoc
@ -958,7 +958,7 @@ looks for files.
#+caption[Configure =info=]:
#+caption: Configure =info=.
#+name: lst:configure-info
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'info
;; Make Emacs find ALL "*.info" files in `package-user-dir' on Gentoo Linux.
(when (eq system-type 'gnu/linux)
@ -1008,7 +1008,7 @@ users from shooting themselves in the feet. Listing
#+caption[Configure the =disabled-command-function=]:
#+caption: Configure the =disabled-command-function=.
#+name: lst:configure-disabled-command-function
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(setq disabled-command-function
(defun enable-this-command (&rest _args)
@ -1029,7 +1029,7 @@ Enable it and re-execute it."
#+caption[Configure =interaction-log=]:
#+caption: Configure =interaction-log=.
#+name: lst:configure-interaction-log
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'interaction-log)
(require 'interaction-log nil 'noerror))
@ -1056,7 +1056,7 @@ Listing [[lst:configure-keycast]] configures =keycast=.
#+caption[Configure =keycast=]:
#+caption: Configure =keycast=.
#+name: lst:configure-keycast
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; Make `keycast-log-update-buffer' use a buffer similar to the
;; control buffer `ediff-setup-windows-plain' returns.
(when (and (ensure-package-installation 'keycast)
@ -1108,7 +1108,7 @@ The code in listing [[lst:start-emacs-server]] starts the Emacs server.
#+caption[Start the Emacs server]:
#+caption: Start the Emacs server.
#+name: lst:start-emacs-server
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when window-system
(unless (or noninteractive (daemonp))
(add-hook 'after-init-hook #'server-start)))
@ -1206,7 +1206,7 @@ execvp("emacsclient", ("-n", payload))
#+caption[Ensure =applescript-mode= installation]:
#+caption: Ensure =applescript-mode= installation.
#+name: lst:ensure-applescript-mode-installation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'applescript-mode))
#+end_src
@ -1265,7 +1265,7 @@ ensures its installation.
#+caption[Ensure =company= installation]:
#+caption: Ensure =company= installation.
#+name: lst:ensure-company-installation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(ensure-package-installation 'company)
#+end_src
@ -1282,7 +1282,7 @@ file.
#+caption[Enable =savehist-mode= and =vertico-mode=]:
#+caption: Enable =savehist-mode= and =vertico-mode=.
#+name: lst:enable-vertico-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (require 'savehist nil 'noerror)
(setopt savehist-additional-variables '(eww-history
kill-ring
@ -1338,7 +1338,7 @@ file.
#+caption[Configure =orderless=]:
#+caption: Configure =orderless=.
#+name: lst:configure-orderless
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'marginalia)
(with-eval-after-load 'orderless
(setopt orderless-component-separator " +")
@ -1373,7 +1373,7 @@ Listing [[lst:bind-embark-commands][bind =embark= commands]] binds =embark= comm
#+caption[Bind =embark= commands globally]:
#+caption: Bind =embark= commands globally.
#+name: lst:bind-embark-commands
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'embark 'embark-consult)
(when (fboundp 'embark-act)
(global-set-key (kbd "C-,") #'embark-act))
@ -1395,7 +1395,7 @@ Listing [[lst:enable-marginalia-mode]] enables =marginalia-mode=.
#+caption[Enable =marginalia-mode=]:
#+caption: Enable =marginalia-mode=.
#+name: lst:enable-marginalia-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'marginalia)
(fboundp 'marginalia-mode))
(marginalia-mode +1))
@ -1460,7 +1460,7 @@ completion function [[info:elisp#Minibuffer Completion][completing-read]]. List
#+caption[Bind =consult= commands]:
#+caption: Bind =consult= commands.
#+name: lst:bind-consult-commands
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'consult)
;; C-c bindings (current-global-map)
(global-set-key (kbd "C-c h") #'consult-history)
@ -1501,7 +1501,7 @@ Listing [[lst:setup-company]] configures =company=.
#+caption[Setup =company=]:
#+caption: Setup =company=.
#+name: lst:setup-company
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp 'company-mode)
;; https://github.com/purcell/emacs.d/issues/778
(setopt company-transformers '(company-sort-by-occurrence))
@ -1564,7 +1564,7 @@ the current [[https://en.wikipedia.org/wiki/Version_control][VCS]] directory tre
#+caption[Bind =deadgrep= commands]:
#+caption: Bind =deadgrep= commands.
#+name: lst:bind-deadgrep-commands
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'deadgrep)
(fboundp 'deadgrep))
(define-key search-map (kbd "d") #'deadgrep)
@ -1585,7 +1585,7 @@ implementation of the suggestions on those pages.
#+caption[Set =grep= and =xref= options to use =ugrep= when available]:
#+caption: Set =grep= and =xref= options to use =ugrep= when available.
#+name: lst:set-grep+xref-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (executable-find "ugrep")
(with-eval-after-load 'grep
(setopt grep-template (string-join '("ugrep"
@ -1621,7 +1621,7 @@ regexp strings.
#+caption[Ensure =xr= installation]:
#+caption: Ensure =xr= installation.
#+name: lst:ensure-xr-installation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'xr))
#+end_src
@ -1644,7 +1644,7 @@ single frame and to make all text visible prior to ediffing Org buffers.
#+caption[Setup =ediff=]:
#+caption: Setup =ediff=.
#+name: lst:setup-ediff
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(setopt ediff-merge-split-window-function #'split-window-horizontally
ediff-split-window-function #'split-window-horizontally
@ -1740,7 +1740,7 @@ snippet [[lst:ensure-magit-installation][below]] ensures its installation.
#+caption[Ensure =Magit= installation]:
#+caption: Ensure =Magit= installation
#+name: lst:ensure-magit-installation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(ensure-package-installation 'magit)
#+end_src
@ -1770,7 +1770,7 @@ Listing [[lst:configure-nov]] configures [[https://depp.brause.cc/nov.el/][nov.e
#+caption[Configure =nov=]:
#+caption: Configure =nov=.
#+name: lst:configure-nov
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'nov)
(fboundp 'nov-mode))
(add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode)))
@ -1793,7 +1793,7 @@ rebuild the =epdfinfo= executable that serves the [[https://en.wikipedia.org/wik
#+caption[Setup =pdf-tools=]:
#+caption: Setup =pdf-tools=.
#+name: lst:setup-pdf-tools
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'pdf-tools 'saveplace-pdf-view)
(fboundp 'pdf-loader-install))
;; `pdf-loader-install' is the lazy equivalent of `pdf-tools-install':
@ -1844,7 +1844,7 @@ configuration objectives:
#+caption[Ensure =AUCTeX= installation and set =TeX= option]:
#+caption: Ensure =AUCTeX= installation and set =TeX= option.
#+name: lst:set-tex-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'auctex)
;; Use `require' to make `TeX-master' a safe local variable.
(when (require 'tex nil 'noerror)
@ -1862,7 +1862,7 @@ configuration objectives:
#+caption[Update the =LuaLaTeX OpenType Font= name database]:
#+caption: Update the =LuaLaTeX= =OpenType Font= name database.
#+name: lst:update-lualatex-opentype-font-name-database
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun update-lualatex-opentype-font-name-database ()
"Update the \"OpenType Font\" name database for \"LuaLaTeX\"."
@ -1878,7 +1878,7 @@ configuration objectives:
#+caption[Set =bibtex= options]:
#+caption: Set =bibtex= options.
#+name: lst:set-bibtex-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'bibtex
(setopt bibtex-dialect 'BibTeX))
#+end_src
@ -1886,7 +1886,7 @@ configuration objectives:
#+caption[Set =font-latex= options]:
#+caption: Set =font-latex= options.
#+name: lst:set-font-latex-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'font-latex
(setopt font-latex-fontify-sectioning 1.0))
#+end_src
@ -1894,7 +1894,7 @@ configuration objectives:
#+caption[Set =latex= options]:
#+caption: Set =latex= options.
#+name: lst:set-latex-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'latex
(setopt LaTeX-electric-left-right-brace t
LaTeX-section-hook '(LaTeX-section-heading
@ -1915,7 +1915,7 @@ buffers with help of an external [[https://nodejs.org][node.js]] program.
#+caption[Setup =math-preview=]:
#+caption: Setup =math-preview=.
#+name: lst:setup-math-preview
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'math-preview)
(with-eval-after-load 'math-preview
;; https://docs.mathjax.org/en/latest/input/tex/extensions/physics.html
@ -1980,7 +1980,7 @@ zeromatrix zmat")))
#+caption[Configure =markdown-mode=]:
#+caption: Configure =markdown-mode=.
#+name: lst:configure-markdown-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'markdown-mode))
#+end_src
@ -2000,7 +2000,7 @@ of the [[info:org#Top][Org (info)]] manual.
#+caption[Bind =Org= commands globally]:
#+caption: Bind =Org= commands globally.
#+name: lst:bind-org-commands
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(global-set-key (kbd "C-c a") #'org-agenda)
(global-set-key (kbd "C-c c") #'org-capture)
@ -2041,7 +2041,7 @@ list detailing and motivating each listing:
#+caption[Set basic =Org= options]:
#+caption: Set basic =Org= options.
#+name: lst:set-org-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'org
(setopt
org-babel-load-languages
@ -2091,7 +2091,7 @@ list detailing and motivating each listing:
#+caption[Setup =org-babel=]:
#+caption: Setup =org-babel=.
#+name: lst:setup-org-babel
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ob-core
(setopt org-confirm-babel-evaluate nil))
@ -2145,7 +2145,7 @@ unbind the `org-babel' interface functions when ACTIVE is nil."
#+caption[Set =org-link= options]:
#+caption: Set =org-link= options.
#+name: lst:set-org-link-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ol
(setopt org-link-file-path-type 'relative))
#+end_src
@ -2153,7 +2153,7 @@ unbind the `org-babel' interface functions when ACTIVE is nil."
#+caption[Setup =org-mode-map=]:
#+caption: Setup =org-mode-map=.
#+name: lst:setup-org-mode-map
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; From: "Nicolas Richard" <theonewiththeevillook@yahoo.fr>
;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview]
@ -2200,7 +2200,7 @@ When called twice, replace the previously inserted \\(\\) by one $."
#+caption[Setup =org-src=]:
#+caption: Setup =org-src=.
#+name: lst:setup-org-src
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(with-eval-after-load 'org-src
(setopt org-src-preserve-indentation t))
@ -2229,7 +2229,7 @@ When called twice, replace the previously inserted \\(\\) by one $."
#+caption[Setup =ob-python=]:
#+caption: Setup =ob-python=.
#+name: lst:setup-ob-python
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ob-python
(defun org-babel-python-format-session-value-override
(src-file result-file result-params)
@ -2268,7 +2268,7 @@ else:
#+caption[Set =org-export= options]:
#+caption: Set =org-export= options.
#+name: lst:set-org-export-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ox
(setopt org-export-dispatch-use-expert-ui t))
#+end_src
@ -2276,7 +2276,7 @@ else:
#+caption[Setup =org= for export to LuaLaTeX]:
#+caption: Setup =org= for export to LuaLaTeX.
#+name: lst:setup-org-for-lualatex-export
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'org
;; https://list.orgmode.org/87o84fd4oi.fsf@posteo.net/
(add-to-list
@ -2311,7 +2311,7 @@ else:
#+caption[Set =ox-latex= options for export to LuaLaTeX]:
#+caption: Set =ox-latex= options for export to LuaLaTeX.
#+name: lst:set-ox-latex-options-for-lualatex-export
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ox-latex
(setopt
org-latex-compiler "lualatex"
@ -2353,7 +2353,7 @@ else:
#+caption[Setup =org-latex-classes= for backwards compatibility]:
#+caption: Setup =org-latex-classes= for backwards compatibility.
#+name: lst:setup-org-latex-classes
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ox-latex
(mapc (function (lambda (element)
(add-to-list 'org-latex-classes element)))
@ -2492,7 +2492,7 @@ valid directories and files. In an [[https://orgmode.org/][Org-mode]] buffer th
#+caption[Delete =Biber= cache when =Biber= fails to make a bibliography]:
#+caption: Delete =Biber= cache when =Biber= fails to make a bibliography.
#+name: lst:delete-biber-cache
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://tex.stackexchange.com/a/579356 answers
;; "How to solve Biber exiting with error code 2 but no error messages?"
@ -2573,7 +2573,7 @@ environment and an unbreakable Code (floating) environment."
#+caption[Smart LaTeX engraving of =org-src-mode= blocks]:
#+caption: Smart LaTeX engraving of =org-src-mode= blocks.
#+name: lst:smart-latex-engrave-org-source-blocks
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun smart-latex-engrave-org-source-blocks ()
"Enable smart LaTeX engraving of `org-src-mode' blocks.
@ -2624,7 +2624,7 @@ environments and non-floating breakable LaTeX environments by means of
#+caption[Emacs setup to use =engrave-faces-latex= in =org-mode= smartly]:
#+caption: Emacs setup to use =engrave-faces-latex= in =org-mode= smartly.
#+name: lst:ox-engraved-emacs-lisp-setup
#+begin_src emacs-lisp -n :tangle no
#+begin_src emacs-lisp -n :results silent :tangle no
(with-eval-after-load 'ox
(make-variable-buffer-local 'org-export-filter-src-block-functions)
(add-to-list 'org-export-filter-src-block-functions
@ -2653,7 +2653,7 @@ The listings below implement or reimplement three groups of =org-link= types:
#+caption[Define =org-link= types for backwards compatibility with =org-ref=]:
#+caption: Define =org-link= types for backwards compatibility with =org-ref=.
#+name: lst:org-ref-like-org-link-types
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ol
(org-link-set-parameters "ac*" :export #'org-ref-ac*-export)
(org-link-set-parameters "cite" :export #'org-ref-cite-export)
@ -2696,7 +2696,7 @@ The listings below implement or reimplement three groups of =org-link= types:
#+caption[Define an =org-link= type for =pdf-tools=]:
#+caption: Define an =org-link= type for =pdf-tools=.
#+name: lst:define-org-pdfview-link-type
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ol
(autoload 'pdf-view-goto-page "pdf-view" nil t)
(org-link-set-parameters "pdfview"
@ -2846,7 +2846,7 @@ The following posts provide programming information:
#+caption[Parsing function for the =org-yt= link type]:
#+caption: Parsing function for the =org-yt= link type.
#+name: lst:org-yt-parsing
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun org-yt-time-to-seconds (text)
"Convert TEXT of the form `12:34:56' or `12h34m56s' to seconds as integers."
(let* ((case-fold-search t)
@ -2892,7 +2892,7 @@ The following posts provide programming information:
#+caption[Formatting functions to open =org-yt= links]:
#+caption: Formatting functions to open =org-yt= links.
#+name: lst:org-yt-open-formatting
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun org-yt-seconds-to-hms (seconds)
"Convert seconds as integers to text of the form `12h34m56s'."
(let ((h (/ seconds 3600))
@ -2931,7 +2931,7 @@ The following posts provide programming information:
#+caption[Formatting function for HTML export of =org-yt= links]:
#+caption: Formatting function for HTML export of =org-yt= links.
#+name: lst:org-yt-html-export-formatting
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defconst org-yt-iframe
"<iframe
frameborder=\"0\" width=\"600\" height=\"450\"
@ -2957,7 +2957,7 @@ The following posts provide programming information:
#+caption[Define an =org-link= type for =YouTube=]:
#+caption: Define an =org-link= type for =YouTube=.
#+name: lst:define-org-yt-link-type
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun org-yt-open (path prefix)
"Open an \"yt\" type link with `browse-url', `emms', or \"mpv\".
PATH is a string containing the video ID and optional timing information.
@ -3010,7 +3010,7 @@ Open the link with `browse-url' if PREFIX else with `emms' or \"mpv\"."
#+caption[Convert upper to lower case keywords]:
#+caption: Convert upper to lower case keywords.
#+name: lst:convert-upper-to-lower-case-keywords
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://tecosaur.github.io/emacs-config/#translate-capital-keywords
(defun org-syntax-convert-keyword-case-to-lower ()
@ -3038,7 +3038,7 @@ Open the link with `browse-url' if PREFIX else with `emms' or \"mpv\"."
#+caption[Evaluate specific source blocks at load-time]:
#+caption: Evaluate specific source blocks at load-time.
#+name: lst:load-time-specific-source-block-evaluation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun org-eval-named-blocks-with-infix (infix)
"Evaluate all source blocks having INFIX in their name."
@ -3136,7 +3136,7 @@ this broken function (broken, since it relies on support only in org-mode before
#+caption[Convert marked LaTeX export blocks to LaTeX header lines]:
#+caption: Convert marked LaTeX export blocks to LaTeX header lines.
#+name: lst:org-latex-header-blocks-filter
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ox
(defun org-latex-header-blocks-filter (backend)
"Convert marked LaTeX export blocks to \"#+latex_header: \" lines.
@ -3201,7 +3201,7 @@ define the [[https://orgmode.org/][Org mode]] =kbd= macro in listing
#+caption[Define Emacs Lisp utilities to define the =Org-mode= =kbd= macro]:
#+caption: Define Emacs Lisp utilities to define the =Org-mode= =kbd= macro.
#+name: lst:by-backend-kbd-org-macro
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(when (ensure-package-installation 'htmlize)
(autoload 'htmlize-protect-string "htmlize" nil t))
@ -3525,7 +3525,7 @@ non-interactive =org-element= functions to an =Emacs-lisp= buffer.
#+caption[Grok how =org-element= parses your document]:
#+caption: Grok how =org-element= parses your document.
#+name: lst:grok-org-element-tree
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'org-element
(when (require 'pp nil 'noerror)
(defconst grok-org-output
@ -3584,7 +3584,7 @@ abbreviation definitions in this file by means of:
#+caption[Definition of the =misspellings-abbrev= keyboard macro]:
#+caption: Definition of the =misspellings-abbrev= keyboard macro.
#+name: lst:misspellings-abbrev
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun browse-common-misspellings ()
"Open the Wikipedia page of common misspellings for machines in EWW."
@ -3605,7 +3605,7 @@ Listing [[lst:word-games]] defines the =anagram-p= function that migth be used g
#+caption[Word games]:
#+caption: Word games.
#+name: lst:word-games
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; https://funcall.blogspot.com/2022/07/lets-play-wordle.html
;; https://github.com/tabatkins/wordle-list
(defun anagram-p (evil vile)
@ -3717,7 +3717,7 @@ etymology, or thesaurus back-ends (currently limited to [[https://en.wikipedia.o
#+caption[Configure =lexic=]:
#+caption: Configure =lexic=.
#+name: lst:configure-lexic
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'lexic)
;; http://download.huzheng.org/fr/
;; https://polyglotte.tuxfamily.org/doku.php?id=donnees:dicos_bilingues
@ -3747,7 +3747,7 @@ the [[https://github.com/gromnitsky/wordnut#readme][wordnut]] prerequisites.
#+caption[System check for =wordnut=]:
#+caption: System check for =wordnut=.
#+name: lst:check-wordnut
#+begin_src emacs-lisp -n :tangle no
#+begin_src emacs-lisp -n :results silent :tangle no
(when (ensure-package-installation 'wordnut)
(with-eval-after-load 'wordnut
(if-let ((wn (executable-find "wn")))
@ -3767,7 +3767,7 @@ Listing [[lst:configure-writegood-mode]] configures [[https://github.com/bnbeckw
#+caption[Configure =writegood-mode=]:
#+caption: Configure =writegood-mode=.
#+name: lst:configure-writegood-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'writegood-mode)
(fboundp 'writegood-mode))
(global-set-key (kbd "C-c g") #'writegood-mode))
@ -3808,7 +3808,7 @@ configuration:
#+caption[Ensure =eglot= installation with minimal setup]:
#+caption: Ensure =eglot= installation with minimal setup.
#+name: lst:minimal-eglot-setup
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Replace `nil' with `t' for debugging.
(when nil
@ -3828,7 +3828,7 @@ configuration:
#+caption[Help to setup any =org-src-mode= buffers for =eglot=]:
#+caption: Help to setup any =org-src-mode= buffers for =eglot=.
#+name: lst:help-setup-org-src-mode-for-eglot
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defcustom eglot-maybe-ensure-modes '(python-mode)
"Modes where maybe `eglot-ensure' should be or has been called.
@ -3873,7 +3873,7 @@ the Org-mode source block code before calling `eglot-ensure'."
#+caption[Setup Python =org-src-mode= buffers for =eglot=]:
#+caption: Setup Python =org-src-mode= buffers for =eglot=.
#+name: lst:setup-python-org-src-mode-for-eglot
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; https://www.reddit.com/r/emacs/comments/w4f4u3
;; /using_rustic_eglot_and_orgbabel_for_literate/
@ -3903,7 +3903,7 @@ This is to advice `org-edit-src-exit' and `org-edit-src-save'."
#+caption[Experimental =narrow-format-all:python=]:
#+caption: Experimental =narrow-format-all:python=.
#+name: lst:narrow-format-all-python
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp 'format-all-buffer)
(defun narrow-format-all:python ()
"Format narrowed Python `org-src-mode' buffers correctly.
@ -3936,7 +3936,7 @@ prepared buffers."
#+caption[Start =eglot= in case of a proper =dir-local-variables-alist=]:
#+caption: Start =eglot= in case of a proper =dir-local-variables-alist=.
#+name: lst:eglot-maybe-ensure
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(defun eglot-maybe-ensure ()
(when (and (apply #'derived-mode-p eglot-maybe-ensure-modes)
@ -3963,7 +3963,7 @@ Listing [[lst:configure-format-all]]:
#+caption[Configure =format-all=]:
#+caption: Configure =format-all=.
#+name: lst:configure-format-all
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; https://github.com/lassik/emacs-format-all-the-code#readme
;; https://ianyepan.github.io/posts/format-all/
;; https://jamesaimonetti.com/posts/formatting-tangled-output-in-org-mode/
@ -4017,7 +4017,7 @@ Listing [[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://ww
#+caption[Configure =sly=]:
#+caption: Configure =sly=.
#+name: lst:configure-sly
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'sly)
(with-eval-after-load 'sly
;; Set `sly-default-lisp' instead of `inferior-lisp-program',
@ -4156,7 +4156,7 @@ src_emacs-lisp{(describe-function 'inferior-emacs-lisp-mode)}.
#+caption[Setup =ielm=]:
#+caption: Setup =ielm=.
#+name: lst:setup-ielm
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'ielm
(setopt ielm-dynamic-return nil))
#+end_src
@ -4176,7 +4176,7 @@ install and use [[https://gitlab.com/andreyorst/ob-fennel][ob-fennel]] with the
#+caption[Install =fennel-mode= and =ob-fennel= when =fennel= is an executable]:
#+caption: Install =fennel-mode= and =ob-fennel= when =fennel= is an executable.
#+name: lst:install-ob-fennel-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (executable-find "fennel")
(ensure-package-installation 'fennel-mode))
(unless (package-installed-p 'ob-fennel)
@ -4212,7 +4212,7 @@ luarocks \
#+caption[Install =lua-mode= in case of =Lua=]:
#+caption: Install =lua-mode= in case of =Lua=.
#+name: lst:install-lua-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (executable-find "lua")
(ensure-package-installation 'company-lua 'lua-mode)))
#+end_src
@ -4240,7 +4240,7 @@ in [[https://orgmode.org/][Org Mode]].
#+caption[Configure =maxima=]:
#+caption: Configure =maxima=.
#+name: lst:configure-maxima
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'maxima 'company-maxima)
(add-hook 'maxima-mode-hook #'maxima-hook-function)
(add-hook 'maxima-inferior-mode-hook #'maxima-hook-function)
@ -4332,7 +4332,7 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
#+caption[Choose a common Python interpreter]:
#+caption: Choose a common Python interpreter for =ob-python= and =python-mode=.
#+name: lst:choose-common-python-interpreter
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun choose-common-python-interpreter (&optional interpreter)
"Let `ob-python' and `python-mode' use the same Python INTERPRETER."
(interactive)
@ -4377,7 +4377,7 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
#+caption: Choose a common Python linter for =python-check-command= and
#+caption: =python-flymake-command=.
#+name: lst:choose-common-python-linter
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(defun choose-common-python-linter (&optional linter)
"Let `python-check-command' and `python-flymake-command' use the same LINTER."
(interactive)
@ -4408,7 +4408,7 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
#+caption[Setup Python mode]:
#+caption: Setup Python mode.
#+name: lst:setup-python-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'python
(setopt python-indent-guess-indent-offset nil
python-shell-completion-native-disabled-interpreters '("ipython3"
@ -4420,7 +4420,7 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][
#+caption[Access =pyenv=]:
#+caption: Access =pyenv=.
#+name: lst:access-pyenv
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (executable-find "pyenv")
(defun pyenv-full-path (version)
"Return the full path for VERSION."
@ -4466,7 +4466,7 @@ Complete the result with \"system\"."
#+caption[Select the Python virtual environment]:
#+caption: Select the Python virtual environment.
#+name: lst:select-python-virtual-environment
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'python
(when (cl-every #'fboundp '(pyenv-full-path
pyenv-version-name
@ -4632,7 +4632,7 @@ or to increase the verbosity of [[https://github.com/python-lsp/python-lsp-serve
#+caption[Configure =eglot= with =python-lsp-ruff=]:
#+caption: Configure =eglot= with =python-lsp-ruff=.
#+name: lst:configure-eglot+pylsp-ruff
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'eglot
(setq-default
eglot-workspace-configuration
@ -4656,7 +4656,7 @@ or to increase the verbosity of [[https://github.com/python-lsp/python-lsp-serve
#+caption[Configure =eglot= with =python-lsp-server= and the =flake8= plugin]:
#+caption: Configure =eglot= with =python-lsp-server= and the =flake8= plugin.
#+name: lst:configure-eglot+pylsp+flake8
#+begin_src emacs-lisp -n :tangle no
#+begin_src emacs-lisp -n :results silent :tangle no
(with-eval-after-load 'eglot
(setq-default
eglot-workspace-configuration
@ -4685,7 +4685,7 @@ or to increase the verbosity of [[https://github.com/python-lsp/python-lsp-serve
#+caption: A =.dir-locals.el= file proposal for Python projects or Org-mode
#+caption: projects tangling Python files to launch =eglot= automatically.
#+name: lst:eglot-directory-variables-for-python
#+begin_src emacs-lisp -n :tangle dir-locals.el
#+begin_src emacs-lisp -n :results silent :tangle dir-locals.el
;; A .dir-locals.el file proposal in the root of any
;; Python project or Org-mode project tangling Python files
;; to launch eglot automatically.
@ -4769,7 +4769,7 @@ configures =code-cells=.
#+caption[Configure =code-cells=]:
#+caption: Configure =code-cells=.
#+name: lst:configure-code-cells
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'code-cells)
(with-eval-after-load 'code-cells
(let ((map code-cells-mode-map))
@ -4800,7 +4800,7 @@ Emacs setup (for instance [[https://github.com/andras-simonyi/citeproc-el#readme
#+caption[Configure =dash= fontification and info lookup]:
#+caption: Configure =dash= fontification and info lookup.
#+name: lst:configure-dash
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp #'global-dash-fontify-mode)
(global-dash-fontify-mode))
@ -4839,7 +4839,7 @@ setup and requires no configuration.
#+caption[Enable =iedit=]:
#+caption: Enable =iedit=.
#+name: lst:enable-iedit
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'iedit)
(require 'iedit nil 'noerror))
#+end_src
@ -4852,7 +4852,7 @@ setup and requires no configuration.
#+caption[Configure =ws-butler=]:
#+caption: Configure =ws-butler=.
#+name: lst:configure-ws-butler
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'ws-butler)
(require 'ws-butler nil 'noerror))
(setopt ws-butler-keep-whitespace-before-point nil)
@ -4903,7 +4903,7 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][
#+caption[Configure =smartparens=]:
#+caption: Configure =smartparens=.
#+name: lst:configure-smartparens
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'smartparens)
;; Require `smartparens-config' instead of `smartparens' to
;; disable pairing of the quote character for lisp modes.
@ -4949,7 +4949,7 @@ code formatter for Python]].
#+caption[Configure =electric-operator=]:
#+caption: Configure =electric-operator=.
#+name: lst:configure-electric-operator
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'electric-operator)
(fboundp 'electric-operator-mode))
(add-hook 'c-mode-common-hook #'electric-operator-mode)
@ -4964,7 +4964,7 @@ code formatter for Python]].
#+caption[Enable =yas-global-mode=]:
#+caption: Enable =yas-global-mode=.
#+name: lst:enable-yas-global-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'yasnippet)
;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'.
(setopt yas-alias-to-yas/prefix-p nil)
@ -4992,7 +4992,7 @@ and later. Listing [[lst:setup-python-tempo]] configures =tempo= for =python-mo
#+caption[Configure =tempo= user interface]:
#+caption: Configure =tempo= user-interface.
#+name: lst:configure-tempo-ui
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'tempo
(setopt tempo-interactive t)
@ -5019,7 +5019,7 @@ Allows `tempo' expansion by typing <SPC> after a complete `tempo' tag."
#+caption[Configure =tempo= for =latex= with =completing-read=]:
#+caption: Configure =tempo= for =latex= with =completing-read=.
#+name: lst:configure-tempo-latex-completing-read
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'latex
(unless (featurep 'tempo)
(require 'tempo))
@ -5054,7 +5054,7 @@ Allows `tempo' expansion by typing <SPC> after a complete `tempo' tag."
#+caption[Configure =tempo= for =python-mode=]:
#+caption: Configure =tempo= for =python-mode=.
#+name: lst:setup-python-tempo
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'python
(unless (featurep 'tempo)
(require 'tempo))
@ -5113,7 +5113,7 @@ on any Org table, Org source block, Org block, or Org subtree.
#+caption[Configure =narrow-or-widen-dwim=]:
#+caption: Configure =narrow-or-widen-dwim=.
#+name: lst:configure-narrow-or-widen-dwim
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
(declare-function org-at-table-p "org" (&optional table-type))
@ -5168,7 +5168,7 @@ and names in buffers for debugging.
#+caption[Enable =rainbow-mode=]:
#+caption: Enable =rainbow-mode=.
#+name: lst:enable-rainbow-mode
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'rainbow-mode)
(fboundp 'rainbow-mode))
(setopt rainbow-x-colors-major-mode-list '(c++-mode
@ -5194,7 +5194,7 @@ point movements visually.
#+caption[Implement =flash-line-around-point=]:
#+caption: Implement =flash-line-around-point=.
#+name: lst:flash-line-around-point
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
;; Ensure loading `pulse' with the dynamic variables `pulse-delay' and
;; `pulse-iterations' before masking them lexically instead of after
;; to prevent the warning triggered by lazy loading.
@ -5235,7 +5235,7 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
#+caption[Configure =browse-url=]:
#+caption: Configure =browse-url=.
#+name: lst:configure-browse-url
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'browse-url
(defun browse-url-mpv (url &optional _)
(start-process "mpv" nil "mpv" url))
@ -5262,7 +5262,7 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
#+caption[Configure =eww= URLs]:
#+caption: Configure =eww= URLs.
#+name: lst:configure-eww-urls
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp 'eww-browse-url)
(defun eww-subreddit ()
"Read a subreddit in Emacs."
@ -5278,7 +5278,7 @@ Listing [[lst:configure-browse-url]] configures =browse-url=.
#+caption[Rename =eww= buffers and display =pdf= links properly]:
#+caption: Rename =eww= buffers and display =pdf= links properly.
#+name: lst:rename-eww-buffer-display-pdf-links
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'eww
(defun eww-display-pdf-as-binary (fn &rest args)
(let ((buffer-file-coding-system 'binary))
@ -5323,7 +5323,7 @@ Listing [[lst:ensure-hyperbole-installation][ensure Hyperbole installation]] wor
#+caption[Ensure Hyperbole installation]:
#+caption: Ensure Hyperbole installation and address two Hyperbole quirks.
#+name: lst:ensure-hyperbole-installation
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'hyperbole)
(unless (load "kotl-autoloads.el" 'noerror nil nil 'must-suffix)
;; See `package-generate-autoloads' for `loaddefs-generate' usage.
@ -5401,7 +5401,7 @@ sets the =webjump-sites= option.
#+caption[Set =webjump= options and bind the =webjump= command]:
#+caption: Set =webjump= options and bind the =webjump= command.
#+name: lst:set-webjump-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (fboundp 'webjump)
(global-set-key (kbd "C-c j") 'webjump)
(with-eval-after-load 'webjump
@ -5472,7 +5472,7 @@ sets the =webjump-sites= option.
#+caption[Configure =gnus=]:
#+caption: Configure =gnus=.
#+name: lst:configure-gnus
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'gnus
(setopt gnus-select-method '(nntp "news.gmane.io")))
@ -5505,7 +5505,7 @@ sets the =webjump-sites= option.
#+caption[Configure =message=]:
#+caption: Configure =message=.
#+name: lst:configure-message
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(setopt user-full-name "Gerard Vermeulen"
user-mail-address "gerard.vermeulen@posteo.net")
(with-eval-after-load 'message
@ -5515,7 +5515,7 @@ sets the =webjump-sites= option.
#+caption[Configure =sendmail=]:
#+caption: Configure =sendmail=.
#+name: lst:configure-sendmail
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'sendmail
(setopt mail-specify-envelope-from t
mail-envelope-from 'header
@ -5601,7 +5601,7 @@ command, and makes a minimal attempt to enable =emms=.
#+caption[Set =elfeed= options and bind =elfeed= command]:
#+caption: Set =elfeed= options and bind =elfeed= command.
#+name: lst:set-elfeed-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (and (ensure-package-installation 'elfeed)
(fboundp 'elfeed))
(global-set-key (kbd "C-x w") #'elfeed)
@ -5645,7 +5645,7 @@ using =emms= with =elfeed=. Listing [[lst:set-emms-options]] configures =emms=.
#+caption[Set =emms= options]:
#+caption: Set =emms= options.
#+name: lst:set-emms-options
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'emms)
(with-eval-after-load 'emms
(setopt emms-player-list '(emms-player-mpd emms-player-mpv))
@ -5694,7 +5694,7 @@ for technical information.
#+caption[Hiding =*spurious*= buffers]:
#+caption: Hiding =*spurious*= buffers.
#+name: lst:hiding-spurious-buffers
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emms-player-mpd
;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager
;; Hide `*spurious*' buffers, but you can always switch to them:
@ -5744,7 +5744,7 @@ audio_output {
#+caption[Tangle the =user-init-file= footer]:
#+caption: Tangle the =user-init-file= footer.
#+name: lst:tangle-user-init-file-footer
#+begin_src emacs-lisp -n
#+begin_src emacs-lisp -n :results silent
(provide 'init)
;; Emacs looks for "Local variables:" after the last "newline-formfeed".