Start actually caching ltximg, and move general temp dir to $XDG_RUNTIME_DIR

This commit is contained in:
eriedaberrie 2025-03-04 02:16:14 +00:00
parent 8f0da429f6
commit b1010e4df6

25
init.el
View file

@ -19,17 +19,21 @@
use-package-expand-minimally t) use-package-expand-minimally t)
(require 'use-package) (require 'use-package)
(let ((emacs-tmp-dir (expand-file-name (format "emacs%d" (user-uid)) (require 'xdg)
temporary-file-directory))) (defvar my-tmp-dir (if-let* ((runtime-dir (xdg-runtime-dir)))
(setq auto-save-file-name-transforms `((".*" ,emacs-tmp-dir t)) (expand-file-name "emacs/"
auto-save-list-file-prefix emacs-tmp-dir runtime-dir)
backup-directory-alist (setq undo-tree-history-directory-alist (expand-file-name (format "emacs%d/"
`((".*" . ,emacs-tmp-dir))) (user-uid))
org-preview-latex-image-directory (expand-file-name "ltximg" emacs-tmp-dir))) temporary-file-directory))
"Directory used to store temporary state.")
(setq backup-by-copying t (setq auto-save-file-name-transforms `((".*" ,my-tmp-dir t))
auto-save-list-file-prefix my-tmp-dir
backup-directory-alist `((".*" . ,my-tmp-dir))
backup-by-copying t
inhibit-splash-screen t inhibit-splash-screen t
custom-file (expand-file-name "custom.el" temporary-file-directory) custom-file (expand-file-name "custom.el" my-tmp-dir)
custom-safe-themes t) custom-safe-themes t)
(defun my-inhibit-hl-line-mode () (defun my-inhibit-hl-line-mode ()
@ -539,6 +543,9 @@
;; NixOS minimal LaTeX setup ;; NixOS minimal LaTeX setup
(org-latex-compiler "lualatex") (org-latex-compiler "lualatex")
(org-preview-latex-default-process 'lua-dvisvgm) (org-preview-latex-default-process 'lua-dvisvgm)
(org-preview-latex-image-directory (if-let* ((cache (xdg-cache-home)))
(expand-file-name "ltximg/" cache)
".ltximg/"))
(org-latex-src-block-backend 'engraved) (org-latex-src-block-backend 'engraved)
:config :config
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.3) (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.3)