From 3df022ab3f6e01844d835d7e8ca4752213c7067d Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 14 Feb 2026 21:54:01 -0500 Subject: [PATCH] Move org custom faces to a use-package :custom-face block. This prevent the faces from being written to custom.el. --- .../roles/emacs/files/emacs/elisp/base.el | 27 ++-- .../emacs/files/emacs/elisp/common-lsp.el | 1 + .../roles/emacs/files/emacs/elisp/lang-org.el | 140 +++++++++--------- 3 files changed, 88 insertions(+), 80 deletions(-) diff --git a/nix/configuration/roles/emacs/files/emacs/elisp/base.el b/nix/configuration/roles/emacs/files/emacs/elisp/base.el index 347e8656..9776adde 100644 --- a/nix/configuration/roles/emacs/files/emacs/elisp/base.el +++ b/nix/configuration/roles/emacs/files/emacs/elisp/base.el @@ -1,9 +1,19 @@ (package-initialize) -(use-package use-package) +(use-package use-package + :custom + ;; Unless otherwise specified, always install packages if they are absent. + (use-package-always-ensure t) + ;; Allow updating built-in packages like eglot + ;; For some reason, built-in packages are still not updating so I'm just going to comment this out. + ;; (package-install-upgrade-built-in t) + ;; Natively compile packages + (package-native-compile t) + :config + (add-to-list 'package-archives + '("melpa" . "https://melpa.org/packages/") + ) + ) -(add-to-list 'package-archives - '("melpa" . "https://melpa.org/packages/") - ) (use-package auto-package-update :ensure t @@ -71,10 +81,11 @@ ) (setq-default - ;; Unless otherwise specified, always install packages if they are absent. - use-package-always-ensure t ;; Point custom-file at /dev/null so emacs does not write any settings to my dotfiles. - custom-file "/dev/null" + ;; custom-file "/dev/null" + ;; + ;; list-package breaks on newer versions of emacs if custom-file is set to /dev/null + custom-file (expand-file-name "custom.el" user-emacs-directory) ;; Don't pop up a small window at the bottom of emacs at launch. inhibit-startup-screen t inhibit-startup-message t @@ -95,8 +106,6 @@ "%b"))) ;; Use 'y' or 'n' instead of 'yes' or 'no' use-short-answers t - ;; Natively compile packages - package-native-compile t ;; Confirm when opening a file that does not exist confirm-nonexistent-file-or-buffer t ;; Do not require double space to end a sentence. diff --git a/nix/configuration/roles/emacs/files/emacs/elisp/common-lsp.el b/nix/configuration/roles/emacs/files/emacs/elisp/common-lsp.el index 66d10dc8..76d3d346 100644 --- a/nix/configuration/roles/emacs/files/emacs/elisp/common-lsp.el +++ b/nix/configuration/roles/emacs/files/emacs/elisp/common-lsp.el @@ -1,4 +1,5 @@ (use-package eglot + ;; This is an emacs built-in but we're pulling the latest version :pin gnu :commands (eglot eglot-ensure) :bind (:map eglot-mode-map diff --git a/nix/configuration/roles/emacs/files/emacs/elisp/lang-org.el b/nix/configuration/roles/emacs/files/emacs/elisp/lang-org.el index 870e332a..64a7fc05 100644 --- a/nix/configuration/roles/emacs/files/emacs/elisp/lang-org.el +++ b/nix/configuration/roles/emacs/files/emacs/elisp/lang-org.el @@ -1,81 +1,79 @@ -(use-package org - :ensure nil - :commands org-mode - :bind (:map org-mode-map - ("C-c l" . org-store-link) - ("C-c a" . org-agenda) - ("S-" . org-shiftup) - ("S-" . org-shiftright) - ("S-" . org-shiftdown) - ("S-" . org-shiftleft) - ) - :hook ( - (org-mode . (lambda () - (org-indent-mode +1) - )) - ;; Make windmove work in Org mode: - (org-shiftup-final . windmove-up) - (org-shiftleft-final . windmove-left) - (org-shiftdown-final . windmove-down) - (org-shiftright-final . windmove-right) - ) - :config - (require 'org-tempo) - (setq org-export-latex-listings t) - (setq org-startup-truncated nil) - (setq org-startup-folded nil) - (setq org-src-fontify-natively t - org-src-tab-acts-natively t - org-confirm-babel-evaluate nil - ) +(require 'color) +(let ((bg (face-attribute 'default :background))) + (use-package org + :ensure nil + :commands org-mode + :bind (:map org-mode-map + ("C-c l" . org-store-link) + ("C-c a" . org-agenda) + ("S-" . org-shiftup) + ("S-" . org-shiftright) + ("S-" . org-shiftdown) + ("S-" . org-shiftleft) + ) + :hook ( + (org-mode . (lambda () + (org-indent-mode +1) + )) + ;; Make windmove work in Org mode: + (org-shiftup-final . windmove-up) + (org-shiftleft-final . windmove-left) + (org-shiftdown-final . windmove-down) + (org-shiftright-final . windmove-right) + ) + :custom-face + (org-block ((t (:inherit default :background ,(color-lighten-name bg 15) :extend ,t)))) + (org-block-begin-line ((t (:inherit default :background ,"#472300" :extend ,t)))) + (org-block-end-line ((t (:inherit default :background ,"#472300" :extend ,t)))) + :config + (require 'org-tempo) + (setq org-export-latex-listings t) + (setq org-startup-truncated nil) + (setq org-startup-folded nil) + (setq org-src-fontify-natively t + org-src-tab-acts-natively t + org-confirm-babel-evaluate nil + ) - ;; Show the full source of org-mode links instead of condensing them. I.E. render "[[foo]]" instead of "foo" - (setq org-descriptive-links nil) + ;; Show the full source of org-mode links instead of condensing them. I.E. render "[[foo]]" instead of "foo" + (setq org-descriptive-links nil) - ;; Only interpret _ and ^ and sub and superscripts if they're of the form _{subscript} and ^{superscript} - (setq org-export-with-sub-superscripts '{}) - ;; Don't include a "validate" link at the bottom of html export - (setq org-html-validation-link nil) + ;; Only interpret _ and ^ and sub and superscripts if they're of the form _{subscript} and ^{superscript} + (setq org-export-with-sub-superscripts '{}) + ;; Don't include a "validate" link at the bottom of html export + (setq org-html-validation-link nil) - (setq org-latex-listings 'minted) - (setq org-latex-minted-options '(("breaklines" "true") - ("breakanywhere" "true") - ("bgcolor" "mintedbg") ("frame" "single") ("framesep" "6pt") ("fontsize" "\\footnotesize"))) + (setq org-latex-listings 'minted) + (setq org-latex-minted-options '(("breaklines" "true") + ("breakanywhere" "true") + ("bgcolor" "mintedbg") ("frame" "single") ("framesep" "6pt") ("fontsize" "\\footnotesize"))) - ;; TODO: There is an option to set the compiler, could be better than manually doing this here https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html - ;; (setq org-latex-compiler "lualatex") - ;; TODO: nixos latex page recommends this line, figure out what it does / why its needed: - ;; (setq org-preview-latex-default-process 'dvisvgm) - (setq org-latex-pdf-process - '("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" - "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f")) - (add-to-list 'org-latex-packages-alist '("cache=false" "minted")) - (add-to-list 'org-latex-packages-alist '("" "svg")) - (add-to-list 'org-latex-packages-alist '("margin=2cm" "geometry" nil)) + ;; TODO: There is an option to set the compiler, could be better than manually doing this here https://orgmode.org/manual/LaTeX_002fPDF-export-commands.html + ;; (setq org-latex-compiler "lualatex") + ;; TODO: nixos latex page recommends this line, figure out what it does / why its needed: + ;; (setq org-preview-latex-default-process 'dvisvgm) + (setq org-latex-pdf-process + '("lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f" + "lualatex -shell-escape -interaction nonstopmode -output-directory %o %f")) + (add-to-list 'org-latex-packages-alist '("cache=false" "minted")) + (add-to-list 'org-latex-packages-alist '("" "svg")) + (add-to-list 'org-latex-packages-alist '("margin=2cm" "geometry" nil)) - (add-to-list 'org-src-lang-modes '("dot" . "graphviz-dot")) + (add-to-list 'org-src-lang-modes '("dot" . "graphviz-dot")) - (org-babel-do-load-languages 'org-babel-load-languages - '((shell . t) - (js . t) - (emacs-lisp . t) - (python . t) - (dot . t) - (css . t) - (gnuplot . t) - (sqlite . t) - )) - - (require 'color) - - (let ((bg (face-attribute 'default :background))) - (custom-set-faces - `(org-block ((t (:inherit default :background ,(color-lighten-name bg 15) :extend ,t)))) - `(org-block-begin-line ((t (:inherit default :background ,"#472300" :extend ,t)))) - `(org-block-end-line ((t (:inherit default :background ,"#472300" :extend ,t)))) - )) + (org-babel-do-load-languages 'org-babel-load-languages + '((shell . t) + (js . t) + (emacs-lisp . t) + (python . t) + (dot . t) + (css . t) + (gnuplot . t) + (sqlite . t) + )) + ) ) (use-package org-bullets