diff --git a/README.org b/README.org index ab323ac..fe9efc1 100644 --- a/README.org +++ b/README.org @@ -37,12 +37,13 @@ the section entitled "GNU Free Documentation License". :CUSTOM_ID: sec:quick-start :END: -Backup the =user-emacs-directory= (defaults often to =~/.emacs.d= on =Linux=, -=Unix=, or =Darwin=) and execute the commands in listing [[lst:prepare-user-emacs-directory-with-https][prepare the -=user-emacs-directory= without =ssh= access]] or in listing [[lst:prepare-user-emacs-directory-with-ssh][prepare the -=user-emacs-directory= with =ssh= access]]. After invoking Emacs interactively -(in interactive mode, neither in batch mode, nor in server mode), Emacs will ask -you to install a selected set of packages. Quit Emacs and invoke Emacs again. +This setup requires at least Emacs-29.0.60. Backup the =user-emacs-directory= +(defaults often to =~/.emacs.d= on =Linux=, =Unix=, or =Darwin=) and execute the +commands in listing [[lst:prepare-user-emacs-directory-with-https][prepare the =user-emacs-directory= without =ssh= access]] or +in listing [[lst:prepare-user-emacs-directory-with-ssh][prepare the =user-emacs-directory= with =ssh= access]]. After invoking +Emacs interactively (in interactive mode, neither in batch mode, nor in server +mode), Emacs will ask you to install a selected set of packages. Quit Emacs and +invoke Emacs again. # #+caption[Prepare the user-emacs-directory]: # #+caption: Clone and initialize the user-emacs-directory. @@ -99,18 +100,15 @@ presentations. The [[https://github.com/bdarcus/citar][Citar]] extension package provides quick filtering and selecting of bibliographic entries, and the option to run different commands on those -selections. [[https://github.com/bdarcus/citar][Citar]] requires at least [[info:org#Top][Org (info)]]-9.5 , which is already part of -Emacs-28.1. [[https://github.com/bdarcus/citar][Citar]] exploits the enhancements of Emacs' builtin selection -mechanism provided by the extension packages [[https://github.com/minad/vertico][vertico]], [[https://github.com/oantolin/embark][embark]], [[https://github.com/minad/marginalia][marginalia]], and -[[https://github.com/minad/consult][consult]]. The [[https://github.com/andras-simonyi/citeproc-el][citeproc]] extension package provides -[[https://citationstyles.org/][CSL: citation style language]] processing -capabilities to [[https://github.com/bdarcus/citar][citar]] and [[https://orgmode.org/][Org Mode]]. The [[https://github.com/citation-style-language/styles#readme][citation style language: style -repository]] links to a curated repository of CSL styles. +selections. [[https://github.com/bdarcus/citar][Citar]] exploits the extension packages [[https://github.com/minad/vertico][Vertico]], [[https://github.com/oantolin/embark][Embark]], [[https://github.com/minad/marginalia][Marginalia]], +and [[https://github.com/minad/consult][Consult]]. The [[https://github.com/andras-simonyi/citeproc-el][CiteProc]] extension package provides [[https://citationstyles.org/][CSL: citation style +language]] processing capabilities to [[https://github.com/bdarcus/citar][Citar]] and [[https://orgmode.org/][Org Mode]]. A curated repository +of CSL styles is the [[https://github.com/citation-style-language/styles#readme][citation style language repository]]. -The [[https://github.com/vedang/pdf-tools][pdf-tools]] extension package renders [[https://en.wikipedia.org/wiki/PDF][PDF]] file with the possibility to +The [[https://github.com/vedang/pdf-tools][PDF-Tools]] extension package renders [[https://en.wikipedia.org/wiki/PDF][PDF]] file with the possibility to annotate the file or to click on anchors in the [[https://en.wikipedia.org/wiki/PDF][PDF]] file that link back to the original [[https://www.latex-project.org/][LaTeX]] file of the document. An example of my work-flow are the steps -to convert this [[info:org#Top][org]] file to [[https://en.wikipedia.org/wiki/PDF][PDF]] and to see the result with [[https://github.com/vedang/pdf-tools][pdf-tools]] in Emacs: +to convert this [[info:org#Top][org]] file to [[https://en.wikipedia.org/wiki/PDF][PDF]] and to see the result with [[HTTPS://github.com/vedang/pdf-tools][PDF-Tools]] in Emacs: execute the commands ~pdf-tools-install~, ~org-babel-tangle~, ~org-latex-export-latex-to-latex~, and ~compile~. This sets up an infinite [[https://www.latex-project.org/][LaTeX]] compilation loop to update and redisplay the [[https://en.wikipedia.org/wiki/PDF][PDF]] file after excution of @@ -124,8 +122,9 @@ Here follows a list of interesting Emacs configurations: over my head. 2. [[https://github.com/oantolin/emacs-config][Omar Antolin Camarena's configuration]] exploits built-in packages, Omar's own small packages, and large external packages. Omar is the author of [[https://github.com/oantolin/orderless][orderless]] - and [[https://github.com/oantolin/embark][embark]]. I have stolen his idea of using ~custom-set-variables~ instead - of the customize interface although that is [[https://www.masteringemacs.org/article/bad-emacs-advice][bad Emacs advice]] for new users. + and [[https://github.com/oantolin/embark][embark]]. My use =setopt= to set Emacs options instead of the customize + interface comes from his idea of using =custom-set-variables= although that + is [[https://www.masteringemacs.org/article/bad-emacs-advice][bad Emacs advice]] for new users. 3. [[https://gitlab.com/ambrevar/dotfiles][Pierre Neirhardt's configuration]] implements lazy loading without help of external packages. I have stolen his approach of using lazy loading to silently ignore the setup stanzas of uninstalled extension packages. @@ -196,165 +195,105 @@ that *Emacs is a self-documenting editor.* :CUSTOM_ID: sec:init-file-header :END: -The =user-init-file= header requires =cl-lib=, backports new functions in -Emacs-29.1 to Emacs-28.2, and customizes Emacs variables. It consists of five -parts in listing [[lst:backport-header]], [[lst:1st-custom-set-variables-call]], -[[lst:2nd-custom-set-variables-call]], [[lst:3rd-custom-set-variables-call]], and -[[lst:4th-custom-set-variables-call]] in order to limit the length of the listings -for exporting to LaTeX. +The =user-init-file= header requires =cl-lib= and sets Emacs options. It +consists of two parts in listing [[lst:1st-setopt-call]], and [[lst:2nd-setopt-call]] in +order to limit the length of the listings for exporting to LaTeX. The [[info:elisp#Quoting][quoting (info)]] and the [[info:elisp#Backquote][backquote (info)]] pages explain how to understand the -~'~ (quote), ~`~ (backquote), ~,~ (substitute) and ~@,~ (splice) in the -~custom-set-variables~ function calls in listing -[[lst:1st-custom-set-variables-call]], [[lst:2nd-custom-set-variables-call]], -[[lst:3rd-custom-set-variables-call]], and [[lst:4th-custom-set-variables-call]]. A -tutorial of how to use those reader macros is the [[https://mullikine.github.io/posts/macro-tutorial/][didactic emacs-lisp macro -example]]. +~'~ (quote), ~`~ (backquote), ~,~ (substitute) and ~@,~ (splice) in in listing +[[lst:1st-setopt-call]] and [[lst:2nd-setopt-call]]. A tutorial of how to use those +reader macros is the [[https://mullikine.github.io/posts/macro-tutorial/][didactic emacs-lisp macro example]]. -The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ as [[info:emacs#Saving Customizations][saving customizations -(info)]] recommends because of the ~custom-set-variables~ function calls. +The [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ in spite of the +recommendation of [[info:emacs#Saving Customizations][saving customizations (info)]]. -#+caption[Header with backport of Emacs-29.1 functionality]: -#+caption: Header with backport of Emacs-29.1 functionality. -#+name: lst:backport-header +#+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 ;;; init.el --- user init file -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: (require 'cl-lib) -(when (version< emacs-version "29.0.0") - (defmacro setopt (&rest pairs) - "Set VARIABLE/VALUE pairs, and return the final VALUE. -This is like `setq', but is meant for user options instead of -plain variables. This means that `setopt' will execute any -`custom-set' form associated with VARIABLE. +(when (version< emacs-version "29.0.60") + (error "This `init.el' requires at least Emacs-29.0.60")) -\(fn [VARIABLE VALUE]...)" - (declare (debug setq)) - (unless (zerop (mod (length pairs) 2)) - (error "PAIRS must have an even number of variable/value members")) - (let ((expr nil)) - (while pairs - (unless (symbolp (car pairs)) - (error "Attempting to set a non-symbol: %s" (car pairs))) - (push `(setopt--set ',(car pairs) ,(cadr pairs)) - expr) - (setq pairs (cddr pairs))) - (macroexp-progn (nreverse expr)))) - - (defun setopt--set (variable value) - (custom-load-symbol variable) - ;; Check that the type is correct. - (when-let ((type (get variable 'custom-type))) - (unless (widget-apply (widget-convert type) :match value) - (warn "Value `%S' does not match type %s" value type))) - (put variable 'custom-check-value (list value)) - (funcall (or (get variable 'custom-set) #'set-default) variable value))) -#+end_src - -#+caption[Customize the first set of Emacs variables]: -#+caption: Customize the first set of Emacs variables. -#+name: lst:1st-custom-set-variables-call -#+begin_src emacs-lisp -(custom-set-variables - '(after-save-hook #'executable-make-buffer-file-executable-if-script-p) - '(column-number-mode t) - '(cursor-type 'box) - `(custom-file ,(locate-user-emacs-file "custom.el")) - '(epg-pinentry-mode 'loopback) - '(global-hl-line-mode t) - '(global-hl-line-sticky-flag t) - '(history-delete-duplicates t) - '(history-length 500) - '(indent-tabs-mode nil) - '(inhibit-startup-buffer-menu t) - '(inhibit-startup-screen t) - '(initial-buffer-choice t) - '(initial-scratch-message "") - `(insert-directory-program ,(or (executable-find "gls") - (executable-find "ls"))) - '(kill-ring-max 300)) -#+end_src - -#+caption[Customize the second set of Emacs variables]: -#+caption: Customize the second set of Emacs variables. -#+name: lst:2nd-custom-set-variables-call -#+begin_src emacs-lisp -(custom-set-variables - ;; See https://github.com/melpa/melpa#mirrors for official Melpa mirrors. - '(package-archives - '(("gnu" . "https://elpa.gnu.org/packages/") - ("gnu-devel" . "https://elpa.gnu.org/devel/") - ("melpa" . "https://melpa.org/packages/") - ;; ("melpa" . "https://www.mirrorservice.org/sites/melpa.org/packages/") - ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) - ;; Pin packages to GNU ELPA for info or stability. - '(package-pinned-packages - `,(delq nil `((auctex . "gnu") - (compat . "gnu") - (consult . "gnu-devel") - ,(when (version< emacs-version "29.0.0") - '(eglot . "gnu-devel")) - (embark . "gnu-devel") - (embark-consult . "gnu-devel") - (engrave-faces . "gnu-devel") - (hyperbole . "gnu-devel") - (marginalia . "gnu-devel") - (org . "gnu-devel") - (queue . "gnu") - (rainbow-mode . "gnu") - (spinner . "gnu") - (xr . "gnu") - (vertico . "gnu-devel"))))) -#+end_src - -#+caption[Customize the third set of Emacs variables]: -#+caption: Customize the third set of Emacs variables. -#+name: lst:3rd-custom-set-variables-call -#+begin_src emacs-lisp -(custom-set-variables - '(package-selected-packages - `,(delq nil `(async ; asynchroneous processing - debbugs ; access the GNU bug tracker - no-littering ; keep `user-emacs-directory' clean - org ; thought organizer - wgrep)))) ; open a writable grep buffer -#+end_src - -#+caption[Customize the fourth set of Emacs variables]: -#+caption: Customize the fourth set of Emacs variables. -#+name: lst:4th-custom-set-variables-call -#+begin_src emacs-lisp -(custom-set-variables - '(recentf-mode t) - '(save-place-mode t) - '(scroll-bar-mode nil) - '(tab-always-indent 'complete) - '(tab-width 8) - '(tool-bar-mode nil) - '(url-cookie-trusted-urls nil) - '(url-cookie-untrusted-urls '(".*")) - '(use-dialog-box nil) - '(view-read-only t)) - -(when (version< "28.0" emacs-version) - (custom-set-variables - '(mode-line-compact 'long) - '(next-error-message-highlight t) - '(use-short-answers t))) +(setopt + after-save-hook #'executable-make-buffer-file-executable-if-script-p + column-number-mode t + cursor-type 'box + custom-file (locate-user-emacs-file "custom.el") + epg-pinentry-mode 'loopback + global-hl-line-mode t + global-hl-line-sticky-flag t + history-delete-duplicates t + history-length 500 + indent-tabs-mode nil + inhibit-startup-buffer-menu t + inhibit-startup-screen t + initial-buffer-choice t + initial-scratch-message "" + insert-directory-program (or (executable-find "gls") + (executable-find "ls")) + kill-ring-max 300 + mode-line-compact 'long + next-error-message-highlight t + recentf-mode t + save-place-mode t + scroll-bar-mode nil + tab-always-indent 'complete + tab-width 8 + tool-bar-mode nil + url-cookie-trusted-urls nil + url-cookie-untrusted-urls '(".*") + use-dialog-box nil + use-short-answers t + view-read-only t) (when (eq system-type 'darwin) - (custom-set-variables - '(ns-alternate-modifier nil) - '(ns-command-modifier 'meta) - '(ns-right-command-modifier 'super))) + (setopt ns-alternate-modifier nil + ns-command-modifier 'meta + ns-right-command-modifier 'super)) (when (eq window-system 'ns) (add-to-list 'initial-frame-alist '(height . 51)) (add-to-list 'initial-frame-alist '(width . 180))) #+end_src +#+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 +(setopt + ;; See https://github.com/melpa/melpa#mirrors for official Melpa mirrors. + ;; ("melpa" . "https://www.mirrorservice.org/sites/melpa.org/packages/") + package-archives '(("gnu" . "https://elpa.gnu.org/packages/") + ("gnu-devel" . "https://elpa.gnu.org/devel/") + ("melpa" . "https://melpa.org/packages/") + ("nongnu" . "https://elpa.nongnu.org/nongnu/")) + ;; Pin packages to GNU ELPA for info or stability. + package-pinned-packages '((auctex . "gnu") + (compat . "gnu") + (consult . "gnu-devel") + (embark . "gnu-devel") + (embark-consult . "gnu-devel") + (engrave-faces . "gnu-devel") + (hyperbole . "gnu-devel") + (marginalia . "gnu-devel") + (org . "gnu-devel") + (queue . "gnu") + (rainbow-mode . "gnu") + (spinner . "gnu") + (xr . "gnu") + (vertico . "gnu-devel")) + package-selected-packages '(async ; asynchroneous processing + debbugs ; access the GNU bug tracker + no-littering ; keep `user-emacs-directory' clean + org ; thought organizer + wgrep)) ; open a writable grep buffer +#+end_src + * [[info:emacs#Package Installation][Install the selected packages (info)]] :PROPERTIES: :CUSTOM_ID: sec:install-selected-packages @@ -425,9 +364,9 @@ the contents of packages and allows to update packages to the latest version. :CUSTOM_ID: sec:emacs-tree-sitter :END: -#+caption[Customize Emacs Tree-sitter]: -#+caption: Customize Emacs Tree-sitter. -#+name: lst:customize-emacs-tree-sitter +#+caption[Setup Emacs Tree-sitter]: +#+caption: Setup Emacs Tree-sitter. +#+name: lst:setup-emacs-tree-sitter #+begin_src emacs-lisp (when (require 'treesit nil 'noerror) ;; https://lists.gnu.org/archive/html/emacs-devel/2022-11/msg01372.html @@ -446,9 +385,9 @@ the contents of packages and allows to update packages to the latest version. :CUSTOM_ID: sec:text-faces-or-styles :END: -This setup does not configure [[info:emacs#Custom Themes][custom themes (info)]] in order to prevent endless -useless tweaking. See the [[https://protesilaos.com/codelog/2020-09-05-emacs-note-mixed-font-heights/][note on mixed font heights in Emacs]] for how to setup -fonts properly. It boils down to two rules: +This setup does not use [[info:emacs#Custom Themes][custom themes (info)]] to avoid endless tweaking, but it +does a minimal setup of fonts and faces. See the [[https://protesilaos.com/codelog/2020-09-05-emacs-note-mixed-font-heights/][note on mixed font heights in +Emacs]] for how to setup fonts properly. It boils down to two rules: 1. The height of the default face must be an integer number to make the height a physical quantity. 2. The heights of all other faces must be real numbers to scale those heights @@ -626,14 +565,16 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. (defun split-root-below (arg) "Split window below from the root or from the parent with ARG." (interactive "P") - (split-window (if arg (window-parent (selected-window)) + (split-window (if arg + (window-parent (selected-window)) (frame-root-window)) nil 'below nil)) (defun split-root-right (arg) "Split window right from the root or from the parent with ARG." (interactive "P") - (split-window (if arg (window-parent (selected-window)) + (split-window (if arg + (window-parent (selected-window)) (frame-root-window)) nil 'right nil)) @@ -665,9 +606,9 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+begin_src emacs-lisp (with-eval-after-load 'emacs ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager - (custom-set-variables - '(switch-to-buffer-in-dedicated-window 'pop) - '(switch-to-buffer-obey-display-actions t)) + (when (version< "29.0.0" emacs-version) + (setopt switch-to-buffer-in-dedicated-window 'pop + switch-to-buffer-obey-display-actions t)) (add-to-list 'display-buffer-alist `(,(rx (or "*Apropos*" @@ -787,37 +728,34 @@ of the facilities of [[info:emacs#Dired][dired (info)]] as follows: 6. Switch to the =org-mode= buffer and use {{{kbd(C-c C-l)}}} to insert the =org-link= into the buffer. -Listing [[lst:customize-dired]] makes the directory editor sort entries +Listing [[lst:set-dired-options]] makes the directory editor sort entries alphabetically after grouping the directories before grouping the files by extension. -#+caption[Customize =dired=]: -#+caption: Customize =dired=. -#+name: lst:customize-dired +#+caption[Set =dired= options]: +#+caption: Set =dired= options. +#+name: lst:set-dired-options #+begin_src emacs-lisp (with-eval-after-load 'dired - (custom-set-variables - '(dired-dwim-target t) - ;; | switch | action | - ;; |--------+----------------------------------------| - ;; | -a | also list hidden entries | - ;; | -l | use a long listing format | - ;; | -X | sort alphabetically by entry extension | - ;; | -G | skip long listing format group names | - ;; | -1 | list one entry per line | - '(dired-listing-switches "-alGX1 --group-directories-first") - '(dired-recursive-copies 'always) - '(dired-recursive-deletes 'always))) + (setopt dired-dwim-target t + ;; | switch | action | + ;; |--------+----------------------------------------| + ;; | -a | also list hidden entries | + ;; | -l | use a long listing format | + ;; | -X | sort alphabetically by entry extension | + ;; | -G | skip long listing format group names | + ;; | -1 | list one entry per line | + dired-listing-switches "-alGX1 --group-directories-first" + dired-recursive-copies 'always + dired-recursive-deletes 'always)) (with-eval-after-load 'files - (custom-set-variables - ;; Ensure the use of `GNU-ls' from `coreutils' on darwin. - '(insert-directory-program (or (executable-find "gls") - (executable-find "ls"))))) + ;; Ensure the use of `GNU-ls' from `coreutils' on darwin. + (setopt insert-directory-program (or (executable-find "gls") + (executable-find "ls")))) (with-eval-after-load 'wdired - (custom-set-variables - '(wdired-allow-to-change-permissions t))) + (setopt wdired-allow-to-change-permissions t)) #+end_src Listing [[lst:extra-dired-key-bindings]] adds new key bindings to =dired-mode-map= to: @@ -878,20 +816,19 @@ by experienced Emacs users. :CUSTOM_ID: sec:minibuffer-completion-styles :END: -Listing [[lst:configure-minibuffer-completion-styles][configure minibuffer completion styles]] implements ideas of the post -[[https://www.masteringemacs.org/article/understanding-minibuffer-completion][Understanding minibuffer completion]]. +Listing [[lst:set-minibuffer-options][set minibuffer options]] implements ideas of the post [[https://www.masteringemacs.org/article/understanding-minibuffer-completion][Understanding +minibuffer completion]]. -#+caption[Configure =minibuffer= completion styles]: -#+caption: Configure =minibuffer= completion styles. -#+name: lst:configure-minibuffer-completion-styles +#+caption[Set =minibuffer= options]: +#+caption: Set =minibuffer= options. +#+name: lst:set-minibuffer-options #+begin_src emacs-lisp (when (require 'minibuffer nil 'noerror) ;; https://www.masteringemacs.org/article/understanding-minibuffer-completion - (custom-set-variables - '(completion-category-overrides - '((file (styles basic substring)))) - '(completion-ignore-case nil) - '(completion-styles '(basic flex partial-completion substring)))) + (setopt + completion-category-overrides '((file (styles basic substring))) + completion-ignore-case nil + completion-styles '(basic flex partial-completion substring))) #+end_src * [[info:elisp#Processes][Processes (info)]] @@ -939,6 +876,17 @@ or {{{kbd(C-h v)}}}. | info | help-map | {{{kbd(C-h i)}}} | |------------------------------+----------+------------------| +#+begin_src emacs-lisp :tangle no +(defun org-key-binding-macro (cmd) + (let* ((sym (intern-soft cmd)) + (keys (and (commandp sym) (where-is-internal sym nil 'first-only))) + (prefix (seq-take keys (1- (length keys)))) + (keymap (key-binding prefix 'accept-default))) + (format "%s %s %s {{{kbd(%s)}}}" + cmd keymap (help--binding-locus keys nil) (key-description keys)))) + +(org-key-binding-macro 'consult-buffer) +#+end_src ** [[info:emacs#Name Help][Shortdoc-display-group (info)]] :PROPERTIES: @@ -1111,8 +1059,7 @@ Listing [[lst:configure-keycast]] configures =keycast=. ;; control buffer `ediff-setup-windows-plain' returns. (when (and (ensure-package-installation 'keycast) (require 'keycast nil 'noerror)) - (custom-set-variables - '(keycast-mode-line-window-predicate 'keycast-bottom-right-window-p)) + (setopt keycast-mode-line-window-predicate 'keycast-bottom-right-window-p) (defun keycast-log-update-buffer-plain () (let ((buffer (get-buffer keycast-log-buffer-name))) @@ -1171,11 +1118,11 @@ The code in listing [[lst:start-emacs-server]] starts the Emacs server. :END: The =latexmk= resource file in the next source code block shows how to use -=emacsclient= to (re)display the PDF file in Emacs after each succesful -(re)compilation on condition that the settings of the ~compile-command~ local -variable in section are compatible. The local variable ~compile-command~ in the -[[#sec:local-variables][local variables]] section (only visible in =org= files, but not in =html= and -=pdf= files) shows how to use the =latexmkrc= file. +=emacsclient= to (re)display the PDF file in Emacs after each successful +(re)compilation on condition that the local ~compile-command~ variable is +correct. The local ~compile-command~ variable in the [[#sec:local-variables][local variables]] section +(only visible in =org= files, but not in =html= and =pdf= files) shows how to +make use of the =latexmkrc= file. #+attr_latex: :options breaklines #+caption[Tangle the =Latexmk= resource file]: @@ -1334,16 +1281,13 @@ file. #+caption: Enable =savehist-mode= and =vertico-mode=. #+name: lst:enable-vertico-mode #+begin_src emacs-lisp -(when (fboundp 'savehist-mode) +(when (require 'savehist nil 'noerror) + (setopt savehist-additional-variables '(eww-history + kill-ring + regexp-search-string + search-ring + search-string)) (savehist-mode +1)) -(with-eval-after-load 'savehist-mode - (custom-set-variables - '(savehist-additional-variables - '(eww-history - kill-ring - regexp-search-string - search-ring - search-string)))) (when (and (ensure-package-installation 'vertico) (fboundp 'vertico-mode)) (vertico-mode +1)) @@ -1395,8 +1339,7 @@ file. #+begin_src emacs-lisp (when (ensure-package-installation 'marginalia) (with-eval-after-load 'orderless - (custom-set-variables - '(orderless-component-separator " +")) + (setopt orderless-component-separator " +") (defun just-one-face (fn &rest args) (let ((orderless-match-faces [completions-common-part])) @@ -1410,7 +1353,7 @@ file. :CUSTOM_ID: sec:embark-configuration :END: -Listing [[lst:configure-embark]] configures =embark= key bindings: +Listing [[lst:bind-embark-commands][bind =embark= commands]] binds =embark= commands to the global key map: 1. =embark-act= prompts the user for an action and performs it. 2. Except for highlighting of email and web URLs, =embark-dwim= englobes the functionality of src_emacs-lisp{(find-library "goto-addr")} that activates @@ -1425,9 +1368,9 @@ Listing [[lst:configure-embark]] configures =embark= key bindings: (for instance {{{kbd(C-x)}}} or {{{kbd(C-c)}}}) as typing {{{kbd(C-x C-h)}}} or {{{kbd(C-c C-h)}}} shows. -#+caption[Configure =embark=]: -#+caption: Configure =embark=. -#+name: lst:configure-embark +#+caption[Bind =embark= commands globally]: +#+caption: Bind =embark= commands globally. +#+name: lst:bind-embark-commands #+begin_src emacs-lisp (when (ensure-package-installation 'embark 'embark-consult) (when (fboundp 'embark-act) @@ -1458,11 +1401,12 @@ Listing [[lst:enable-marginalia-mode]] enables =marginalia-mode=. ** [[info:consult#Top][Consult (info)]] :PROPERTIES: -:CUSTOM_ID: sec:consult-configuration +:CUSTOM_ID: sec:consult-setup :END: -Consult provides practical commands based on the Emacs minibuffer completion -function [[info:elisp#Minibuffer Completion][completing-read]]. Listing [[lst:configure-consult]] configures =consult=. +[[info:consult#Top][Consult (info)]] provides practical commands based on the Emacs minibuffer +completion function [[info:elisp#Minibuffer Completion][completing-read]]. Listing [[lst:bind-consult-commands][bind =consult= commands]] binds +=consult= commands to different key maps. #+attr_latex: :booktabs yes :float table #+caption[Configuration specific key bindings]: @@ -1511,13 +1455,11 @@ function [[info:elisp#Minibuffer Completion][completing-read]]. Listing [[lst:c |-----------------------------+----------------------+---------------------| -#+caption[Configure =consult=]: -#+caption: Configure =consult=. -#+name: lst:configure-consult +#+caption[Bind =consult= commands]: +#+caption: Bind =consult= commands. +#+name: lst:bind-consult-commands #+begin_src emacs-lisp (when (ensure-package-installation 'consult) - (custom-set-variables - '(consult-project-function #'(lambda (_) (vc-root-dir)))) ;; C-c bindings (current-global-map) (global-set-key (kbd "C-c h") #'consult-history) (global-set-key (kbd "C-c m") #'consult-mode-command) @@ -1551,19 +1493,18 @@ function [[info:elisp#Minibuffer Completion][completing-read]]. Listing [[lst:c ** [[https://company-mode.github.io/][Company: a modular complete anything framework for Emacs]] :PROPERTIES: -:CUSTOM_ID: sec:company-configuration +:CUSTOM_ID: sec:company-setup :END: -Listing [[lst:configure-company]] configures =company=. +Listing [[lst:setup-company]] configures =company=. -#+caption[Configure =company=]: -#+caption: Configure =company=. -#+name: lst:configure-company +#+caption[Setup =company=]: +#+caption: Setup =company=. +#+name: lst:setup-company #+begin_src emacs-lisp (when (fboundp 'company-mode) - (custom-set-variables - ;; https://github.com/purcell/emacs.d/issues/778 - '(company-transformers '(company-sort-by-occurrence))) + ;; https://github.com/purcell/emacs.d/issues/778 + (setopt company-transformers '(company-sort-by-occurrence)) (dolist (hook '(LaTeX-mode-hook org-mode-hook emacs-lisp-mode-hook @@ -1616,12 +1557,13 @@ of {{{kbd(M-x replace-regexp)}}} using =(regular-expression transform)= pairs. :END: [[https://github.com/Wilfred/deadgrep#readme][Deadgrep]] uses [[https://github.com/BurntSushi/ripgrep#readme][ripgrep]] for superfast text searching in the default directory or -the current [[https://en.wikipedia.org/wiki/Version_control][VCS]] directory tree. Listing [[lst:configure-deadgrep]] binds =deadgrep= -to {{{kbd(M-s d)}}} and =deadgrep-edit-mode= to {{{kbd(C-c C-w)}}}. +the current [[https://en.wikipedia.org/wiki/Version_control][VCS]] directory tree. Listing [[lst:bind-deadgrep-commands][setup =deadgrep= commands]] binds +=deadgrep= globally to {{{kbd(M-s d)}}} and =deadgrep-edit-mode= locally to +{{{kbd(C-c C-w)}}}. -#+caption[Configure =deadgrep=]: -#+caption: Configure =deadgrep=. -#+name: lst:configure-deadgrep +#+caption[Bind =deadgrep= commands]: +#+caption: Bind =deadgrep= commands. +#+name: lst:bind-deadgrep-commands #+begin_src emacs-lisp (when (and (ensure-package-installation 'deadgrep) (fboundp 'deadgrep)) @@ -1637,37 +1579,34 @@ to {{{kbd(M-s d)}}} and =deadgrep-edit-mode= to {{{kbd(C-c C-w)}}}. [[https://www.genivia.com/get-ugrep.html][Ugrep]] is an ultra fast grep with interactive query UI and fuzzy search. The pages [[https://github.com/Genivia/ugrep#emacs][Using ugrep within Emacs]] and [[https://manueluberti.eu/emacs/2022/08/07/emacs-ugrep/][Ugrep in Emacs]] show how to make Emacs use it -with [[info:emacs#Grep Searching][lgrep]] and [[info:emacs#Xref][xref]]. Listing [[lst:use-ugrep]] shows my implementation of the -suggestions on those pages. +with [[info:emacs#Grep Searching][lgrep]] and [[info:emacs#Xref][xref]]. Listing [[lst:set-grep+xref-options][set =grep= and =xref= options]] shows my +implementation of the suggestions on those pages. -#+caption[Use =ugrep= when available]: -#+caption: Use =ugrep= when available. -#+name: lst:use-ugrep +#+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 (when (executable-find "ugrep") (with-eval-after-load 'grep - (custom-set-variables - `(grep-template ,(string-join '("ugrep" - "--color=always" - "--decompress" - "--ignore-binary" - "--ignore-case" - "--include=\"\"" - "--line-number" - "--null" - "--recursive" - "--regexp=") - " ")))) + (setopt grep-template (string-join '("ugrep" + "--color=always" + "--decompress" + "--ignore-binary" + "--ignore-case" + "--include=\"\"" + "--line-number" + "--null" + "--recursive" + "--regexp=") + " "))) (with-eval-after-load 'xref - (custom-set-variables - '(xref-search-program-alist - '((grep - . "xargs -0 grep --null -snHE -e ") - (ripgrep - . "xargs -0 rg --null -nH --no-heading --no-messages -g '!*/' -e ") - (ugrep - . "xargs -0 ugrep --null -ns -e "))) - '(xref-search-program 'ugrep)))) + (setopt + xref-search-program 'ugrep + xref-search-program-alist + `((grep . "xargs -0 grep --null -snHE -e ") + (ripgrep . ,(concat "xargs -0 rg --null -nH" + " --no-heading --no-messages -g '!*/' -e ")) + (ugrep . "xargs -0 ugrep --null -ns -e "))))) #+end_src ** [[https://github.com/mattiase/xr#readme][XR - Emacs regexp parser and analyzer]] @@ -1699,23 +1638,23 @@ regexp strings. Video links to complete the [[info:ediff#Top][ediff (info)]] manual are: 1. [[https://www.youtube.com/watch?v=6ZWp05OW1c0][Emergency Emacs]]. 2. [[https://protesilaos.com/codelog/2020-04-10-emacs-smerge-ediff/][Use =smerge= and =ediff= to resolve file conflicts]]. -Listing [[lst:configure-ediff]] configures =ediff= to display all its buffers in a +Listing [[lst:setup-ediff]] configures =ediff= to display all its buffers in a single frame and to make all text visible prior to ediffing Org buffers. -#+caption[Configure =ediff=]: -#+caption: Configure =ediff=. -#+name: lst:configure-ediff +#+caption[Setup =ediff=]: +#+caption: Setup =ediff=. +#+name: lst:setup-ediff #+begin_src emacs-lisp (with-eval-after-load 'emacs - (custom-set-variables - '(ediff-merge-split-window-function #'split-window-horizontally) - '(ediff-split-window-function #'split-window-horizontally) - '(ediff-window-setup-function #'ediff-setup-windows-plain))) + (setopt ediff-merge-split-window-function #'split-window-horizontally + ediff-split-window-function #'split-window-horizontally + ediff-window-setup-function #'ediff-setup-windows-plain)) (with-eval-after-load 'org ;; https://github.com/oantolin/emacs-config#readme (defun ediff-with-org-show-all () "Expand all headings prior to ediffing org buffers." - (add-hook 'ediff-prepare-buffer-hook #'org-show-all nil t)) + (add-hook 'ediff-prepare-buffer-hook #'org-fold-show-all nil t)) + (add-hook 'org-mode-hook #'ediff-with-org-show-all)) #+end_src @@ -1851,9 +1790,9 @@ In order to use [[https://github.com/vedang/pdf-tools][pdf-tools]], you have to installation of [[https://github.com/vedang/pdf-tools][pdf-tools]] from [[https://melpa.org/][MELPA]] or after each update of [[https://github.com/freedesktop/poppler][poppler]] to build or rebuild the =epdfinfo= executable that serves the [[https://en.wikipedia.org/wiki/PDF][PDF]] files to Emacs. -#+caption[Configure =pdf-tools=]: -#+caption: Configure =pdf-tools=. -#+name: lst:configure-pdf-tools +#+caption[Setup =pdf-tools=]: +#+caption: Setup =pdf-tools=. +#+name: lst:setup-pdf-tools #+begin_src emacs-lisp (when (and (ensure-package-installation 'pdf-tools 'saveplace-pdf-view) (fboundp 'pdf-loader-install)) @@ -1868,9 +1807,8 @@ rebuild the =epdfinfo= executable that serves the [[https://en.wikipedia.org/wik (define-key pdf-outline-minor-mode-map (kbd "O") #'pdf-outline)) (with-eval-after-load 'pdf-view - (custom-set-variables - '(pdf-view-display-size 'fit-page) - `(pdf-view-use-scaling ,(eq system-type 'darwin))) + (setopt pdf-view-display-size 'fit-page + pdf-view-use-scaling (eq system-type 'darwin)) (require 'saveplace-pdf-view nil 'noerror))) #+end_src @@ -1890,35 +1828,35 @@ elisp library file has no autoload cookie. Without prior loading of =tex.el=, Emacs will complain that ~TeX-master~ is no safe local variable in case it reads a LaTeX file that sets ~TeX-master~. The list below summarizes the main [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] configuration objectives: -1. Listing [[lst:require-tex]] ensures installation of [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] and initializes [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] - properly for =LuaTeX= or =LuaLaTeX=. -2. Listing [[lst:require-tex]] also enables [[https://git.savannah.gnu.org/cgit/auctex.git/patch/?id=f464242eab092e610dda6b654e6fd197ef649d3eAA][indenting between square brackets]] +1. Listing [[lst:set-tex-options]] ensures installation of [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] and initializes + [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] properly for =LuaTeX= or =LuaLaTeX=. +2. Listing [[lst:set-tex-options]] also enables [[https://git.savannah.gnu.org/cgit/auctex.git/patch/?id=f464242eab092e610dda6b654e6fd197ef649d3eAA][indenting between square brackets]] which is a recent feature. 3. Listing [[lst:update-lualatex-opentype-font-name-database]] defines a function to update the =OpenType Font= name database for =LuaLaTeX= when the output of =LuaLaTeX= shows missing fonts. -4. Listing [[lst:configure-bibtex]] configures the Emacs =bibtex= library to use the +4. Listing [[lst:set-bibtex-options]] configures the Emacs =bibtex= library to use the LaTeX =BiBTeX= dialect for backwards compatibility. -5. Listing [[lst:configure-font-latex]] disables font scaling of section titles. -6. Listing [[lst:configure-latex]] configures =latex= for a full featured +5. Listing [[lst:set-font-latex-options]] disables font scaling of section titles. +6. Listing [[lst:set-latex-options]] configures =latex= for a full featured =LaTeX-section-command=. -#+caption[Require and configure =TeX=]: -#+caption: Require and configure =TeX=. -#+name: lst:require-tex +#+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 (when (ensure-package-installation 'auctex) ;; Use `require' to make `TeX-master' a safe local variable. (when (require 'tex nil 'noerror) - (custom-set-variables - '(TeX-auto-save t) - '(TeX-engine 'luatex) - '(TeX-indent-close-delimiters "]") - '(TeX-indent-open-delimiters "[") - '(TeX-install-font-lock #'font-latex-setup) - '(TeX-parse-self t) + (setopt + TeX-auto-save t + TeX-engine 'luatex + TeX-indent-close-delimiters "]" + TeX-indent-open-delimiters "[" + TeX-install-font-lock #'font-latex-setup + TeX-parse-self t ;; Disable `TeX-electric-math' to prevent collisions with `smartparens'. - '(TeX-electric-math nil)))) + TeX-electric-math nil))) #+end_src #+caption[Update the =LuaLaTeX OpenType Font= name database]: @@ -1937,35 +1875,33 @@ configuration objectives: (error "%s" (string-trim output)))))) #+end_src -#+caption[Configure =bibtex=]: -#+caption: Configure =bibtex=. -#+name: lst:configure-bibtex +#+caption[Set =bibtex= options]: +#+caption: Set =bibtex= options. +#+name: lst:set-bibtex-options #+begin_src emacs-lisp (with-eval-after-load 'bibtex - (custom-set-variables '(bibtex-dialect 'BibTeX))) + (setopt bibtex-dialect 'BibTeX)) #+end_src -#+caption[Configure =font-latex=]: -#+caption: Configure =font-latex=. -#+name: lst:configure-font-latex +#+caption[Set =font-latex= options]: +#+caption: Set =font-latex= options. +#+name: lst:set-font-latex-options #+begin_src emacs-lisp (with-eval-after-load 'font-latex - (custom-set-variables - '(font-latex-fontify-sectioning 1.0))) + (setopt font-latex-fontify-sectioning 1.0)) #+end_src -#+caption[Configure =latex=]: -#+caption: Configure =latex=. -#+name: lst:configure-latex +#+caption[Set =latex= options]: +#+caption: Set =latex= options. +#+name: lst:set-latex-options #+begin_src emacs-lisp (with-eval-after-load 'latex - (custom-set-variables - '(LaTeX-electric-left-right-brace t) - '(LaTeX-section-hook '(LaTeX-section-heading - LaTeX-section-title - LaTeX-section-toc - LaTeX-section-section - LaTeX-section-label)))) + (setopt LaTeX-electric-left-right-brace t + LaTeX-section-hook '(LaTeX-section-heading + LaTeX-section-title + LaTeX-section-toc + LaTeX-section-section + LaTeX-section-label))) #+end_src *** [[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]] @@ -1976,9 +1912,9 @@ configuration objectives: [[https://gitlab.com/matsievskiysv/math-preview/-/blob/master/README.md][Math-preview]] uses [[https://docs.mathjax.org/en/latest/][Mathjax-3]] to display [[https://www.latex-project.org/][LaTeX]], [[https://www.w3.org/Math/][MathML]],and [[http://asciimath.org/][asciimath]] in Emacs buffers with help of an external [[https://nodejs.org][node.js]] program. -#+caption[Configure =math-preview=]: -#+caption: Configure =math-preview=. -#+name: lst:configure-math-preview +#+caption[Setup =math-preview=]: +#+caption: Setup =math-preview=. +#+name: lst:setup-math-preview #+begin_src emacs-lisp (when (ensure-package-installation 'math-preview) (with-eval-after-load 'math-preview @@ -2031,7 +1967,7 @@ zeromatrix zmat"))) *** TODO Improve the AUCTeX configuration slowly :PROPERTIES: -:CUSTOM_ID: sec:configure-auctex-slowly +:CUSTOM_ID: sec:setup-auctex-slowly :END: [[https://github.com/thisirs/dotemacs/blob/master/lisp/init-auctex.el][AUCTeX setup of an experienced user]] @@ -2061,11 +1997,11 @@ of the [[info:org#Top][Org (info)]] manual. :CUSTOM_ID: sec:activate-org :END: -#+caption[Activate =Org=]: -#+caption: Activate =Org=. -#+name: lst:activate-org +#+caption[Bind =Org= commands globally]: +#+caption: Bind =Org= commands globally. +#+name: lst:bind-org-commands #+begin_src emacs-lisp -(when (cl-every #'fboundp '(org-agenda org-capture)) +(with-eval-after-load 'emacs (global-set-key (kbd "C-c a") #'org-agenda) (global-set-key (kbd "C-c c") #'org-capture) (with-eval-after-load 'ol @@ -2073,41 +2009,41 @@ of the [[info:org#Top][Org (info)]] manual. (global-set-key (kbd "C-c C-l") #'org-insert-link-global))) #+end_src -*** Org customization +*** Setup Org :PROPERTIES: -:CUSTOM_ID: sec:customize-org +:CUSTOM_ID: sec:setup-org :END: -I have split the initial customization of [[https://orgmode.org/][Org-mode]] over several listings. Here, -follows a list detailing and motivating each listing: -1. Listing [[lst:customize-org]] handles basic customization of [[https://orgmode.org/][Org-mode]] variables -2. Listing [[lst:customize-org-babel]] handles basic customization of [[https://orgmode.org/][Org-mode]] - variables specific to [[info:org#Working with Source Code][working with source code (info)]] and it selects the - Python interpreter by means of +I have split the initial [[https://orgmode.org/][Org-mode]] setup over several listings. Here, follows a +list detailing and motivating each listing: +1. Listing [[lst:set-org-options]] handles basic [[https://orgmode.org/][Org-mode]] options. +2. Listing [[lst:set-org-babel-options]] handles basic [[https://orgmode.org/][Org-mode]] options specific to + [[info:org#Working with Source Code][work with source code (info)]] and it + selects the Python interpreter by means of src_emacs-lisp{(choose-common-python-interpreter)} defined in listing [[lst:choose-common-python-interpreter]]. -3. Listing [[lst:customize-org-link]] handle basic customization of [[https://orgmode.org/][Org-mode]] - variables specific to [[info:org#Hyperlinks][hyperlinks (info)]]. -4. Listing [[lst:configure-org-mode-map]] extends the =org-mode-map= with useful +3. Listing [[lst:set-org-link-options]] handles [[https://orgmode.org/][Org-mode]] options specific to + [[info:org#Hyperlinks][hyperlinks (info)]]. +4. Listing [[lst:setup-org-mode-map]] extends the =org-mode-map= with useful key-bindings. -5. Listing [[lst:customize-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]], +5. Listing [[lst:setup-org-src]] facilitates [[info:org#Editing Source Code][editing Python source code blocks]], and it provides a function to remove the indentation of all =org-src-mode= blocks without =-i= switch. -6. Listing [[lst:customize-ob-python]] allows to pretty-print Python session source +6. Listing [[lst:setup-ob-python]] allows to pretty-print Python session source block values with [[https://github.com/psf/black#readme][black]] instead of [[https://docs.python.org/3/library/pprint.html][pprint]]. -7. Listing [[lst:customize-org-export-ui]] selects the =non-intrusive= expert user +7. Listing [[lst:set-org-export-options]] selects the =non-intrusive= expert user interface for export dispatching. -8. Listing [[lst:customize-org-for-lualatex-export]] and - [[lst:customize-ox-latex-for-lualatex-export]] configure [[https://orgmode.org/][Org-mode]] to generate +8. Listing [[lst:setup-org-for-lualatex-export]] and + [[lst:set-ox-latex-options-for-lualatex-export]] configure [[https://orgmode.org/][Org-mode]] to generate output for the LuaLaTeX compiler. -9. Listing [[lst:customize-org-latex-classes]] defines [[info:org#LaTeXspecificexportsettings][org-latex-classes (info)]] for +9. Listing [[lst:setup-org-latex-classes]] defines [[info:org#LaTeXspecificexportsettings][org-latex-classes (info)]] for backward compatibility. See table [[tab:org-latex-class-tag-placeholder]] and type {{{kbd(C-hv org-latex-classes)}}} for an explanation of the code in - listing [[lst:customize-org-latex-classes]]. + listing [[lst:setup-org-latex-classes]]. -#+caption[Customize =Org=]: -#+caption: Customize =Org=. -#+name: lst:customize-org +#+caption[Set basic =Org= options]: +#+caption: Set basic =Org= options. +#+name: lst:set-org-options #+begin_src emacs-lisp (with-eval-after-load 'org (custom-set-variables @@ -2131,74 +2067,69 @@ follows a list detailing and motivating each listing: ,(when (and (fboundp 'choose-common-python-interpreter) (fboundp 'choose-common-python-linter)) '(python . t)) - (shell . t)))) - '(org-export-backends '(ascii beamer html icalendar latex odt texinfo)) - '(org-file-apps '((auto-mode . emacs) - (directory . emacs) - ("\\.mm\\'" . default) - ("\\.x?html?\\'" . default) - ("\\.pdf\\'" . emacs))) - '(org-modules '(ol-bibtex - ol-doi - ol-eww - ol-info - org-id - org-protocol - org-tempo)) - '(org-structure-template-alist '(("a" . "export ascii") - ("c" . "center") - ("C" . "comment") - ("e" . "example") - ("E" . "export") - ("h" . "export html") - ("l" . "export latex") - ("q" . "quote") - ("s" . "src") - ("p" . "src python -i :session") - ("v" . "verse"))))) + (shell . t))))) + (setopt + org-export-backends '(ascii beamer html icalendar latex odt texinfo) + org-file-apps '((auto-mode . emacs) + (directory . emacs) + ("\\.mm\\'" . default) + ("\\.x?html?\\'" . default) + ("\\.pdf\\'" . emacs)) + org-modules '(ol-bibtex + ol-doi + ol-eww + ol-info + org-id + org-protocol + org-tempo) + org-structure-template-alist '(("a" . "export ascii") + ("c" . "center") + ("C" . "comment") + ("e" . "example") + ("E" . "export") + ("h" . "export html") + ("l" . "export latex") + ("q" . "quote") + ("s" . "src") + ("p" . "src python -i :session") + ("v" . "verse")))) #+end_src -#+caption[Customize =org-babel=]: -#+caption: Customize =org-babel=. -#+name: lst:customize-org-babel +#+caption[Set =org-babel= options]: +#+caption: Set =org-babel=. +#+name: lst:set-org-babel-options #+begin_src emacs-lisp (with-eval-after-load 'ob-core - (custom-set-variables - '(org-confirm-babel-evaluate nil))) + (setopt org-confirm-babel-evaluate nil)) (with-eval-after-load 'ob-latex - (custom-set-variables - '(org-babel-latex-preamble - (lambda (_) - "\\documentclass[preview]{standalone}\n")) - '(org-babel-latex-begin-env - (lambda (_) - "\\begin{document}\n")) - '(org-babel-latex-end-env - (lambda (_) - "\\end{document}\n")))) + (setopt + org-babel-latex-preamble (lambda (_) + "\\documentclass[preview]{standalone}\n") + org-babel-latex-begin-env (lambda (_) + "\\begin{document}\n") + org-babel-latex-end-env (lambda (_) + "\\end{document}\n"))) (with-eval-after-load 'ob-lisp (with-eval-after-load 'sly - (custom-set-variables - '(org-babel-lisp-eval-fn #'sly-eval)))) + (setopt org-babel-lisp-eval-fn #'sly-eval))) (with-eval-after-load 'ob-python (choose-common-python-interpreter 'python)) #+end_src -#+caption[Customize =org-link=]: -#+caption: Customize =org-link=. -#+name: lst:customize-org-link +#+caption[Set =org-link= options]: +#+caption: Set =org-link= options. +#+name: lst:set-org-link-options #+begin_src emacs-lisp (with-eval-after-load 'ol - (custom-set-variables - '(org-link-file-path-type 'relative))) + (setopt org-link-file-path-type 'relative)) #+end_src -#+caption[Configure =org-mode-map=]: -#+caption: Configure =org-mode-map=. -#+name: lst:configure-org-mode-map +#+caption[Setup =org-mode-map=]: +#+caption: Setup =org-mode-map=. +#+name: lst:setup-org-mode-map #+begin_src emacs-lisp (with-eval-after-load 'emacs ;; From: "Nicolas Richard" @@ -2242,14 +2173,13 @@ When called twice, replace the previously inserted \\(\\) by one $." (define-key org-mode-map (kbd "M-q") #'org-fill-paragraph))) #+end_src -#+caption[Customize =org-src=]: -#+caption: Customize =org-src=. -#+name: lst:customize-org-src +#+caption[Setup =org-src=]: +#+caption: Setup =org-src=. +#+name: lst:setup-org-src #+begin_src emacs-lisp (with-eval-after-load 'emacs (with-eval-after-load 'org-src - (custom-set-variables - '(org-src-preserve-indentation t))) + (setopt org-src-preserve-indentation t)) (declare-function org-babel-map-src-blocks "ext:ob-core" (file &rest body)) (declare-function org-do-remove-indentation "ext:org-macs" (n skip-fl)) @@ -2272,9 +2202,9 @@ When called twice, replace the previously inserted \\(\\) by one $." (insert new)))))))) #+end_src -#+caption[Customize =ob-python=]: -#+caption: Customize =ob-python=. -#+name: lst:customize-ob-python +#+caption[Setup =ob-python=]: +#+caption: Setup =ob-python=. +#+name: lst:setup-ob-python #+begin_src emacs-lisp (with-eval-after-load 'ob-python (defun org-babel-python-format-session-value-override @@ -2311,18 +2241,17 @@ else: :override #'org-babel-python-format-session-value-override)) #+end_src -#+caption[Customize =org-export=]: -#+caption: Customize =org-export=. -#+name: lst:customize-org-export-ui +#+caption[Set =org-export= options]: +#+caption: Set =org-export= options. +#+name: lst:set-org-export-options #+begin_src emacs-lisp (with-eval-after-load 'ox - (custom-set-variables - '(org-export-dispatch-use-expert-ui t))) + (setopt org-export-dispatch-use-expert-ui t)) #+end_src -#+caption[Customize =org= for export to LuaLaTeX]: -#+caption: Customize =org= for export to LuaLaTeX. -#+name: lst:customize-org-for-lualatex-export +#+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 (with-eval-after-load 'org ;; https://list.orgmode.org/87o84fd4oi.fsf@posteo.net/ @@ -2339,34 +2268,30 @@ else: :latex-header nil :latex-compiler ("lualatex -interaction nonstopmode -output-directory %o %f") :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O"))) - (custom-set-variables - '(org-preview-latex-default-process 'luamagick) - '(org-latex-default-packages-alist '(("" "fontspec" t ("lualatex")) - ("AUTO" "inputenc" t ("pdflatex")) - ("T1" "fontenc" t ("pdflatex")) - ("" "graphicx" t) - ("" "longtable" nil) - ("" "wrapfig" nil) - ("" "rotating" nil) - ("normalem" "ulem" t) - ("" "amsmath" t) - ("" "amssymb" t) - ("" "capt-of" nil) - ("" "hyperref" nil))))) + (setopt + org-preview-latex-default-process 'luamagick + org-latex-default-packages-alist '(("" "fontspec" t ("lualatex")) + ("AUTO" "inputenc" t ("pdflatex")) + ("T1" "fontenc" t ("pdflatex")) + ("" "graphicx" t) + ("" "longtable" nil) + ("" "wrapfig" nil) + ("" "rotating" nil) + ("normalem" "ulem" t) + ("" "amsmath" t) + ("" "amssymb" t) + ("" "capt-of" nil) + ("" "hyperref" nil)))) #+end_src -#+caption[Customize =ox-latex= for export to LuaLaTeX]: -#+caption: Customize =ox-latex= for export to LuaLaTeX. -#+name: lst:customize-ox-latex-for-lualatex-export +#+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 (with-eval-after-load 'ox-latex - (custom-set-variables - '(org-latex-pdf-process - ;; https://tecosaur.github.io/emacs-config/#compiling - `(,(concat "latexmk -f -pdf -%latex" - " -interaction=nonstopmode -shell-escape -outdir=%o %f"))) - '(org-latex-compiler "lualatex") - '(org-latex-hyperref-template "\\hypersetup{ + (setopt + org-latex-compiler "lualatex" + org-latex-hyperref-template "\\hypersetup{ pdfauthor={%a}, pdftitle={%t}, pdfkeywords={%k}, @@ -2380,28 +2305,30 @@ else: linkcolor=blue, unicode=true, urlcolor=blue, -}\n") - `,(if (version< emacs-version "29.0.0") - '(org-latex-listings 'minted) - '(org-latex-src-block-backend 'minted)) - '(org-latex-minted-langs '((cc "c++") - (conf "text") - (cperl "perl") - (diff "diff") - (shell-script "bash") - (json "json") - (org "text") - (toml "toml"))) - '(org-latex-minted-options '(("bgcolor" "LightGoldenrodYellow"))) - `(org-latex-logfiles-extensions - ',(cl-union '("lof" "lot") org-latex-logfiles-extensions :test #'equal)) - '(org-latex-prefer-user-labels t) - '(org-latex-subtitle-separate t))) +}\n" + org-latex-src-block-backend 'minted + org-latex-minted-langs '((cc "c++") + (conf "text") + (cperl "perl") + (diff "diff") + (shell-script "bash") + (json "json") + (org "text") + (toml "toml")) + org-latex-minted-options '(("bgcolor" "LightGoldenrodYellow")) + org-latex-logfiles-extensions + (cl-union '("lof" "lot") org-latex-logfiles-extensions :test #'equal) + ;; https://tecosaur.github.io/emacs-config/#compiling + org-latex-pdf-process (list (concat "latexmk -f -pdf -%latex" + " -interaction=nonstopmode" + " -shell-escape -outdir=%o %f")) + org-latex-prefer-user-labels t + org-latex-subtitle-separate t)) #+end_src -#+caption[Customize =org-latex-classes= for backwards compatibility]: -#+caption: Customize =org-latex-classes= for backwards compatibility. -#+name: lst:customize-org-latex-classes +#+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 (with-eval-after-load 'ox-latex (mapc (function (lambda (element) @@ -2450,8 +2377,8 @@ else: #+end_src #+attr_latex: :booktabs yes :float table -#+caption[The relation tag-placeholder in listing [[lst:customize-org-latex-classes]]]: -#+caption: The relation tag-placeholder in listing [[lst:customize-org-latex-classes]]. +#+caption[The relation tag-placeholder in listing [[lst:setup-org-latex-classes]]]: +#+caption: The relation tag-placeholder in listing [[lst:setup-org-latex-classes]]. #+name: tab:org-latex-class-tag-placeholder | tag | placeholder | |-----+-----------------------| @@ -2471,20 +2398,19 @@ else: well as CSL JSON bibliographic data with LaTeX, markdown, and org-cite editing support. In combination with vertico, embark, marginalia, and consult, [[https://github.com/bdarcus/citar][Citar]] provides quick filtering and selecting of bibliographic entries from the -minibuffer, as well as the option to run different commands on those +minibuffer as well as the option to run different commands on those selections. The article [[https://kristofferbalintona.me/posts/202206141852/][Citations in org-mode: Org-cite and Citar]] tries to walk you from understanding the general context (bibliography producer, text processor, text to product convertor) to an Emacs setup. Listing -[[lst:configure-oc-cite+citar]] shows my =org-cite=, =citar=, and =org= -configuration. +[[lst:set-org-cite+citar-options]] shows my =org-cite=, =citar=, and =org= setup. -#+caption[Configure =org-cite= with =citar=]: -#+caption: Configure =oc-cite= with =citar=. -#+name: lst:configure-oc-cite+citar +#+caption[Set =org-cite= and =citar= options]: +#+caption: Set =org-cite= and =citar= options. +#+name: lst:set-org-cite+citar-options #+begin_src emacs-lisp (with-eval-after-load 'oc ;; Org-9.5 needs the requirements, but Org-9.6 does not. - (when (version< (org-version) "9.5.99") + (when (version< (org-version) "9.6") (require 'oc-biblatex) (require 'oc-csl))) @@ -2497,22 +2423,19 @@ configuration. (citar-embark-mode +1))) (when (require 'citar nil 'noerror) - (custom-set-variables - '(citar-bibliography '("~/VCS/research/refs.bib")) - '(citar-library-file-extensions '("djvu" "pdf")) - '(citar-library-paths '("~/VCS/research/papers/")))) + (setopt citar-bibliography '("~/VCS/research/refs.bib") + citar-library-file-extensions '("djvu" "pdf") + citar-library-paths '("~/VCS/research/papers/"))) (with-eval-after-load 'oc - (custom-set-variables - '(org-cite-export-processors '((latex biblatex) - (t csl))) - '(org-cite-global-bibliography '("~/VCS/research/refs.bib"))) + (setopt org-cite-export-processors '((latex biblatex) + (t csl)) + org-cite-global-bibliography '("~/VCS/research/refs.bib")) (when (require 'citar nil 'noerror) - (custom-set-variables - '(org-cite-activate-processor 'citar) - '(org-cite-follow-processor 'citar) - '(org-cite-insert-processor 'citar))))) + (setopt org-cite-activate-processor 'citar + org-cite-follow-processor 'citar + org-cite-insert-processor 'citar)))) #+end_src Ref. [cite:@Schulte.MCSE.2011.41] shows that [[https://orgmode.org/][Org-mode]] is a simple, plain-text @@ -2624,7 +2547,7 @@ this facility to a level acceptable for my workflow: (defun org-latex-engraved-source-block-filter (data _backend _info) "Replace \"Code\" with \"Breakable\" in non-floating environments. -Customize `org-latex-engraved-preamble' to define a Breakable (non-floating) +Set `org-latex-engraved-preamble' to define a Breakable (non-floating) environment and an unbreakable Code (floating) environment." (unless (string-match "^\\\\DeclareTColorBox\\[\\]{Breakable}" org-latex-engraved-preamble) @@ -3290,8 +3213,7 @@ prefixes all lines with \"#+latex_header: \"." '((:exports . "results") (:results . "raw"))) (with-eval-after-load 'org-src - (custom-set-variables - '(org-src-window-setup 'current-window)) + (setopt org-src-window-setup 'current-window) (add-to-list 'org-src-lang-modes '("toml" . conf-toml)) (add-to-list 'org-src-lang-modes '("latex-header" . latex)) @@ -3896,15 +3818,14 @@ etymology, or thesaurus back-ends (currently limited to [[https://en.wikipedia.o ;; http://download.huzheng.org/dict.org/stardict-dictd_www.dict.org_gcide-2.4.2.tar.bz2 (with-eval-after-load 'lexic (if-let ((lpp (executable-find "sdcv"))) - (custom-set-variables - '(lexic-program-path lpp) - '(lexic-dictionary-alist '(("full" . t))) + (setopt + lexic-program-path lpp + lexic-dictionary-alist '(("full" . t)) ;; sdcv --data-dir .local/share -l - '(lexic-dictionary-list - '("Webster's Revised Unabridged Dictionary (1913)" - "dictd_www.dict.org_gcide")) - '(lexic-dictionary-path "~/.local/share")) - (message "`lexic' fails to find the `sdcv' executable")))) + lexic-dictionary-list '("Webster's Revised Unabridged Dictionary (1913)" + "dictd_www.dict.org_gcide") + lexic-dictionary-path "~/.local/share") + (message "`lexic' fails to find the `sdcv' executable")))) #+end_src *** [[https://wordnet.princeton.edu/][Wordnet]] :noexport: @@ -3923,8 +3844,7 @@ the [[https://github.com/gromnitsky/wordnut#readme][wordnut]] prerequisites. (when (ensure-package-installation 'wordnut) (with-eval-after-load 'wordnut (if-let ((wn (executable-find "wn"))) - (custom-set-variables - '(wordnut-cmd wn)) + (setopt wordnut-cmd wn) (message "`wordnut' fails to find the `wn' executable")))) #+end_src @@ -3982,9 +3902,6 @@ mode independent [[https://github.com/joaotavora/eglot][Eglot]] configuration: #+name: lst:minimal-eglot-setup #+begin_src emacs-lisp (with-eval-after-load 'emacs - (when (version< emacs-version "29.0.0") - (ensure-package-installation 'eglot)) - ;; Replace `nil' with `t' for debugging. (when nil (when (require 'eglot nil t) @@ -3992,19 +3909,19 @@ mode independent [[https://github.com/joaotavora/eglot][Eglot]] configuration: `(((python-ts-mod python-mode) . ,(eglot-alternatives '(("pylsp" "-vv") - ("ruff-lsp")))))))) + ("ruff-lsp"))))))))) - (with-eval-after-load 'eglot - (define-key eglot-mode-map (kbd "C-c n") 'flymake-goto-next-error) - (define-key eglot-mode-map (kbd "C-c p") 'flymake-goto-prev-error) - (define-key eglot-mode-map (kbd "C-c r") 'eglot-rename))) +(with-eval-after-load 'eglot + (define-key eglot-mode-map (kbd "C-c n") 'flymake-goto-next-error) + (define-key eglot-mode-map (kbd "C-c p") 'flymake-goto-prev-error) + (define-key eglot-mode-map (kbd "C-c r") 'eglot-rename)) #+end_src #+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 -(when (fboundp 'eglot-ensure) +(with-eval-after-load 'emacs (defcustom eglot-maybe-ensure-modes '(python-mode) "Modes where maybe `eglot-ensure' should be or has been called. This may be in the case of proper directory local variables or in @@ -4049,7 +3966,7 @@ the Org-mode source block code before calling `eglot-ensure'." #+caption: Setup Python =org-src-mode= buffers for =eglot=. #+name: lst:setup-python-org-src-mode-for-eglot #+begin_src emacs-lisp -(when (fboundp 'eglot-ensure) +(with-eval-after-load 'emacs ;; https://www.reddit.com/r/emacs/comments/w4f4u3 ;; /using_rustic_eglot_and_orgbabel_for_literate/ (defun undo-eglot-org-babel-edit-prep() @@ -4079,8 +3996,7 @@ This is to advice `org-edit-src-exit' and `org-edit-src-save'." #+caption: Experimental =narrow-format-all:python=. #+name: lst:narrow-format-all-python #+begin_src emacs-lisp -(when (and (fboundp 'eglot-ensure) - (fboundp 'format-all-buffer)) +(when (fboundp 'format-all-buffer) (defun narrow-format-all:python () "Format narrowed Python `org-src-mode' buffers correctly. Use this function instead of `format-all-buffer' on `org-babel-edit-prep:python' @@ -4113,7 +4029,7 @@ prepared buffers." #+caption: Start =eglot= in case of a proper =dir-local-variables-alist=. #+name: lst:eglot-maybe-ensure #+begin_src emacs-lisp -(when (fboundp 'eglot-ensure) +(with-eval-after-load 'emacs (defun eglot-maybe-ensure () (when (and (apply #'derived-mode-p eglot-maybe-ensure-modes) (assoc 'eglot-workspace-configuration dir-local-variables-alist)) @@ -4195,15 +4111,16 @@ Listing [[lst:sbcl-core-for-sly]] tangles to a script to dump such a [[http://ww #+begin_src emacs-lisp (when (ensure-package-installation 'sly) (with-eval-after-load 'sly - (custom-set-variables - ;; Customize `sly-default-lisp' instead of `inferior-lisp-program', - ;; because `sly' uses `inferior-lisp-program' only as a backwards - ;; compatibility fallback option. - '(sly-default-lisp 'sbcl) - `(sly-lisp-implementations - '((sbcl (,(executable-find "sbcl") - "--core" - ,(no-littering-expand-var-file-name "sbcl.core-for-sly")))))) + ;; Set `sly-default-lisp' instead of `inferior-lisp-program', + ;; because `sly' uses `inferior-lisp-program' only as a backwards + ;; compatibility fallback option. + ;; The warning "Value ‘sbcl’ does not match type function" is due to + ;; the buggy `defcustom' type of `sbcl-default-lisp' in `sly.el'. + (setopt sly-default-lisp 'sbcl + sly-lisp-implementations + `((sbcl (,(executable-find "sbcl") + "--core" + ,(no-littering-expand-var-file-name "sbcl.core-for-sly"))))) (add-hook 'sly-mode-hook (defun on-sly-mode-hook () @@ -4323,7 +4240,7 @@ Here is a list of links describing how to program and debug [[info:elisp#Top][Em Ref. [cite:@Monnier.ACM-PL.4.1] exposes the evolution of Emacs Lisp and explains many Emacs Lisp idioms. -Listing [[lst:setup-ielm][setup ielm]] customizes the [[https://wikemacs.org/wiki/IELM][Interactive Emacs Lisp Mode]] for better +Listing [[lst:setup-ielm][setup ielm]] configures the [[https://wikemacs.org/wiki/IELM][Interactive Emacs Lisp Mode]] for better interoperability with [[https://smartparens.readthedocs.io/en/latest/][Smartparens]]: get help on the key bindings by means of src_emacs-lisp{(describe-function 'inferior-emacs-lisp-mode)}. @@ -4511,32 +4428,28 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][ (when (boundp 'org-babel-python-command) (pcase choice ("python" - (custom-set-variables - `(org-babel-python-command - ,(concat (or (executable-find "python3") - (executable-find "python")) - " -E")))) + (setopt org-babel-python-command + (concat (or (executable-find "python3") + (executable-find "python")) + " -E"))) ("ipython" - (custom-set-variables - `(org-babel-python-command - ,(concat (or (executable-find "ipython3") - (executable-find "ipython")) - " --simple-prompt --HistoryAccessor.enabled=False"))))) + (setopt org-babel-python-command + (concat (or (executable-find "ipython3") + (executable-find "ipython")) + " --simple-prompt --HistoryAccessor.enabled=False")))) (message "Now `org-babel-python-command' equals %S" org-babel-python-command)) (when (boundp 'python-shell-interpreter) (pcase choice ("python" - (custom-set-variables - `(python-shell-interpreter - ,(or (executable-find "python3") (executable-find "python"))) - '(python-shell-interpreter-args "-E -i"))) + (setopt python-shell-interpreter (or (executable-find "python3") + (executable-find "python")) + python-shell-interpreter-args "-E -i")) ("ipython" - (custom-set-variables - `(python-shell-interpreter - ,(or (executable-find "ipython3") (executable-find "ipython")))) - (setq python-shell-interpreter-args - "--simple-prompt --HistoryAccessor.enabled=False"))) + (setopt python-shell-interpreter (or (executable-find "ipython3") + (executable-find "ipython")) + python-shell-interpreter-args + "--simple-prompt --HistoryAccessor.enabled=False"))) (message "Now `python-shell-interpreter' equals %S" python-shell-interpreter)))) #+end_src @@ -4558,18 +4471,15 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][ (when (and (boundp 'python-check-command) (boundp 'python-flymake-command)) (pcase choice ("flake8-nocolor" - (custom-set-variables - `(python-check-command ,(executable-find choice)) - `(python-flymake-command (list ,(executable-find choice) "-")))) + (setopt python-check-command (executable-find choice) + python-flymake-command (list (executable-find choice) "-"))) ("pyflakes" - (custom-set-variables - `(python-check-command ,(executable-find choice)) - `(python-flymake-command `(,(executable-find choice))))) + (setopt python-check-command (executable-find choice) + python-flymake-command `(,(executable-find choice)))) ("ruff-nocolor" - (custom-set-variables - `(python-check-command ,(executable-find choice)) - `(python-flymake-command - (list ,(executable-find choice) "--stdin-filename" "stdin" "-"))))) + (setopt python-check-command (executable-find choice) + python-flymake-command (list (executable-find choice) + "--stdin-filename" "stdin" "-")))) (when (bound-and-true-p python-check-custom-command) (setq python-check-custom-command nil)) (message "Python checker commands are %S and %S" @@ -4581,9 +4491,9 @@ Finally, listing [[lst:flake8-nocolor][flake8-nocolor]] and [[lst:ruff-nocolor][ #+name: lst:setup-python-mode #+begin_src emacs-lisp (with-eval-after-load 'python - (custom-set-variables - '(python-indent-guess-indent-offset nil) - '(python-shell-completion-native-disabled-interpreters '("ipython3" "pypy"))) + (setopt python-indent-guess-indent-offset nil + python-shell-completion-native-disabled-interpreters '("ipython3" + "pypy")) (choose-common-python-interpreter 'python) (choose-common-python-linter 'ruff-nocolor)) #+end_src @@ -5026,8 +4936,7 @@ setup and requires no configuration. #+begin_src emacs-lisp (when (and (ensure-package-installation 'ws-butler) (require 'ws-butler nil 'noerror)) - (custom-set-variables - '(ws-butler-keep-whitespace-before-point nil)) + (setopt ws-butler-keep-whitespace-before-point nil) (add-hook 'prog-mode-hook #'ws-butler-mode) (add-hook 'text-mode-hook #'ws-butler-mode)) #+end_src @@ -5080,10 +4989,9 @@ contrary to for instance [[https://github.com/Fanael/rainbow-delimiters#readme][ ;; Require `smartparens-config' instead of `smartparens' to ;; disable pairing of the quote character for lisp modes. (require 'smartparens-config nil 'noerror)) - (custom-set-variables - '(sp-base-key-bindings 'sp) - '(sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) - ("C-)" . sp-forward-slurp-sexp)))) + (setopt sp-base-key-bindings 'sp + sp-override-key-bindings '(("C-(" . sp-backward-barf-sexp) + ("C-)" . sp-forward-slurp-sexp))) (dolist (hook '(conf-toml-mode-hook prog-mode-hook text-mode-hook)) (add-hook hook #'smartparens-mode)) @@ -5139,9 +5047,8 @@ code formatter for Python]]. #+name: lst:enable-yas-global-mode #+begin_src emacs-lisp (when (ensure-package-installation 'yasnippet) - (custom-set-variables - ;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'. - '(yas-alias-to-yas/prefix-p nil)) + ;; Set `yas-alias-to-yas/prefix-p' before loading `yasnippet'. + (setopt yas-alias-to-yas/prefix-p nil) (when (require 'yasnippet nil 'noerror) (yas-global-mode +1))) #+end_src @@ -5168,8 +5075,7 @@ and later. Listing [[lst:setup-python-tempo]] configures =tempo= for =python-mo #+name: lst:configure-tempo-ui #+begin_src emacs-lisp (with-eval-after-load 'tempo - (custom-set-variables - '(tempo-interactive t)) + (setopt tempo-interactive t) (defun setup-local-tempo-key-bindings () "Initialize local `tempo' key bindings." @@ -5290,7 +5196,7 @@ on any Org table, Org source block, Org block, or Org subtree. #+name: lst:configure-narrow-or-widen-dwim #+begin_src emacs-lisp (with-eval-after-load 'emacs - (autoload 'org-at-table-p "org-table") + (declare-function org-at-table-p "org" (&optional table-type)) (defun org-narrow-to-table () "Narrow buffer to table at point." @@ -5346,16 +5252,14 @@ and names in buffers for debugging. #+begin_src emacs-lisp (when (and (ensure-package-installation 'rainbow-mode) (fboundp 'rainbow-mode)) - (custom-set-variables - '(rainbow-x-colors-major-mode-list - '(c++-mode - c-mode - emacs-lisp-mode - inferior-emacs-lisp-mode - java-mode - lisp-interaction-mode - org-mode - python-mode))) + (setopt rainbow-x-colors-major-mode-list '(c++-mode + c-mode + emacs-lisp-mode + inferior-emacs-lisp-mode + java-mode + lisp-interaction-mode + org-mode + python-mode)) (rainbow-mode +1)) #+end_src @@ -5424,12 +5328,11 @@ Listing [[lst:configure-browse-url]] configures =browse-url=. (seq (+? nonl) (or ".mp4" ".webm") eos))) "Match hyperlinks to open with mpv.") - (custom-set-variables - `(browse-url-generic-program ,(or (when (eq system-type 'darwin) "open") - (executable-find "firefox"))) - '(browse-url-handlers - `((,browse-url-mpv-regexp . browse-url-mpv) - ("." . eww-browse-url))))) + (setopt + browse-url-generic-program (or (when (eq system-type 'darwin) "open") + (executable-find "firefox")) + browse-url-handlers `((,browse-url-mpv-regexp . browse-url-mpv) + ("." . eww-browse-url)))) #+end_src *** [[https://en.wikipedia.org/wiki/Eww_(web_browser)][Emacs Web Wowser]] @@ -5572,50 +5475,50 @@ application/pdf; emacsclient %s :CUSTOM_ID: sec:webjump :END: -Listing [[lst:configure-webjump]] binds {{{kbd(C-c j)}}} to =webjump= and -initializes a list of =webjump-sites=. +Listing [[lst:set-webjump-options]] binds {{{kbd(C-c j)}}} to =webjump= and +sets the =webjump-sites= option. #+attr_latex: :options breaklines -#+caption[Configure =webjump=]: -#+caption: Configure =webjump=. -#+name: lst:configure-webjump +#+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 (when (fboundp 'webjump) (global-set-key (kbd "C-c j") 'webjump) (with-eval-after-load 'webjump - (custom-set-variables - '(webjump-sites - '(("CS 325 AI Programming" . "courses.cs.northwestern.edu/325") - ("Emacs News" . "sachachua.com/blog/category/emacs-news") - ("Mastering Emacs" . "www.masteringemacs.org") - ("Planet Emacs Life" . "planet.emacslife.com") - ("Real Python" . "realpython.com") - ("Worg - Org Mode Community" . "orgmode.org/worg") - ("Git: Emacs" . "git.savannah.gnu.org/cgit/emacs.git") - ("Git: Emacs Core Python Mode" . - "git.savannah.gnu.org/cgit/emacs.git/log/lisp/progmodes/python.el") - ("Git: GNU ELPA" . "git.savannah.gnu.org/cgit/emacs/elpa.git") - ("Git: NonGNU ELPA" . "git.savannah.gnu.org/cgit/emacs/nongnu.git") - ("Git: Org Mode" . "git.savannah.gnu.org/cgit/emacs/org-mode.git") - ("List: Org Mode" . "list.orgmode.org") - ("List: Emacs Developer Archives" . - "lists.gnu.org/archive/html/emacs-devel/") - ("List: Help GNU Emacs Archives" . - "lists.gnu.org/archive/html/help-gnu-emacs/") - ("Asian Pacific Journal Japan Focus" . "apjjf.org") - ("Counterpunch" . "www.counterpunch.org") - ("Dictionary FR" . [simple-query "www.cnrtl.fr" - "www.cnrtl.fr/definition/" ""]) - ("Dictionary NL" . [simple-query "www.woorden.org" - "www.woorden.org/woord/" ""]) - ("Le Figaro" . "www.lefigaro.fr") - ("Le Monde" . "www.lemonde.fr") - ("Libération" . "www.liberation.fr") - ("Monde Diplomatique" . "www.monde-diplomatique.fr") - ("NRC". "www.nrc.nl") - ("The Guardian" . "www.theguardian.com/international") - ("Trouw" . "www.trouw.nl") - ("Volkskrant" . "www.volkskrant.nl")))))) + (setopt + webjump-sites + '(("CS 325 AI Programming" . "courses.cs.northwestern.edu/325") + ("Emacs News" . "sachachua.com/blog/category/emacs-news") + ("Mastering Emacs" . "www.masteringemacs.org") + ("Planet Emacs Life" . "planet.emacslife.com") + ("Real Python" . "realpython.com") + ("Worg - Org Mode Community" . "orgmode.org/worg") + ("Git: Emacs" . "git.savannah.gnu.org/cgit/emacs.git") + ("Git: Emacs Core Python Mode" . + "git.savannah.gnu.org/cgit/emacs.git/log/lisp/progmodes/python.el") + ("Git: GNU ELPA" . "git.savannah.gnu.org/cgit/emacs/elpa.git") + ("Git: NonGNU ELPA" . "git.savannah.gnu.org/cgit/emacs/nongnu.git") + ("Git: Org Mode" . "git.savannah.gnu.org/cgit/emacs/org-mode.git") + ("List: Org Mode" . "list.orgmode.org") + ("List: Emacs Developer Archives" . + "lists.gnu.org/archive/html/emacs-devel/") + ("List: Help GNU Emacs Archives" . + "lists.gnu.org/archive/html/help-gnu-emacs/") + ("Asian Pacific Journal Japan Focus" . "apjjf.org") + ("Counterpunch" . "www.counterpunch.org") + ("Dictionary FR" . [simple-query "www.cnrtl.fr" + "www.cnrtl.fr/definition/" ""]) + ("Dictionary NL" . [simple-query "www.woorden.org" + "www.woorden.org/woord/" ""]) + ("Le Figaro" . "www.lefigaro.fr") + ("Le Monde" . "www.lemonde.fr") + ("Libération" . "www.liberation.fr") + ("Monde Diplomatique" . "www.monde-diplomatique.fr") + ("NRC". "www.nrc.nl") + ("The Guardian" . "www.theguardian.com/international") + ("Trouw" . "www.trouw.nl") + ("Volkskrant" . "www.volkskrant.nl"))))) #+end_src ** [[info:gnus#Top][Reading News and Mail (info)]] @@ -5652,22 +5555,19 @@ initializes a list of =webjump-sites=. #+name: lst:configure-gnus #+begin_src emacs-lisp (with-eval-after-load 'gnus - (custom-set-variables - '(gnus-select-method '(nntp "news.gmane.io")))) + (setopt gnus-select-method '(nntp "news.gmane.io"))) (with-eval-after-load 'gnus-start - (custom-set-variables - '(gnus-check-bogus-newsgroups nil) - '(gnus-check-new-newsgroups 'ask-server) - '(gnus-read-newsrc-file t) - '(gnus-read-active-file 'some) - '(gnus-save-killed-list t) - '(gnus-save-newsrc-file t) - '(gnus-use-dribble-file t))) + (setopt gnus-check-bogus-newsgroups nil + gnus-check-new-newsgroups 'ask-server + gnus-read-newsrc-file t + gnus-read-active-file 'some + gnus-save-killed-list t + gnus-save-newsrc-file t + gnus-use-dribble-file t)) (with-eval-after-load 'gnus-sum - (custom-set-variables - '(gnus-thread-hide-subtree t))) + (setopt gnus-thread-hide-subtree t)) #+end_src ** [[info:emacs#Sending Mail][Sending Mail (info)]] @@ -5687,12 +5587,10 @@ initializes a list of =webjump-sites=. #+caption: Configure =message=. #+name: lst:configure-message #+begin_src emacs-lisp -(custom-set-variables - '(user-full-name "Gerard Vermeulen") - '(user-mail-address "gerard.vermeulen@posteo.net")) +(setopt user-full-name "Gerard Vermeulen" + user-mail-address "gerard.vermeulen@posteo.net") (with-eval-after-load 'message - (custom-set-variables - '(message-sendmail-envelope-from 'header))) + (setopt message-sendmail-envelope-from 'header)) #+end_src #+caption[Configure =sendmail=]: @@ -5700,11 +5598,10 @@ initializes a list of =webjump-sites=. #+name: lst:configure-sendmail #+begin_src emacs-lisp (with-eval-after-load 'sendmail - (custom-set-variables - '(mail-specify-envelope-from t) - '(mail-envelope-from 'header) - '(send-mail-function #'sendmail-send-it) - `(sendmail-program ,(executable-find "msmtp")))) + (setopt mail-specify-envelope-from t + mail-envelope-from 'header + send-mail-function #'sendmail-send-it + sendmail-program (executable-find "msmtp"))) #+end_src #+attr_latex: :options breaklines @@ -5778,41 +5675,40 @@ user gerard.vermeulen@neel.cnrs.fr :CUSTOM_ID: sec:emacs-web-feed-reader :END: -Listing [[lst:configure-elfeed]] configures =elfeed= and makes a minimal attempt to -enable =emms=. +Listing [[lst:set-elfeed-options]] sets =elfeed= options, binds the =elfeed= +command, and makes a minimal attempt to enable =emms=. #+attr_latex: :options breaklines -#+caption[Configure =elfeed=]: -#+caption: Configure =elfeed=. -#+name: lst:configure-elfeed +#+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 (when (and (ensure-package-installation 'elfeed) (fboundp 'elfeed)) (global-set-key (kbd "C-x w") #'elfeed) (with-eval-after-load 'elfeed - (custom-set-variables - '(elfeed-feeds - '(("http://www.howardism.org/index.xml" h-abrams) - ("https://bitspook.in/archive/feed.xml" c-singh) - ("https://emacshorrors.com/feed.atom" v-schneidermann) - ("https://emacsninja.com/emacs.atom" v-schneidermann) - ("https://feeds.feedburner.com/InterceptedWithJeremyScahill" - j-scahill) - ("https://frame.work/fr/fr/blog.rss" framework) - ("https://nullprogram.com/feed/" c-wellons) - ("https://oremacs.com/atom.xml" o-krehel) - ("https://planet.emacslife.com/atom.xml" planet-emacs) - ("https://protesilaos.com/codelog.xml" p-stavrou) - ("https://sachachua.com/blog/category/emacs/feed" s-chua) - ("https://sciencescitoyennes.org/feed/" sciences) - ("https://tdodge.consulting/blog/rss.xml" t-dodge) - ("https://talkpython.fm/episodes/rss" talk-python) - ("https://updates.orgmode.org/feed/updates" org-updates) - ("https://www.bof.nl/rss/" bof) - ("https://www.democracynow.org/podcast-video.xml" dn) - ("https://www.laquadrature.net/fr/rss.xml" lqdn) - ("https://www.lemonde.fr/blog/huet/feed/" sciences))))) + (setopt + elfeed-feeds + '(("http://www.howardism.org/index.xml" h-abrams) + ("https://bitspook.in/archive/feed.xml" c-singh) + ("https://emacshorrors.com/feed.atom" v-schneidermann) + ("https://emacsninja.com/emacs.atom" v-schneidermann) + ("https://feeds.feedburner.com/InterceptedWithJeremyScahill" j-scahill) + ("https://frame.work/fr/fr/blog.rss" framework) + ("https://nullprogram.com/feed/" c-wellons) + ("https://oremacs.com/atom.xml" o-krehel) + ("https://planet.emacslife.com/atom.xml" planet-emacs) + ("https://protesilaos.com/codelog.xml" p-stavrou) + ("https://sachachua.com/blog/category/emacs/feed" s-chua) + ("https://sciencescitoyennes.org/feed/" sciences) + ("https://tdodge.consulting/blog/rss.xml" t-dodge) + ("https://talkpython.fm/episodes/rss" talk-python) + ("https://updates.orgmode.org/feed/updates" org-updates) + ("https://www.bof.nl/rss/" bof) + ("https://www.democracynow.org/podcast-video.xml" dn) + ("https://www.laquadrature.net/fr/rss.xml" lqdn) + ("https://www.lemonde.fr/blog/huet/feed/" sciences)))) (with-eval-after-load 'elfeed-show (when (fboundp 'emms-all) @@ -5825,46 +5721,39 @@ enable =emms=. :END: The link [[https://sqrtminusone.xyz/posts/2021-09-07-emms/][my emms and elfeed setup]] is a nice introduction to configuring and -using =emms= with =elfeed=. Listing [[lst:configure-emms]] configures =emms=. +using =emms= with =elfeed=. Listing [[lst:set-emms-options]] configures =emms=. -#+caption[Configure =emms=]: -#+caption: Configure =emms=. -#+name: lst:configure-emms +#+caption[Set =emms= options]: +#+caption: Set =emms= options. +#+name: lst:set-emms-options #+begin_src emacs-lisp (when (ensure-package-installation 'emms) (with-eval-after-load 'emms - (custom-set-variables - '(emms-player-list '(emms-player-mpd emms-player-mpv))) + (setopt emms-player-list '(emms-player-mpd emms-player-mpv)) (emms-all)) (with-eval-after-load 'emms-mode-line - (custom-set-variables - '(emms-mode-line-format ""))) + (setopt emms-mode-line-format "")) (with-eval-after-load 'emms-player-mpd - (custom-set-variables - `(emms-player-mpd-music-directory ,(expand-file-name "~/Music")) - '(emms-player-mpd-server-name "localhost") - '(emms-player-mpd-server-port "6600") - '(emms-player-mpd-verbose t))) + (setopt emms-player-mpd-music-directory (expand-file-name "~/Music") + emms-player-mpd-server-name "localhost" + emms-player-mpd-server-port "6600" + emms-player-mpd-verbose t)) (with-eval-after-load 'emms-player-mpv - (custom-set-variables - '(emms-player-mpv-ipc-method 'ipc-server) - '(emms-player-mpv-update-metadata t))) + (setopt emms-player-mpv-ipc-method 'ipc-server + emms-player-mpv-update-metadata t)) (with-eval-after-load 'emms-playing-time - (custom-set-variables - '(emms-playing-time-display-format " %s "))) + (setopt emms-playing-time-display-format " %s ")) (with-eval-after-load 'emms-playlist-mode - (custom-set-variables - '(emms-playlist-mode-center-when-go t))) + (setopt emms-playlist-mode-center-when-go t)) (with-eval-after-load 'emms-streams - (custom-set-variables - `(emms-streams-file - ,(no-littering-expand-etc-file-name "emms/streams.emms"))))) + (setopt emms-streams-file + (no-littering-expand-etc-file-name "emms/streams.emms")))) #+end_src *** Hiding spurious buffers