From 23517e0a7f4304d7690eeac449a288577d9b9cdd Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Sat, 11 Dec 2021 12:48:46 +0100 Subject: [PATCH] Configure the minted source block background color globally --- README.org | 49 ++----------------------------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/README.org b/README.org index 857508f..39b2283 100644 --- a/README.org +++ b/README.org @@ -33,7 +33,7 @@ :END: Backup your =~/.emacs.d= directory to execute the following commands: -#+attr_latex: :options bgcolor=LightGoldenrodYellow + #+begin_src shell :noeval :tangle no cd ~ git clone ccdr@mercury.grenoble.cnrs.fr:SERVER/.emacs.d @@ -115,7 +115,6 @@ Here follows a list of interesting Emacs configurations: Try to load [[https://github.com/emacscollective/no-littering][no-littering]] as early as possible, since it helps to keep =~/.emacs.d= clean. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp :tangle early-init.el ;;; early-init.el --- user early-init file -*- lexical-binding: t -*- ;;; Commentary: @@ -156,7 +155,6 @@ reader macros is the [[https://mullikine.github.io/posts/macro-tutorial/][didact Because of the ~custom-set-variable~ function call, the [[info:emacs#Init File][init file (info)]] does not load the ~custom-file~ as [[info:emacs#Saving Customizations][saving customizations (info)]] recommends. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp ;;; init.el --- user init file -*- lexical-binding: t -*- ;;; Commentary: @@ -289,7 +287,6 @@ missing packages after the user has agreed to its prompt. After package bootstrapping, you have to refresh the list of available packages yourself before updating the installed packages. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp ;; The is the 1st package bootstrapping block. (unless (require 'no-littering nil 'noerror) @@ -310,7 +307,6 @@ Emacs can act as a server that listens to a socket to share its state (for instance buffers and command history) with other programs by means of a shell command =emacsclient=. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when window-system (unless (or noninteractive (daemonp)) @@ -334,7 +330,6 @@ 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.. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src perl :tangle latexmkrc :comments none # pdf previewer and update pdf previewer $pdf_previewer = "emacsclient -e '(find-file-other-window %S)'"; @@ -372,7 +367,6 @@ On a [[https://en.wikipedia.org/wiki/POSIX][POSIX]] system, you can run the user terminal to see whether it works. In case you try to run it from Emacs, Emacs may hang or die. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+header: :comments none #+header: :tangle-mode (identity #o755) #+begin_src python :noeval :tangle org-store-link @@ -417,7 +411,6 @@ niche than the five packages above. :CUSTOM_ID: sec:vertico-configuration :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (fboundp 'vertico-mode) @@ -449,7 +442,6 @@ niche than the five packages above. :CUSTOM_ID: sec:embark-configuration :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (cl-every #'fboundp '(embark-act embark-bindings embark-dwim)) @@ -463,7 +455,6 @@ niche than the five packages above. :CUSTOM_ID: sec:marginalia-configuration :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (fboundp 'marginalia-mode) @@ -475,7 +466,6 @@ niche than the five packages above. :CUSTOM_ID: sec:consult-configuration :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (fboundp 'consult-apropos) @@ -520,7 +510,6 @@ niche than the five packages above. :CUSTOM_ID: sec:company-configuration :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (fboundp 'company-mode) @@ -541,7 +530,6 @@ niche than the five packages above. See [[https://lists.gnu.org/archive/html/emacs-devel/2021-12/msg00802.html][Juri Linkov (Emacs Developer mailing list)]] for how to allow completion on previous input in the minibuffer. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (defun minibuffer-setup-history-completions () (unless (or minibuffer-completion-table minibuffer-completion-predicate) @@ -564,7 +552,6 @@ previous input in the minibuffer. ** EPUB files -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when (fboundp 'nov-mode) (add-to-list 'auto-mode-alist `(,(rx ".epub" eos) . nov-mode))) @@ -580,7 +567,6 @@ 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. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when (fboundp 'pdf-tools-install) (autoload 'pdf-view-mode "pdf-view") @@ -605,7 +591,6 @@ Out of the box, [[https://en.wikipedia.org/wiki/AUCTeX][AUCTeX]] does not indent below corrects this by advising to override ~TeX-brace-count-line~ with ~my-TeX-brace-count-line~. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp ;; Try to get the `safe-local-variable' predicate for `TeX-master' (when (require 'tex nil 'noerror) @@ -650,7 +635,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with *** [[info:org#Activation][Activation (info)]] -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp ;; Inspect: ;; function with "C-h f" @@ -665,7 +649,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with *** Customization -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (custom-set-variables '(org-babel-python-command "python -E") @@ -696,6 +679,7 @@ below corrects this by advising to override ~TeX-brace-count-line~ with '(org-latex-compiler "lualatex") '(org-latex-hyperref-template nil) '(org-latex-listings 'minted) + '(org-latex-minted-options '(("bgcolor" "LightGoldenrodYellow"))) '(org-latex-logfiles-extensions '("blg" "lof" "log" "lot" "out" "toc")) '(org-latex-prefer-user-labels t) '(org-modules '(ol-bibtex @@ -725,7 +709,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with :CUSTOM_ID: sec:citation-export-processors :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'oc (require 'oc-biblatex) @@ -737,7 +720,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with :CUSTOM_ID: sec:export-external-links :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'ol (org-link-set-parameters @@ -778,7 +760,6 @@ modify the constant ~org-info-other-documents~ defined in =ol-info.el=. Note: how to make it work without tangling? -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (add-hook 'org-mode-hook @@ -794,7 +775,6 @@ Note: how to make it work without tangling? *** [[https://tecosaur.github.io/emacs-config/#translate-capital-keywords][Translate capital keywords (old) to lower case (new)]] -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'org (defun org-syntax-convert-keyword-case-to-lower () @@ -815,7 +795,6 @@ Note: how to make it work without tangling? Stolen from [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra.el][ox-extra.el]] -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'ox (defun my-org-export-ignore-headline-filter (_) @@ -875,13 +854,11 @@ Stolen from [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra. #+end_src #+name: emacs-lisp-setup -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp :tangle no (with-eval-after-load 'ox (my-activate-buffer-local-org-export-filters)) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'ox-latex (mapc (lambda (item) @@ -937,7 +914,6 @@ Stolen from [[https://git.sr.ht/~bzg/org-contrib/tree/master/item/lisp/ox-extra. *** Evaluate source blocks on loading -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (defun my-org-eval-blocks-named (name) "Evaluate all source blocks named NAME." @@ -972,7 +948,6 @@ editing support. filtering and selecting of bibliographic entries from the minibuffer, and the option to run different commands on those selections. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when (cl-every #'fboundp '(citar-insert-citation citar-insert-preset @@ -997,7 +972,6 @@ option to run different commands on those selections. Execute src_emacs-lisp[:exports code]{(find-library "novice")} to see how Emacs prevents new users from shooting themselves in the feet. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (setq disabled-command-function (defun my-enable-this-command (&rest _args) @@ -1018,7 +992,6 @@ Emacs prevents new users from shooting themselves in the feet. [[https://endlessparentheses.com/emacs-narrow-or-widen-dwim.html][Emacs narrow-or-widen-dwim]] -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (defun narrow-or-widen-dwim (p) "Widen if buffer is narrowed, narrow-dwim otherwise. @@ -1049,7 +1022,6 @@ Emacs prevents new users from shooting themselves in the feet. ** Synchronal multiple-region editing -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (require 'iedit nil 'noerror)) @@ -1057,7 +1029,6 @@ Emacs prevents new users from shooting themselves in the feet. ** Extraneous whitespace trimming -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (require 'ws-butler nil 'noerror) @@ -1069,7 +1040,6 @@ Emacs prevents new users from shooting themselves in the feet. ** Smart character-pair handling -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive (when (require 'smartparens-config nil 'noerror) @@ -1108,7 +1078,6 @@ Emacs prevents new users from shooting themselves in the feet. :CUSTOM_ID: sec:electric-operators :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when (fboundp 'electric-operator-mode) (add-hook 'c-mode-common #'electric-operator-mode) @@ -1117,7 +1086,6 @@ Emacs prevents new users from shooting themselves in the feet. ** Smart snippets -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (when (require 'yasnippet nil 'noerror) (custom-set-variables @@ -1127,7 +1095,6 @@ Emacs prevents new users from shooting themselves in the feet. * Coding -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs '(python-mode "pylsp")) @@ -1154,7 +1121,6 @@ The snippet below initializes [[https://github.com/pythonic-emacs/anaconda-mode] handle ~company-backends~ as a local variable and the call to [[info:elisp#Advising Functions][advice-add]] opens Python org-mode edit-buffers in ~anaconda-mode~. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'python @@ -1206,7 +1172,6 @@ Python org-mode edit-buffers in ~anaconda-mode~. (my-enable-anaconda-mode))))) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src python :tangle example.py :comments link import numpy import astropy.units as apu @@ -1217,7 +1182,6 @@ Python org-mode edit-buffers in ~anaconda-mode~. print(q) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (custom-set-variables '(python-shell-interpreter-args "-i -E")) @@ -1227,7 +1191,6 @@ Python org-mode edit-buffers in ~anaconda-mode~. (pyenv-mode-set "3.9.9/envs/python-3.9.9")) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (with-eval-after-load 'info (add-to-list 'Info-directory-list @@ -1249,7 +1212,6 @@ boils down to two rules: The next source code blocks implement those rules. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive ;; Set face attributes. @@ -1271,7 +1233,6 @@ The next source code blocks implement those rules. In case of proper initialization of all face heigths, font scaling is easy as the next source code block shows. -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (defun my-set-default-face-height () "Set the default face height in all current and future frames. @@ -1295,7 +1256,6 @@ Darwin. [[https://emacs.stackexchange.com/questions/17431/how-do-i-change-portions-of-a-custom-theme][How to change custom theme faces]] -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive ;; Try to detect `leuven-theme` from MELPA. @@ -1336,7 +1296,6 @@ Darwin. (add-hook hook #'my-leuven-hook-function))) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp :tangle no (unless noninteractive (custom-set-variables @@ -1347,7 +1306,6 @@ Darwin. (modus-themes-load-themes))) #+end_src -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (unless noninteractive ;; https://karthinks.com/software/batteries-included-with-emacs/ @@ -1368,7 +1326,6 @@ Darwin. ** Feed reader -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (autoload 'elfeed "elfeed" nil t) (global-set-key (kbd "C-x w") #'elfeed) @@ -1397,7 +1354,6 @@ Darwin. ** Multi-media system -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (custom-set-variables '(emms-mode-line-format "") @@ -1440,7 +1396,6 @@ Darwin. :CUSTOM_ID: sec:init-file-footer :END: -#+attr_latex: :options bgcolor=LightGoldenrodYellow #+begin_src emacs-lisp (provide 'init)