diff --git a/README.org b/README.org index 5693029..79148c3 100644 --- a/README.org +++ b/README.org @@ -4,7 +4,7 @@ #+latex_class_options: [11pt,a4paper,english,svgnames] #+macro: kbd (eval (by-backend-kbd-org-macro $1)) #+options: ^:{} timestamp:nil -#+property: header-args:emacs-lisp :exports code :tangle init.el +#+property: header-args:emacs-lisp :exports code :results silent :tangle init.el #+startup: showeverything #+begin_src latex :noweb yes :results raw ,#+latex_header: <> @@ -172,7 +172,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 :results silent :tangle early-init.el +#+begin_src emacs-lisp -n :tangle early-init.el ;;; early-init.el --- user early-init file -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: @@ -214,7 +214,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 :results silent +#+begin_src emacs-lisp -n ;;; init.el --- user init file -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: @@ -268,7 +268,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf #+caption[Set the second set of Emacs options: pin packages to archives]: #+caption: Set the second set of Emacs options: pin packages to archives. #+name: lst:2nd-setopt-call -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (eq system-type 'darwin) (setopt ns-alternate-modifier nil ns-command-modifier 'meta @@ -319,7 +319,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf #+caption[Set the third set of Emacs options: upgrade Org and transient]: #+caption: Set the third set of Emacs options: upgrade Org and transient. #+name: lst:3rd-setopt-call -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n ;; Enable `package-install-upgrade-built-in' to upgrade Org and transient. ;; Caveat: works with `list-packages' but not with `package-upgrade-all'. ;; Disable upgrading other packages by pinning them to "nongnu". @@ -353,7 +353,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf #+caption[Handle ~user-emacs-directory~ site-lisp directories as packages]: #+caption: Handle ~user-emacs-directory~ site-lisp directories as packages. #+name: lst:site-lisp-packages -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.emacswiki.org/emacs/LoadPath ;; Make user-emacs-directory site-lisp directories look like packages. @@ -409,7 +409,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 :results silent +#+begin_src emacs-lisp -n (unless noninteractive (unless (require 'no-littering nil 'noerror) (unless (bound-and-true-p package-archive-contents) @@ -452,7 +452,7 @@ languages. Listing [[lst:setup-go][Setup Go programming]] shows how to configur #+caption[Setup =treesit= grammar sources]: #+caption: Setup =treesit= grammar sources. #+name: lst:setup-treesit-sources -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (require 'treesit nil 'noerror) (setopt treesit-language-source-alist @@ -516,7 +516,7 @@ theming: #+caption[Configure =face-attributes=]: #+caption: Configure =face-attributes=. #+name: lst:configure-face-attributes -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Set face attributes. (cond @@ -537,7 +537,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun set-default-face-height () "Set the default face height in all current and future frames. @@ -557,7 +557,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 :results silent +#+begin_src emacs-lisp -n ;; Use proportional font faces in current buffer (defun set-buffer-variable-pitch-face () "Set a variable width (proportional) font in current buffer." @@ -579,7 +579,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun fix-gtk-region-face-background-color () (when (featurep 'gtk) @@ -601,7 +601,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Shadow two definitions in org-faces.el: (defface org-block @@ -644,7 +644,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Shadow one definition in sh-script.el: (defface sh-heredoc @@ -672,7 +672,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager (defun split-root-below (arg) @@ -708,7 +708,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (winner-mode +1)) #+end_src @@ -716,7 +716,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager (add-to-list 'display-buffer-alist @@ -749,7 +749,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun advice-toggle (symbol where function &optional props) "Toggle between states after `advice-remove' and `advice-add'." @@ -765,7 +765,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun toggle-eww-display-pdf-around () "Toggle `eww-display-advice' advice." @@ -808,7 +808,7 @@ to claims in [[info:consult#Top][consult (info)]]). #+caption[Let Emacs save bookmarks when it is killed]: #+caption: Let Emacs save bookmarks when it is killed. #+name: lst:setup-bookmark -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'bookmark (setopt bookmark-save-flag 1) (setf bookmark-exit-hook 'bookmark-unload-function)) @@ -850,7 +850,7 @@ extension. #+caption[Set =dired= options]: #+caption: Set =dired= options. #+name: lst:set-dired-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'dired (setopt dired-dwim-target t ;; | switch | action | @@ -879,7 +879,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'dired (defun dired-eww-open-file () "In Dired, open the regular file named on this line with eww" @@ -932,7 +932,7 @@ minibuffer completion]]. #+caption[Set =minibuffer= options]: #+caption: Set =minibuffer= options. #+name: lst:set-minibuffer-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (require 'minibuffer nil 'noerror) ;; https://www.masteringemacs.org/article/understanding-minibuffer-completion (setopt @@ -953,7 +953,7 @@ output to =stdout=. #+caption[Process utilities]: #+caption: Process utilities. #+name: lst:process-utilities -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n ;; 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." @@ -1010,7 +1010,7 @@ defined in this Org file. #+caption[Configure =shortdoc=]: #+caption: Configure =shortdoc=. #+name: lst:configure-shortdoc -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (fboundp 'shortdoc-display-group) (keymap-set help-map "y" #'shortdoc-display-group) (with-eval-after-load 'shortdoc @@ -1063,7 +1063,7 @@ looks for files. #+caption[Configure =info=]: #+caption: Configure =info=. #+name: lst:configure-info -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'info ;; Make Emacs find ALL "*.info" files in `package-user-dir' on Gentoo Linux. (when (eq system-type 'gnu/linux) @@ -1113,7 +1113,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (setq disabled-command-function (defun enable-this-command (&rest _args) @@ -1134,7 +1134,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'interaction-log) (require 'interaction-log nil 'noerror)) @@ -1160,7 +1160,7 @@ Listing [[lst:configure-keycast]] configures =keycast=. #+caption[Configure =keycast=]: #+caption: Configure =keycast=. #+name: lst:configure-keycast -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n ;; Make `keycast-log-update-buffer' use a buffer similar to the ;; control buffer `ediff-setup-windows-plain' returns. (when (ensure-package-installation 'keycast) @@ -1212,7 +1212,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 :results silent +#+begin_src emacs-lisp -n (when window-system (unless (or noninteractive (daemonp)) (add-hook 'after-init-hook #'server-start))) @@ -1310,7 +1310,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'applescript-mode)) #+end_src @@ -1373,7 +1373,7 @@ histories. #+caption[Enable =savehist-mode= and =vertico-mode=]: #+caption: Enable =savehist-mode= and =vertico-mode=. #+name: lst:enable-vertico-mode -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (require 'savehist nil 'noerror) (setopt savehist-additional-variables '(kill-ring search-ring)) (savehist-mode +1)) @@ -1425,7 +1425,7 @@ histories. #+caption[Configure =orderless=]: #+caption: Configure =orderless=. #+name: lst:configure-orderless -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'marginalia) (with-eval-after-load 'orderless (setopt orderless-component-separator " +") @@ -1460,7 +1460,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'embark 'embark-consult) (when (fboundp 'embark-act) (keymap-global-set "C-," #'embark-act)) @@ -1482,7 +1482,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'marginalia) (fboundp 'marginalia-mode)) (marginalia-mode +1)) @@ -1546,7 +1546,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'consult) ;; C-c bindings (current-global-map) (keymap-global-set "C-c h" #'consult-history) @@ -1588,7 +1588,7 @@ configures =company= after ensuring the =company= installation. #+caption[Setup =company=]: #+caption: Setup =company=. #+name: lst:setup-company -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'company) ;; https://github.com/purcell/emacs.d/issues/778 (setopt company-transformers '(company-sort-by-occurrence)) @@ -1652,7 +1652,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'deadgrep) (fboundp 'deadgrep)) (keymap-set search-map "d" #'deadgrep) @@ -1668,7 +1668,7 @@ the current [[https://en.wikipedia.org/wiki/Version_control][VCS]] directory tre #+caption[Define =multi-occur-in-this-mode=]: #+caption: Define =multi-occur-in-this-mode=. #+name: lst:multi-occur-in-this-mode -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defun get-buffers-matching-mode (mode) "Return a list of buffers whose major-mode is equal to MODE." (let ((buffer-mode-matches '())) @@ -1703,7 +1703,7 @@ implementation of the suggestions on those pages. *To do*: #+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 :results silent +#+begin_src emacs-lisp -n (when (executable-find "ugrep") (with-eval-after-load 'grep (setopt grep-template (string-join '("ugrep" @@ -1741,7 +1741,7 @@ regexp strings. #+caption[Ensure =xr= installation]: #+caption: Ensure =xr= installation. #+name: lst:ensure-xr-installation -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'xr)) #+end_src @@ -1764,7 +1764,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (setopt ediff-merge-split-window-function #'split-window-horizontally ediff-split-window-function #'split-window-horizontally @@ -1862,7 +1862,7 @@ snippet [[lst:ensure-magit-installation][below]] ensures its installation. Magi #+caption[Ensure =Magit= installation]: #+caption: Ensure =Magit= installation #+name: lst:ensure-magit-installation -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (ensure-package-installation 'magit) #+end_src @@ -1892,7 +1892,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'nov) (fboundp 'nov-mode)) (add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode))) @@ -1915,7 +1915,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 :results silent +#+begin_src emacs-lisp -n (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': @@ -1966,7 +1966,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'auctex) ;; Use `require' to make `TeX-master' a safe local variable. (when (require 'tex nil 'noerror) @@ -1984,7 +1984,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun update-lualatex-opentype-font-name-database () "Update the \"OpenType Font\" name database for \"LuaLaTeX\"." @@ -2000,7 +2000,7 @@ configuration objectives: #+caption[Set =bibtex= options]: #+caption: Set =bibtex= options. #+name: lst:set-bibtex-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'bibtex (setopt bibtex-dialect 'BibTeX)) #+end_src @@ -2008,7 +2008,7 @@ configuration objectives: #+caption[Set =font-latex= options]: #+caption: Set =font-latex= options. #+name: lst:set-font-latex-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'font-latex (setopt font-latex-fontify-sectioning 1.0)) #+end_src @@ -2016,7 +2016,7 @@ configuration objectives: #+caption[Set =latex= options]: #+caption: Set =latex= options. #+name: lst:set-latex-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'latex (setopt LaTeX-electric-left-right-brace t LaTeX-section-hook '(LaTeX-section-heading @@ -2038,7 +2038,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'math-preview) (with-eval-after-load 'math-preview ;; https://docs.mathjax.org/en/latest/input/tex/extensions/physics.html @@ -2103,7 +2103,7 @@ zeromatrix zmat"))) #+caption[Configure =markdown-mode=]: #+caption: Configure =markdown-mode=. #+name: lst:configure-markdown-mode -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'markdown-mode)) #+end_src @@ -2123,7 +2123,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (global-set-key (kbd "C-c a") #'org-agenda) (global-set-key (kbd "C-c c") #'org-capture) @@ -2168,7 +2168,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'org (setopt org-babel-load-languages @@ -2212,7 +2212,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ob-core (setopt org-confirm-babel-evaluate nil)) @@ -2234,7 +2234,7 @@ list detailing and motivating each listing: #+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 +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun set-org-babel-language-activity (lang active) "Set the `org-babel' activity of language LANG to ACTIVE. @@ -2281,7 +2281,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ol ;; Setting `org-link-descriptive' to `t' has caused worse `isearch' ;; behavior. Set `org-link-descriptive' interactively by calling @@ -2293,7 +2293,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; From: "Nicolas Richard" ;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview] @@ -2338,7 +2338,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (with-eval-after-load 'org-src (setopt org-src-preserve-indentation t)) @@ -2367,7 +2367,7 @@ When called twice, replace the previously inserted \\(\\) by one $." #+caption[Setup =ob-python=]: #+caption: Setup =ob-python=. This snippet may break in the future! #+name: lst:setup-ob-python -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ob-python (setq org-babel-python--def-format-value "\ def __org_babel_python_format_value(result, result_file, result_params): @@ -2417,7 +2417,7 @@ def __org_babel_python_format_value(result, result_file, result_params): #+caption[Set =org-export= options]: #+caption: Set =org-export= options. #+name: lst:set-org-export-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ox (setopt org-export-dispatch-use-expert-ui t)) #+end_src @@ -2425,7 +2425,7 @@ def __org_babel_python_format_value(result, result_file, result_params): #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'org ;; https://list.orgmode.org/87o84fd4oi.fsf@posteo.net/ (add-to-list @@ -2460,7 +2460,7 @@ def __org_babel_python_format_value(result, result_file, result_params): #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ox-latex (setopt org-latex-compiler "lualatex" @@ -2504,7 +2504,7 @@ def __org_babel_python_format_value(result, result_file, result_params): #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ox-latex (mapc (function (lambda (element) (add-to-list 'org-latex-classes element))) @@ -3012,7 +3012,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 :results silent +#+begin_src emacs-lisp -n (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?" @@ -3061,7 +3061,7 @@ the user-friendliness of this facility to a level acceptable for my workflow: #+caption: blocks to floating unbreakable LaTeX environments or non-floating #+caption: breakable LaTeX environments. #+name: lst:org-latex-engraved-source-block-filter -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (ensure-package-installation 'engrave-faces) (defun org-latex-engraved-source-block-filter (data _backend _info) @@ -3093,7 +3093,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 :results silent +#+begin_src emacs-lisp -n (defun smart-latex-engrave-org-source-blocks () "Enable smart LaTeX engraving of `org-src-mode' blocks. @@ -3170,7 +3170,7 @@ expanded file name of the ~reveal.js~ directory. #+caption[Specify the =reveal.js= location and load =org-re-reveal=]: #+caption: Specify the =reveal.js= location and load =org-re-reveal=. #+name: lst:use-org-re-reveal -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'org-re-reveal) (defun use-org-re-reveal () "Load `org-re-reveal' after setting the \"reveal.js\" root." @@ -3192,7 +3192,7 @@ headline lists with the data in property drawers. #+caption[Install =org-vcard= to read =vcf= files=]: #+caption: Install =org-vcard= to read =vcf= files=. #+name: lst:org-vcarc -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (ensure-package-installation 'org-vcard) #+end_src @@ -3216,7 +3216,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 :results silent +#+begin_src emacs-lisp -n (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) @@ -3259,7 +3259,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ol (autoload 'pdf-view-goto-page "pdf-view" nil t) (org-link-set-parameters "pdfview" @@ -3379,7 +3379,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 :results silent +#+begin_src emacs-lisp -n ;; https://bitspook.in/blog/extending-org-mode-to-handle-youtube-paths/ (defun org-yt-emms-open (path) "Open an \"YouTube\" PATH link with `emms' using \"mpv\"." @@ -3422,7 +3422,7 @@ The following posts provide programming information: #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://tecosaur.github.io/emacs-config/#translate-capital-keywords (defun org-syntax-convert-keyword-case-to-lower () @@ -3450,7 +3450,7 @@ The following posts provide programming information: #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun org-eval-named-blocks-with-infix (infix) "Evaluate all source blocks having INFIX in their name." @@ -3493,7 +3493,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (when (ensure-package-installation 'htmlize) (autoload 'htmlize-protect-string "htmlize" nil t)) @@ -3794,7 +3794,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ox (defun org-latex-header-blocks-filter (backend) "Convert marked LaTeX export blocks to \"#+latex_header: \" lines. @@ -3957,7 +3957,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'org-element (when (require 'pp nil 'noerror) (defconst grok-org-output @@ -4033,7 +4033,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun browse-common-misspellings () "Open the Wikipedia page of common misspellings for machines in EWW." @@ -4054,7 +4054,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 :results silent +#+begin_src emacs-lisp -n ;; https://funcall.blogspot.com/2022/07/lets-play-wordle.html ;; https://github.com/tabatkins/wordle-list (defun anagram-p (evil vile) @@ -4166,7 +4166,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'lexic) ;; http://download.huzheng.org/fr/ ;; https://polyglotte.tuxfamily.org/doku.php?id=donnees:dicos_bilingues @@ -4196,7 +4196,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 :results silent :tangle no +#+begin_src emacs-lisp -n :tangle no (when (ensure-package-installation 'wordnut) (with-eval-after-load 'wordnut (if-let ((wn (executable-find "wn"))) @@ -4216,7 +4216,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'writegood-mode) (fboundp 'writegood-mode)) (global-set-key (kbd "C-c g") #'writegood-mode)) @@ -4250,7 +4250,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'eglot (keymap-set eglot-mode-map "C-c n" 'flymake-goto-next-error) (keymap-set eglot-mode-map "C-c p" 'flymake-goto-prev-error) @@ -4260,7 +4260,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defcustom eglot-maybe-ensure-modes '(python-mode) "Modes where maybe `eglot-ensure' should be or has been called. @@ -4308,7 +4308,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.reddit.com/r/emacs/comments/w4f4u3 ;; /using_rustic_eglot_and_orgbabel_for_literate/ @@ -4335,7 +4335,7 @@ This is to advice `org-edit-src-exit' and `org-edit-src-save'." #+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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun eglot-maybe-ensure () (when (and (apply #'derived-mode-p eglot-maybe-ensure-modes) @@ -4362,7 +4362,7 @@ Listing [[lst:configure-format-all]]: #+caption[Configure =format-all=]: #+caption: Configure =format-all=. #+name: lst:configure-format-all -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n ;; 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/ @@ -4415,7 +4415,7 @@ Links to Common Lisp books and posts are: #+caption[Configure =slime=]: #+caption: Configure =slime=. #+name: lst:configure-slime -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'slime) (with-eval-after-load 'slime (setq slime-default-lisp 'sbcl @@ -4464,7 +4464,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'sly 'sly-macrostep 'sly-named-readtables) (with-eval-after-load 'sly ;; Set `sly-default-lisp' instead of `inferior-lisp-program', @@ -4502,7 +4502,7 @@ Listing [[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://ww #+caption[Get/set Sly ~slynk:*string-elision-length*~ functionality]: #+caption: Get/set Sly ~slynk:*string-elision-length*~ functionality. #+name: lst:slink-sel -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'sly (defconst slynk-command-get-sel "(cdr (assoc 'slynk:*string-elision-length* slynk:*slynk-pprint-bindings*))" @@ -4717,7 +4717,7 @@ post. #+caption[Define faces for =Common Lisp= custom font locking]: #+caption: Define faces for =Common Lisp= custom-font-locking. #+name: lst:cl-custom-font-locking-faces -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n ;;; Common Lisp custom font lock configuration. ;;; https://www.n16f.net/blog/custom-font-lock-configuration-in-emacs/ @@ -4772,14 +4772,14 @@ post. #+caption: Use =Common Lisp= to define the =cl-function-names= variable in #+caption: an =Emacs Lisp= source block for tangling into =user-init-file=. #+name: lst:define-cl-function-names -#+header: :wrap "src emacs-lisp -n :results silent" +#+header: :wrap "src emacs-lisp -n" #+begin_src lisp -n :exports both :eval never-export (format nil "(defvar~% cl-function-names~% '~S)~%" (standard-symbol-names #'fboundp)) #+end_src #+RESULTS: lst:define-cl-function-names -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defvar cl-function-names '("*" "+" "-" "/" "/=" "1+" "1-" "<" "<=" "=" ">" ">=" "abort" "abs" "acons" @@ -4943,14 +4943,14 @@ post. #+caption: Use =Common Lisp= to define the =cl-variable-names= variable in #+caption: an =Emacs Lisp= source block for tangling into =user-init-file=. #+name: lst:define-cl-value-names -#+header: :wrap "src emacs-lisp -n :results silent" +#+header: :wrap "src emacs-lisp -n" #+begin_src lisp -n :exports both :eval never-export (format nil "(defvar~% cl-value-names~% '~S)~%" (standard-symbol-names #'boundp)) #+end_src #+RESULTS: lst:define-cl-value-names -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defvar cl-value-names '("*" "**" "***" "*break-on-signals*" "*compile-file-pathname*" @@ -5001,7 +5001,7 @@ post. #+caption[Finalize =Common Lisp= custom font locking]: #+caption: Finalize =Common Lisp= custom font locking. #+name: lst:finalize-cl-custom-font-locking -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defvar cl-font-lock-keywords (let* ((character-re (concat "#\\\\" lisp-mode-symbol-regexp "\\_>")) (function-re (concat "(" (regexp-opt cl-function-names t) "\\_>")) @@ -5050,7 +5050,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ielm (setopt ielm-dynamic-return nil)) #+end_src @@ -5067,7 +5067,7 @@ Emacs Lisp forms. #+caption[Define macro to benchmark groups of forms]: #+caption: Define macro to benchmark groups of forms. #+name: lst:benchmark-group -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defvar joaot/bench-group-name nil) (defvar joaot/setup-form nil) (defvar joaot/timings-alist nil) @@ -5105,7 +5105,7 @@ Emacs Lisp forms. #+caption[Define macro to benchmark forms]: #+caption: Define macro to benchmark forms. #+name: lst:benchmark-form -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defmacro joaot/bench (form) `(cl-progv (mapcar #'car joaot/setup-form) @@ -5127,7 +5127,7 @@ Emacs Lisp forms. #+caption[Define benchmark helper functions]: #+caption: Define benchmark helper functions. #+name: lst:benchmark-helpers -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defun bench-cl-loop-list (l) (cl-loop for e in l thereis (identity e))) @@ -5357,7 +5357,7 @@ arguments of listing [[lst:maxima-example]]. #+caption[Configure =maxima=]: #+caption: Configure =maxima=. #+name: lst:configure-maxima -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (require 'maxima nil t) ;; In case of https://gitlab.com/sasanidas/maxima, uncomment the next 2 lines: ;; (add-hook 'maxima-mode-hook #'maxima-hook-function) @@ -5470,7 +5470,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 :results silent +#+begin_src emacs-lisp -n (defun choose-common-python-interpreter (&optional interpreter) "Let `ob-python' and `python-mode' use the same Python INTERPRETER." (interactive) @@ -5515,7 +5515,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 :results silent +#+begin_src emacs-lisp -n (defun choose-common-python-linter (&optional linter) "Let `python-check-command' and `python-flymake-command' use the same LINTER." (interactive) @@ -5546,7 +5546,7 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][ #+caption[Setup Python mode with =ob-python=]: #+caption: Setup Python mode with =ob-python=. #+name: lst:setup-python-mode -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'ob-python ;; (choose-common-python-interpreter 'python) (setopt org-babel-python-command (concat (or (executable-find "python3") @@ -5570,7 +5570,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 :results silent +#+begin_src emacs-lisp -n (when (executable-find "pyenv") (defun pyenv-full-path (version) "Return the full path for VERSION." @@ -5616,7 +5616,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'python (when (cl-every #'fboundp '(pyenv-full-path pyenv-version-name @@ -5825,7 +5825,7 @@ Available versions: 0.2.0, 0.1.1, 0.1.0 #+caption[Emacs client "Package Installer for Python" and "PyPI" options]: #+caption: Emacs client "Package Installer for Python" and "PyPI" options. #+name: lst:pip-pypi-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defgroup pip nil "Client for accessing the \"Package Installer for Python\" and \"PyPI\"." :group 'applications) @@ -5842,7 +5842,7 @@ Available versions: 0.2.0, 0.1.1, 0.1.0 #+caption[Emacs interface to list outdated Python packages]: #+caption: Emacs interface to list outdated Python packages. #+name: lst:pip-list-outdated -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (defvar pip-outdated-packages nil "Outdated Python packages.") @@ -5934,7 +5934,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'eglot (setq-default eglot-workspace-configuration @@ -5959,7 +5959,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 :results silent :tangle dir-locals.el +#+begin_src emacs-lisp -n :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. @@ -6033,7 +6033,7 @@ configures =code-cells=. #+caption[Configure =code-cells=]: #+caption: Configure =code-cells=. #+name: lst:configure-code-cells -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'code-cells) (with-eval-after-load 'code-cells (let ((map code-cells-mode-map)) @@ -6181,7 +6181,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 :results silent +#+begin_src emacs-lisp -n (when (fboundp #'global-dash-fontify-mode) (global-dash-fontify-mode)) @@ -6220,7 +6220,7 @@ setup and requires no configuration. #+caption[Enable =iedit=]: #+caption: Enable =iedit=. #+name: lst:enable-iedit -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'iedit) (require 'iedit nil 'noerror)) #+end_src @@ -6233,7 +6233,7 @@ setup and requires no configuration. #+caption[Configure =ws-butler=]: #+caption: Configure =ws-butler=. #+name: lst:configure-ws-butler -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'ws-butler) (require 'ws-butler nil 'noerror)) (setopt ws-butler-keep-whitespace-before-point nil) @@ -6286,7 +6286,7 @@ instance [[https://github.com/Fanael/rainbow-delimiters#readme][rainbow-delimite #+caption[Configure =smartparens=]: #+caption: Configure =smartparens=. #+name: lst:configure-smartparens -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'smartparens) ;; Require `smartparens-config' instead of `smartparens' to ;; disable pairing of the quote character for lisp modes. @@ -6340,7 +6340,7 @@ instance [[https://github.com/Fanael/rainbow-delimiters#readme][rainbow-delimite #+caption[Emacs Lisp commit message helper]: #+caption: Emacs Lisp commit message helper. #+name: lst:org-commit-message-helper -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'smartparens-config (defun defun-name-to-elisp-commit () "Wrap the defun name for elisp commit messages to put it on the kill-ring. @@ -6371,7 +6371,7 @@ formatter for Python]]. #+caption[Configure =electric-operator=]: #+caption: Configure =electric-operator=. #+name: lst:configure-electric-operator -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'electric-operator) (fboundp 'electric-operator-mode)) (add-hook 'c-mode-common-hook #'electric-operator-mode) @@ -6386,7 +6386,7 @@ formatter for Python]]. #+caption[Enable =yas-global-mode=]: #+caption: Enable =yas-global-mode=. #+name: lst:enable-yas-global-mode -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'yasnippet) ;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'. (setopt yas-alias-to-yas/prefix-p nil) @@ -6421,7 +6421,7 @@ Listing [[lst:configure-tempo-latex-completing-read]] shows how to combine =temp #+caption[Configure =tempo= user interface]: #+caption: Configure =tempo= user-interface. #+name: lst:configure-tempo-ui -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (require 'tempo nil 'noerror) (setopt tempo-interactive t) @@ -6466,7 +6466,7 @@ Allows `tempo' expansion by typing 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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'latex (require 'tempo nil 'noerror) @@ -6504,7 +6504,7 @@ Allows `tempo' expansion by typing 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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'python (require 'tempo nil 'noerror) @@ -6562,7 +6562,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (declare-function org-at-table-p "org" (&optional table-type)) @@ -6617,7 +6617,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'rainbow-mode) (fboundp 'rainbow-mode)) (setopt rainbow-x-colors-major-mode-list '(c++-mode @@ -6643,7 +6643,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 :results silent +#+begin_src emacs-lisp -n ;; 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. @@ -6684,7 +6684,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'browse-url (defun browse-url-mpv (url &optional _) (start-process "mpv" nil "mpv" url)) @@ -6711,7 +6711,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 :results silent +#+begin_src emacs-lisp -n (when (fboundp 'eww-browse-url) (defun eww-subreddit () "Read a subreddit in Emacs." @@ -6727,7 +6727,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 :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'eww (defun eww-display-pdf-as-binary (fn &rest args) (let ((buffer-file-coding-system 'binary)) @@ -6772,7 +6772,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 :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'hyperbole) (unless (load "kotl-autoloads.el" 'noerror nil nil 'must-suffix) ;; See `package-generate-autoloads' for `loaddefs-generate' usage. @@ -6846,7 +6846,7 @@ application/pdf; emacsclient %s [[https://github.com/minad/osm#readme][Open Street Map]] is a tile-based map viewer with a responsive movable and zoomable display and with a list of multiple preconfigured tile servers. -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (ensure-package-installation 'osm) #+end_src @@ -6859,7 +6859,7 @@ zoomable display and with a list of multiple preconfigured tile servers. runs queries from a plain-text query sheet and displays results as images, pretty-printed =XML=, and pretty-printed =JSON=. -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (ensure-package-installation 'restclient) #+end_src @@ -6900,7 +6900,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 :results silent +#+begin_src emacs-lisp -n (when (fboundp 'webjump) (keymap-global-set "C-c j" 'webjump) (with-eval-after-load 'webjump @@ -6967,7 +6967,7 @@ Password management: #+caption[Configure =gnus=]: #+caption: Configure =gnus=. #+name: lst:configure-gnus -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'gnus (setopt gnus-select-method '(nntp "news.gmane.io"))) @@ -7000,7 +7000,7 @@ Password management: #+caption[Configure =message=]: #+caption: Configure =message=. #+name: lst:configure-message -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (setopt user-full-name "Gerard Vermeulen" user-mail-address "gerard.vermeulen@posteo.net") (with-eval-after-load 'message @@ -7010,7 +7010,7 @@ Password management: #+caption[Configure =sendmail=]: #+caption: Configure =sendmail=. #+name: lst:configure-sendmail -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (with-eval-after-load 'sendmail (setopt mail-specify-envelope-from t mail-envelope-from 'header @@ -7096,7 +7096,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 :results silent +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'elfeed) (fboundp 'elfeed)) (keymap-global-set "C-x w" #'elfeed) @@ -7132,7 +7132,7 @@ for ~mpv~ while eliminating use of ~mpd~. #+caption[Set =emms= options]: #+caption: Set =emms= options. #+name: lst:set-emms-options -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (when (ensure-package-installation 'emms) (with-eval-after-load 'emms (emms-all) @@ -7188,7 +7188,7 @@ for technical information. #+caption[Hiding =*spurious*= buffers]: #+caption: Hiding =*spurious*= buffers. #+name: lst:hiding-spurious-buffers -#+begin_src emacs-lisp -n :results silent +#+begin_src emacs-lisp -n (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: @@ -7238,7 +7238,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 :results silent +#+begin_src emacs-lisp -n (provide 'init) ;; Emacs looks for "Local variables:" after the last "newline-formfeed".