From 3a9f1ac1b026bd4f411573938a4c51964ca56d25 Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Tue, 24 Jan 2023 07:41:16 +0100 Subject: [PATCH] Add line numbers to listings and split long lines in listings --- README.org | 354 +++++++++++++++++++++++++++-------------------------- 1 file changed, 178 insertions(+), 176 deletions(-) diff --git a/README.org b/README.org index 50d0d1a..cfb0a36 100644 --- a/README.org +++ b/README.org @@ -48,7 +48,7 @@ invoke Emacs again. # #+caption[Prepare the user-emacs-directory]: # #+caption: Clone and initialize the user-emacs-directory. # #+name: lst:prepare-user-emacs-directory -# #+begin_src shell :noeval :tangle no +# #+begin_src shell -n :noeval :tangle no # cd ~ # git clone ccdr@mercury.grenoble.cnrs.fr:SERVER/emacs.d.git .emacs.d # make --directory=.emacs.d init @@ -58,7 +58,7 @@ invoke Emacs again. #+caption[Prepare the user-emacs-directory without =ssh= access]: #+caption: Clone and initialize the user-emacs-directory without =ssh= access. #+name: lst:prepare-user-emacs-directory-with-https -#+begin_src shell :noeval :tangle no +#+begin_src shell -n :noeval :tangle no cd ~ git clone https://forge.chapril.org/gav451/emacs.d.git .emacs.d make --directory=.emacs.d init @@ -68,7 +68,7 @@ emacs & #+caption[Prepare the =user-emacs-directory= with =ssh= access]: #+caption: Clone and initialize the user-emacs-directory with =ssh= access. #+name: lst:prepare-user-emacs-directory-with-ssh -#+begin_src shell :noeval :tangle no +#+begin_src shell -n :noeval :tangle no cd ~ git clone ssh://gitea@forge.chapril.org:222/gav451/emacs.d.git .emacs.d make --directory=.emacs.d init @@ -164,7 +164,7 @@ Try to load [[https://github.com/emacscollective/no-littering][no-littering]] as #+caption[Tangle the early-init-file]: #+caption: Tangle the early-init-file. #+name: lst:tangle-early-init-file -#+begin_src emacs-lisp :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: @@ -210,7 +210,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf #+caption[Set the first set of Emacs options]: #+caption: Set the first set of Emacs options. #+name: lst:1st-setopt-call -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n ;;; init.el --- user init file -*- lexical-binding: t -*- ;;; Commentary: ;;; Code: @@ -264,7 +264,7 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf #+caption[Set the second set of Emacs options]: #+caption: Set the second set of Emacs options. #+name: lst:2nd-setopt-call -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (setopt ;; See https://github.com/melpa/melpa#mirrors for official Melpa mirrors. ;; ("melpa" . "https://www.mirrorservice.org/sites/melpa.org/packages/") @@ -324,7 +324,7 @@ the contents of packages and allows to update packages to the latest version. #+caption[Install the selected packages]: #+caption: Install the selected packages. #+name: lst:install-selected-packages -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (unless noninteractive (unless (require 'no-littering nil 'noerror) (unless (bound-and-true-p package-archive-contents) @@ -367,7 +367,7 @@ the contents of packages and allows to update packages to the latest version. #+caption[Setup Emacs Tree-sitter]: #+caption: Setup Emacs Tree-sitter. #+name: lst:setup-emacs-tree-sitter -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (require 'treesit nil 'noerror) (setopt treesit-language-source-alist @@ -380,7 +380,8 @@ the contents of packages and allows to update packages to the latest version. (go "https://github.com/tree-sitter/tree-sitter-go" "master" "src") (html "https://github.com/tree-sitter/tree-sitter-html" "master" "src") (java "https://github.com/tree-sitter/tree-sitter-java" "master" "src") - (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src") + (javascript "https://github.com/tree-sitter/tree-sitter-javascript" + "master" "src") (json "https://github.com/tree-sitter/tree-sitter-json" "master" "src") (julia "https://github.com/tree-sitter/tree-sitter-julia" "master" "src") (make "https://github.com/alemuller/tree-sitter-make" "main" "src") @@ -392,10 +393,10 @@ the contents of packages and allows to update packages to the latest version. (sql "https://github.com/m-novikov/tree-sitter-sql" "main" "src") (swift "https://github.com/tree-sitter/tree-sitter-swift" "master" "src") (toml "https://github.com/tree-sitter/tree-sitter-toml" "master" "src") - (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" - "tsx/src") - (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" - "typescript/src") + (tsx "https://github.com/tree-sitter/tree-sitter-typescript" + "master" "tsx/src") + (typescript "https://github.com/tree-sitter/tree-sitter-typescript" + "master" "typescript/src") (yaml "https://github.com/ikatyang/tree-sitter-yaml" "master" "src"))) (add-to-list 'auto-mode-alist @@ -430,7 +431,7 @@ theming: #+caption[Configure =face-attributes=]: #+caption: Configure =face-attributes=. #+name: lst:configure-face-attributes -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Set face attributes. (cond @@ -451,7 +452,7 @@ theming: #+caption[Implement =set-default-face-height=]: #+caption: Implement =set-default-face-height=. #+name: lst:set-default-face-height -#+begin_src emacs-lisp +#+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. @@ -471,7 +472,7 @@ Scale all other faces with a height that is a real number." #+caption[Use =buffer-face-mode= to set fixed or variable pitch face]: #+caption: Use =buffer-face-mode= to set fixed or variable pitch face. #+name: lst:use-buffer-face-mode-for-fixed-or-variable-pitch-face -#+begin_src emacs-lisp +#+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." @@ -493,7 +494,7 @@ Scale all other faces with a height that is a real number." #+caption[Fix a `gtk' color and implement =invert-default-face=]: #+caption: Fix a `gtk' color and implement =invert-default-face=. #+name: lst:fix-gtk-color-for-invert-default-face -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun fix-gtk-region-face-background-color () (when (featurep 'gtk) @@ -515,7 +516,7 @@ Scale all other faces with a height that is a real number." #+caption[Shadow Org font-lock faces to improve the readability]: #+caption: Shadow Org font-lock faces to improve the readability. #+name: lst:shadow-org-font-lock-faces -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Shadow two definitions in org-faces.el: (defface org-block @@ -556,7 +557,7 @@ verse and quote blocks are fontified using the `org-verse' and #+caption[Shadow Emacs font-lock faces to improve the readability]: #+caption: Shadow Emacs font-lock faces to improve the readability. #+name: lst:shadow-emacs-font-lock-faces -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; Shadow one definition in sh-script.el: (defface sh-heredoc @@ -581,7 +582,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+caption[Window management functions and key bindings]: #+caption: Window management functions and key bindings. #+name: lst:1st-window-management -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager (defun split-root-below (arg) @@ -617,7 +618,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+caption[Window management modes]: #+caption: Window management modes. #+name: lst:2nd-window-management -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (winner-mode +1)) #+end_src @@ -625,7 +626,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+caption[Window management variables]: #+caption: Window management variables. #+name: lst:3rd-window-management -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; https://www.masteringemacs.org/article/demystifying-emacs-window-manager (when (version< "29.0.0" emacs-version) @@ -662,7 +663,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+caption[Toggle any advice]: #+caption: Toggle any advice. #+name: lst:toggle-any-advice -#+begin_src emacs-lisp +#+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'." @@ -678,7 +679,7 @@ and [[lst:3rd-window-management]] implement a selection of his recommendations. #+caption[Toggle specific advice]: #+caption: Toggle specific advice. #+name: lst:toggle-specific-advice -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (defun toggle-eww-display-pdf-around () "Toggle `eww-display-advice' advice." @@ -739,7 +740,7 @@ extension. #+caption[Set =dired= options]: #+caption: Set =dired= options. #+name: lst:set-dired-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'dired (setopt dired-dwim-target t ;; | switch | action | @@ -773,7 +774,7 @@ by experienced Emacs users. #+caption[Extra =dired= key bindings]: #+caption: Extra =dired= key bindings. #+name: lst:extra-dired-key-bindings -#+begin_src emacs-lisp +#+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" @@ -826,7 +827,7 @@ minibuffer completion]]. #+caption[Set =minibuffer= options]: #+caption: Set =minibuffer= options. #+name: lst:set-minibuffer-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (require 'minibuffer nil 'noerror) ;; https://www.masteringemacs.org/article/understanding-minibuffer-completion (setopt @@ -847,7 +848,7 @@ output to =stdout=. #+caption[Process utilities]: #+caption: Process utilities. #+name: lst:process-utilities -#+begin_src emacs-lisp +#+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." @@ -880,7 +881,7 @@ or {{{kbd(C-h v)}}}. | info | help-map | {{{kbd(C-h i)}}} | |------------------------------+----------+------------------| -#+begin_src emacs-lisp :tangle no +#+begin_src emacs-lisp -n :tangle no (defun org-key-binding-macro (cmd) (let* ((sym (intern-soft cmd)) (keys (and (commandp sym) (where-is-internal sym nil 'first-only))) @@ -904,7 +905,7 @@ defined in this Org file. #+caption[Configure =shortdoc=]: #+caption: Configure =shortdoc=. #+name: lst:configure-shortdoc -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (fboundp 'shortdoc-display-group) (define-key help-map (kbd "y") #'shortdoc-display-group) (with-eval-after-load 'shortdoc @@ -957,7 +958,7 @@ looks for files. #+caption[Configure =info=]: #+caption: Configure =info=. #+name: lst:configure-info -#+begin_src emacs-lisp +#+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) @@ -1007,7 +1008,7 @@ users from shooting themselves in the feet. Listing #+caption[Configure the =disabled-command-function=]: #+caption: Configure the =disabled-command-function=. #+name: lst:configure-disabled-command-function -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (setq disabled-command-function (defun enable-this-command (&rest _args) @@ -1028,7 +1029,7 @@ Enable it and re-execute it." #+caption[Configure =interaction-log=]: #+caption: Configure =interaction-log=. #+name: lst:configure-interaction-log -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'interaction-log) (require 'interaction-log nil 'noerror)) @@ -1055,7 +1056,7 @@ Listing [[lst:configure-keycast]] configures =keycast=. #+caption[Configure =keycast=]: #+caption: Configure =keycast=. #+name: lst:configure-keycast -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n ;; Make `keycast-log-update-buffer' use a buffer similar to the ;; control buffer `ediff-setup-windows-plain' returns. (when (and (ensure-package-installation 'keycast) @@ -1107,7 +1108,7 @@ The code in listing [[lst:start-emacs-server]] starts the Emacs server. #+caption[Start the Emacs server]: #+caption: Start the Emacs server. #+name: lst:start-emacs-server -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when window-system (unless (or noninteractive (daemonp)) (add-hook 'after-init-hook #'server-start))) @@ -1129,7 +1130,7 @@ make use of the =latexmkrc= file. #+caption[Tangle the =Latexmk= resource file]: #+caption: Tangle the =Latexmk= resource file. #+name: lst:latexmkrc -#+begin_src perl :tangle latexmkrc :comments no +#+begin_src perl -n :tangle latexmkrc :comments no # pdf creator $pdf_mode = 4; # 4 means lualatex # pdf previewer and update pdf previewer @@ -1175,7 +1176,7 @@ may hang or die. #+header: :comments no #+header: :tangle-mode (identity #o755) #+name: lst:qutebrowser-userscript -#+begin_src python :noeval :tangle org-store-link +#+begin_src python -n :noeval :tangle org-store-link #!/usr/bin/env python from urllib.parse import urlencode from os import environ, execvp @@ -1205,7 +1206,7 @@ execvp("emacsclient", ("-n", payload)) #+caption[Ensure =applescript-mode= installation]: #+caption: Ensure =applescript-mode= installation. #+name: lst:ensure-applescript-mode-installation -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'applescript-mode)) #+end_src @@ -1264,7 +1265,7 @@ ensures its installation. #+caption[Ensure =company= installation]: #+caption: Ensure =company= installation. #+name: lst:ensure-company-installation -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (ensure-package-installation 'company) #+end_src @@ -1281,7 +1282,7 @@ file. #+caption[Enable =savehist-mode= and =vertico-mode=]: #+caption: Enable =savehist-mode= and =vertico-mode=. #+name: lst:enable-vertico-mode -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (require 'savehist nil 'noerror) (setopt savehist-additional-variables '(eww-history kill-ring @@ -1337,7 +1338,7 @@ file. #+caption[Configure =orderless=]: #+caption: Configure =orderless=. #+name: lst:configure-orderless -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'marginalia) (with-eval-after-load 'orderless (setopt orderless-component-separator " +") @@ -1372,7 +1373,7 @@ Listing [[lst:bind-embark-commands][bind =embark= commands]] binds =embark= comm #+caption[Bind =embark= commands globally]: #+caption: Bind =embark= commands globally. #+name: lst:bind-embark-commands -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'embark 'embark-consult) (when (fboundp 'embark-act) (global-set-key (kbd "C-,") #'embark-act)) @@ -1394,7 +1395,7 @@ Listing [[lst:enable-marginalia-mode]] enables =marginalia-mode=. #+caption[Enable =marginalia-mode=]: #+caption: Enable =marginalia-mode=. #+name: lst:enable-marginalia-mode -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'marginalia) (fboundp 'marginalia-mode)) (marginalia-mode +1)) @@ -1459,7 +1460,7 @@ completion function [[info:elisp#Minibuffer Completion][completing-read]]. List #+caption[Bind =consult= commands]: #+caption: Bind =consult= commands. #+name: lst:bind-consult-commands -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'consult) ;; C-c bindings (current-global-map) (global-set-key (kbd "C-c h") #'consult-history) @@ -1500,7 +1501,7 @@ Listing [[lst:setup-company]] configures =company=. #+caption[Setup =company=]: #+caption: Setup =company=. #+name: lst:setup-company -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (fboundp 'company-mode) ;; https://github.com/purcell/emacs.d/issues/778 (setopt company-transformers '(company-sort-by-occurrence)) @@ -1563,7 +1564,7 @@ the current [[https://en.wikipedia.org/wiki/Version_control][VCS]] directory tre #+caption[Bind =deadgrep= commands]: #+caption: Bind =deadgrep= commands. #+name: lst:bind-deadgrep-commands -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (and (ensure-package-installation 'deadgrep) (fboundp 'deadgrep)) (define-key search-map (kbd "d") #'deadgrep) @@ -1584,7 +1585,7 @@ implementation of the suggestions on those pages. #+caption[Set =grep= and =xref= options to use =ugrep= when available]: #+caption: Set =grep= and =xref= options to use =ugrep= when available. #+name: lst:set-grep+xref-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (executable-find "ugrep") (with-eval-after-load 'grep (setopt grep-template (string-join '("ugrep" @@ -1620,7 +1621,7 @@ regexp strings. #+caption[Ensure =xr= installation]: #+caption: Ensure =xr= installation. #+name: lst:ensure-xr-installation -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'xr)) #+end_src @@ -1643,7 +1644,7 @@ single frame and to make all text visible prior to ediffing Org buffers. #+caption[Setup =ediff=]: #+caption: Setup =ediff=. #+name: lst:setup-ediff -#+begin_src emacs-lisp +#+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 @@ -1673,7 +1674,7 @@ or src_emacs-lisp{(magit-push-current-to-upstream)}. #+caption[Forking and branching on Github or Gitlab]: #+caption: Forking and branching on Github or Gitlab. #+name: lst:forking-and-branching-remote-repositories -#+begin_src shell :noeval +#+begin_src shell -n :noeval # Clone the repository git clone git@github.com:gav451/engrave-faces engrave-faces-fork cd engrave-face-fork @@ -1713,7 +1714,7 @@ git checkout master #+caption[List all =git= branches]: #+caption: List all =git= branches. #+name: lst:list-all-git-branches -#+begin_src shell :exports both :results verbatim +#+begin_src shell -n :exports both :results verbatim git -C ~/VCS/engrave-faces-fork branch -a #+end_src @@ -1739,7 +1740,7 @@ snippet [[lst:ensure-magit-installation][below]] ensures its installation. #+caption[Ensure =Magit= installation]: #+caption: Ensure =Magit= installation #+name: lst:ensure-magit-installation -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (ensure-package-installation 'magit) #+end_src @@ -1769,7 +1770,7 @@ Listing [[lst:configure-nov]] configures [[https://depp.brause.cc/nov.el/][nov.e #+caption[Configure =nov=]: #+caption: Configure =nov=. #+name: lst:configure-nov -#+begin_src emacs-lisp +#+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))) @@ -1792,7 +1793,7 @@ rebuild the =epdfinfo= executable that serves the [[https://en.wikipedia.org/wik #+caption[Setup =pdf-tools=]: #+caption: Setup =pdf-tools=. #+name: lst:setup-pdf-tools -#+begin_src emacs-lisp +#+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': @@ -1843,7 +1844,7 @@ configuration objectives: #+caption[Ensure =AUCTeX= installation and set =TeX= option]: #+caption: Ensure =AUCTeX= installation and set =TeX= option. #+name: lst:set-tex-options -#+begin_src emacs-lisp +#+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) @@ -1861,7 +1862,7 @@ configuration objectives: #+caption[Update the =LuaLaTeX OpenType Font= name database]: #+caption: Update the =LuaLaTeX= =OpenType Font= name database. #+name: lst:update-lualatex-opentype-font-name-database -#+begin_src emacs-lisp +#+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\"." @@ -1877,7 +1878,7 @@ configuration objectives: #+caption[Set =bibtex= options]: #+caption: Set =bibtex= options. #+name: lst:set-bibtex-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'bibtex (setopt bibtex-dialect 'BibTeX)) #+end_src @@ -1885,7 +1886,7 @@ configuration objectives: #+caption[Set =font-latex= options]: #+caption: Set =font-latex= options. #+name: lst:set-font-latex-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'font-latex (setopt font-latex-fontify-sectioning 1.0)) #+end_src @@ -1893,7 +1894,7 @@ configuration objectives: #+caption[Set =latex= options]: #+caption: Set =latex= options. #+name: lst:set-latex-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'latex (setopt LaTeX-electric-left-right-brace t LaTeX-section-hook '(LaTeX-section-heading @@ -1914,7 +1915,7 @@ buffers with help of an external [[https://nodejs.org][node.js]] program. #+caption[Setup =math-preview=]: #+caption: Setup =math-preview=. #+name: lst:setup-math-preview -#+begin_src emacs-lisp +#+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 @@ -1979,7 +1980,7 @@ zeromatrix zmat"))) #+caption[Configure =markdown-mode=]: #+caption: Configure =markdown-mode=. #+name: lst:configure-markdown-mode -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (when (ensure-package-installation 'markdown-mode)) #+end_src @@ -1999,7 +2000,7 @@ of the [[info:org#Top][Org (info)]] manual. #+caption[Bind =Org= commands globally]: #+caption: Bind =Org= commands globally. #+name: lst:bind-org-commands -#+begin_src emacs-lisp +#+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) @@ -2040,7 +2041,7 @@ list detailing and motivating each listing: #+caption[Set basic =Org= options]: #+caption: Set basic =Org= options. #+name: lst:set-org-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'org (setopt org-babel-load-languages @@ -2090,7 +2091,7 @@ list detailing and motivating each listing: #+caption[Setup =org-babel=]: #+caption: Setup =org-babel=. #+name: lst:setup-org-babel -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ob-core (setopt org-confirm-babel-evaluate nil)) @@ -2144,7 +2145,7 @@ unbind the `org-babel' interface functions when ACTIVE is nil." #+caption[Set =org-link= options]: #+caption: Set =org-link= options. #+name: lst:set-org-link-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ol (setopt org-link-file-path-type 'relative)) #+end_src @@ -2152,7 +2153,7 @@ unbind the `org-babel' interface functions when ACTIVE is nil." #+caption[Setup =org-mode-map=]: #+caption: Setup =org-mode-map=. #+name: lst:setup-org-mode-map -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs ;; From: "Nicolas Richard" ;; Date: Fri, 08 Mar 2013 16:23:02 +0100 [thread overview] @@ -2199,7 +2200,7 @@ When called twice, replace the previously inserted \\(\\) by one $." #+caption[Setup =org-src=]: #+caption: Setup =org-src=. #+name: lst:setup-org-src -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'emacs (with-eval-after-load 'org-src (setopt org-src-preserve-indentation t)) @@ -2228,7 +2229,7 @@ When called twice, replace the previously inserted \\(\\) by one $." #+caption[Setup =ob-python=]: #+caption: Setup =ob-python=. #+name: lst:setup-ob-python -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ob-python (defun org-babel-python-format-session-value-override (src-file result-file result-params) @@ -2267,7 +2268,7 @@ else: #+caption[Set =org-export= options]: #+caption: Set =org-export= options. #+name: lst:set-org-export-options -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ox (setopt org-export-dispatch-use-expert-ui t)) #+end_src @@ -2275,7 +2276,7 @@ else: #+caption[Setup =org= for export to LuaLaTeX]: #+caption: Setup =org= for export to LuaLaTeX. #+name: lst:setup-org-for-lualatex-export -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'org ;; https://list.orgmode.org/87o84fd4oi.fsf@posteo.net/ (add-to-list @@ -2310,7 +2311,7 @@ else: #+caption[Set =ox-latex= options for export to LuaLaTeX]: #+caption: Set =ox-latex= options for export to LuaLaTeX. #+name: lst:set-ox-latex-options-for-lualatex-export -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ox-latex (setopt org-latex-compiler "lualatex" @@ -2352,7 +2353,7 @@ else: #+caption[Setup =org-latex-classes= for backwards compatibility]: #+caption: Setup =org-latex-classes= for backwards compatibility. #+name: lst:setup-org-latex-classes -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ox-latex (mapc (function (lambda (element) (add-to-list 'org-latex-classes element))) @@ -2430,7 +2431,7 @@ processor, text to product convertor) to an Emacs setup. Listing #+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 +#+begin_src emacs-lisp -n (with-eval-after-load 'oc ;; Org-9.5 needs the requirements, but Org-9.6 does not. (when (version< (org-version) "9.6") @@ -2491,7 +2492,7 @@ valid directories and files. In an [[https://orgmode.org/][Org-mode]] buffer th #+caption[Delete =Biber= cache when =Biber= fails to make a bibliography]: #+caption: Delete =Biber= cache when =Biber= fails to make a bibliography. #+name: lst:delete-biber-cache -#+begin_src emacs-lisp +#+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?" @@ -2540,7 +2541,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 :results silent +#+begin_src emacs-lisp -n :results silent (ensure-package-installation 'engrave-faces) (defun org-latex-engraved-source-block-filter (data _backend _info) @@ -2572,7 +2573,7 @@ environment and an unbreakable Code (floating) environment." #+caption[Smart LaTeX engraving of =org-src-mode= blocks]: #+caption: Smart LaTeX engraving of =org-src-mode= blocks. #+name: lst:smart-latex-engrave-org-source-blocks -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (defun smart-latex-engrave-org-source-blocks () "Enable smart LaTeX engraving of `org-src-mode' blocks. @@ -2623,7 +2624,7 @@ environments and non-floating breakable LaTeX environments by means of #+caption[Emacs setup to use =engrave-faces-latex= in =org-mode= smartly]: #+caption: Emacs setup to use =engrave-faces-latex= in =org-mode= smartly. #+name: lst:ox-engraved-emacs-lisp-setup -#+begin_src emacs-lisp :tangle no +#+begin_src emacs-lisp -n :tangle no (with-eval-after-load 'ox (make-variable-buffer-local 'org-export-filter-src-block-functions) (add-to-list 'org-export-filter-src-block-functions @@ -2652,7 +2653,7 @@ The listings below implement or reimplement three groups of =org-link= types: #+caption[Define =org-link= types for backwards compatibility with =org-ref=]: #+caption: Define =org-link= types for backwards compatibility with =org-ref=. #+name: lst:org-ref-like-org-link-types -#+begin_src emacs-lisp +#+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) @@ -2695,7 +2696,7 @@ The listings below implement or reimplement three groups of =org-link= types: #+caption[Define an =org-link= type for =pdf-tools=]: #+caption: Define an =org-link= type for =pdf-tools=. #+name: lst:define-org-pdfview-link-type -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (with-eval-after-load 'ol (autoload 'pdf-view-goto-page "pdf-view" nil t) (org-link-set-parameters "pdfview" @@ -2745,7 +2746,7 @@ facilate moving single directories or whole directory trees." #+caption[Patch =ol-info=]: #+caption: Patch =ol-info=. #+name: lst:patch-org-info-link-type -#+begin_src emacs-lisp :exports code :results silent +#+begin_src emacs-lisp -n :exports code :results silent (with-eval-after-load 'ol-info (defun org-info-export (path desc format) "Export an info link. @@ -2774,7 +2775,7 @@ See `org-link-parameters' for details about PATH, DESC and FORMAT." #+caption[Patch buffer local =ol-info=]: #+caption: Patch buffer local =ol-info=. #+name: lst:emacs-lisp-setup-buffer-local-ol-info -#+begin_src emacs-lisp :exports code :results silent :tangle no +#+begin_src emacs-lisp -n :exports code :results silent :tangle no (with-eval-after-load 'ol-info (make-variable-buffer-local 'org-info-emacs-documents) (setq org-info-emacs-documents (delete "org" org-info-emacs-documents)) @@ -2807,7 +2808,7 @@ The following posts provide programming information: 2. [[https://developers.google.com/youtube/iframe_api_reference][YouTube Player API reference for iframe embeds]]. 3. [[https://www.alphr.com/how-to-link-specific-timestamp-youtube/][How to link to a specific timestamp in a YouTube video]]. -#+begin_src emacs-lisp :exports none :tangle no +#+begin_src emacs-lisp -n :exports none :tangle no ;; https://www.youtube.com/embed/M03bTkQxVUg?start=30&end=120 (org-yt-seconds-to-hms (+ (* 3600 120) (* 60 9) 7)) @@ -2845,7 +2846,7 @@ The following posts provide programming information: #+caption[Parsing function for the =org-yt= link type]: #+caption: Parsing function for the =org-yt= link type. #+name: lst:org-yt-parsing -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (defun org-yt-time-to-seconds (text) "Convert TEXT of the form `12:34:56' or `12h34m56s' to seconds as integers." (let* ((case-fold-search t) @@ -2891,7 +2892,7 @@ The following posts provide programming information: #+caption[Formatting functions to open =org-yt= links]: #+caption: Formatting functions to open =org-yt= links. #+name: lst:org-yt-open-formatting -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (defun org-yt-seconds-to-hms (seconds) "Convert seconds as integers to text of the form `12h34m56s'." (let ((h (/ seconds 3600)) @@ -2930,7 +2931,7 @@ The following posts provide programming information: #+caption[Formatting function for HTML export of =org-yt= links]: #+caption: Formatting function for HTML export of =org-yt= links. #+name: lst:org-yt-html-export-formatting -#+begin_src emacs-lisp +#+begin_src emacs-lisp -n (defconst org-yt-iframe "