From 10a3be069d045894916b3dd1314916c9bfb34a34 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 9 Mar 2025 22:02:22 +0200 Subject: files: Move to early configuration, incorporate top-level config --- init.el | 62 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 30 deletions(-) (limited to 'init.el') diff --git a/init.el b/init.el index 1c7a28c..03b6d5a 100644 --- a/init.el +++ b/init.el @@ -25,9 +25,8 @@ (defconst tmp-dir (expand-file-name "tmp" local-dir)) (defconst shared-dir (expand-file-name "shared" base-dir)) -(setq auto-save-file-name-transforms `((".*" ,tmp-dir t)) - backup-directory-alist `((".*" . ,tmp-dir)) - custom-file (expand-file-name "custom.el" shared-dir) +;; Early configurations +(setq custom-file (expand-file-name "custom.el" shared-dir) shared-game-score-directory (expand-file-name "shared-game-score" shared-dir)) (defun $adv-write-to-sane-paths (fn &rest args) @@ -38,7 +37,35 @@ (advice-add #'enable-command :around #'$adv-write-to-sane-paths) (advice-add #'disable-command :around #'$adv-write-to-sane-paths) -(advice-add #'locate-user-emacs-file :around #'$adv-write-to-sane-paths) + +(use-package files + :defer t + :custom + (auto-mode-case-fold nil) + (auto-save-file-name-transforms `((".*" ,tmp-dir t))) + (backup-directory-alist `((".*" . ,tmp-dir))) + (major-mode-remap-alist '((c-mode . c-ts-mode) + (c-or-c++-mode . c-or-c++-ts-mode) + (c++-mode . c++-ts-mode) + (cmake-mode . cmake-ts-mode) + (csharp-mode . csharp-ts-mode) + (css-mode . css-ts-mode) + (dockerfile-mode . dockerfile-ts-mode) + (go-mode . go-ts-mode) + (go-mod-mode . go-mod-ts-mode) + (html-mode . mhtml-mode) + (java-mode . java-ts-mode) + (js-mode . js-ts-mode) + (json-mode . json-ts-mode) + (python-mode . python-ts-mode) + (ruby-mode . ruby-ts-mode) + (rust-mode . rust-ts-mode) + (yaml-mode . yaml-ts-mode) + (toml-mode . toml-ts-mode) + (tsx-mode . tsx-ts-mode) + (typescript-mode . typescript-ts-mode))) + :config + (advice-add #'locate-user-emacs-file :around #'$adv-write-to-sane-paths)) (when (file-exists-p custom-file) (load custom-file)) @@ -67,8 +94,6 @@ (setq auth-sources (list (expand-file-name "authinfo.gpg" local-config-dir) "~/.authinfo.gpp")) -;; Force case sensitivity (if case insensitive, `auto-mode-alist` will be scanned twice). -(setq auto-mode-case-fold nil) ;; Don't draw stuff in other windows. (setq-default cursor-in-non-selected-windows nil) @@ -127,6 +152,7 @@ (straight-freeze-versions)) ;; use-package +;; TODO: Check how to do add smth like `:advice (fn :around advice)` sometime (use-package use-package) ;; compat @@ -379,30 +405,6 @@ ;; This actually has to be hooked to after-init to be one of the first minor modes enabled :hook (after-init . envrc-global-mode)) -(use-package files - :straight '(files :type built-in) - :custom - (major-mode-remap-alist '((c-mode . c-ts-mode) - (c-or-c++-mode . c-or-c++-ts-mode) - (c++-mode . c++-ts-mode) - (cmake-mode . cmake-ts-mode) - (csharp-mode . csharp-ts-mode) - (css-mode . css-ts-mode) - (dockerfile-mode . dockerfile-ts-mode) - (go-mode . go-ts-mode) - (go-mod-mode . go-mod-ts-mode) - (html-mode . mhtml-mode) - (java-mode . java-ts-mode) - (js-mode . js-ts-mode) - (json-mode . json-ts-mode) - (python-mode . python-ts-mode) - (ruby-mode . ruby-ts-mode) - (rust-mode . rust-ts-mode) - (yaml-mode . yaml-ts-mode) - (toml-mode . toml-ts-mode) - (tsx-mode . tsx-ts-mode) - (typescript-mode . typescript-ts-mode)))) - (use-package gcmh :straight t :custom -- cgit v1.2.3