From 382ba548eafe728091439067eec8620eea56bf20 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Sun, 19 Nov 2023 09:34:23 +0000 Subject: [PATCH] Convert lots of setq statements to use customise Move as many "setq before use-package" sections into use-package :custom blocks as possible atm, somethings still need a bit of a rewrite anyway so TODO another time --- home/emacs/init.el | 247 +++++++++++++++++++++++-------------------- home/emacs/init.org | 251 ++++++++++++++++++++++++-------------------- 2 files changed, 268 insertions(+), 230 deletions(-) diff --git a/home/emacs/init.el b/home/emacs/init.el index 603054d8..9a0646a5 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -42,8 +42,8 @@ (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) (setq backup-directory-alist '(("." . "~/.local/state/emacs/backups")) - tramp-backup-directory-alist backup-directory-alist - tramp-auto-save-directory "~/.local/state/emacs/backups") + tramp-backup-directory-alist backup-directory-alist + tramp-auto-save-directory "~/.local/state/emacs/backups") (when (require 'package nil :noerror) (add-to-list 'package-archives '("stable" . "https://stable.melpa.org/packages/")) @@ -245,15 +245,15 @@ (display-time-mode -1) (display-battery-mode -1) -(setq doom-modeline-icon t - doom-modeline-minor-modes t - doom-modeline-buffer-encoding 'nondefault - doom-modeline-enable-word-count t - doom-modeline-continuous-word-count-modes '(org-mode - markdown-mode - gfm-mode)) (use-package doom-modeline :ensure t + :custom + (doom-modeline-icon t) + (doom-modeline-minor-modes t) + (doom-modeline-buffer-encoding 'nondefault) + (doom-modeline-enable-word-count t) + (doom-modeline-continuous-word-count-modes + '(org-mode markdown-mode gfm-mode)) :config (doom-modeline-mode +1)) @@ -271,7 +271,6 @@ org-pretty-entities-include-sub-superscripts t org-pretty-entities-include-sub-superscripts t org-tags-column 0 - org-modern-tag nil org-outline-path-complete-in-steps nil org-return-follows-link t org-mouse-1-follows-link t @@ -296,7 +295,9 @@ (use-package org-modern :ensure t :hook ((org-mode . org-modern-mode) - (org-agenda-finalize . org-modern-agenda))) + (org-agenda-finalize . org-modern-agenda)) + :custom + (org-modern-tag nil)) (setq org-agenda-span 'week org-agenda-start-on-weekday 1 @@ -310,9 +311,12 @@ (tags . " %-12:c") (search . " %-12:c"))) -(setq org-journal-dir (expand-file-name "journal" org-directory) - org-journal-file-type 'monthly - org-journal-file-format "%Y-%m.org") +(use-package org-journal + :bind (("C-c o j" . org-journal-new-entry)) + :custom + (org-journal-dir (expand-file-name "journal" org-directory)) + (org-journal-file-type 'monthly) + (org-journal-file-format "%Y-%m.org")) (setq org-capture-templates '(("n" "Note" entry @@ -333,62 +337,64 @@ )) (let ((citar-base-directory "~/References")) - (setq citar-bibliography (expand-file-name "main.bib" citar-base-directory) - citar-library-paths (list (expand-file-name "library" citar-base-directory)) - citar-notes-paths (list (expand-file-name "notes" citar-base-directory)))) + (use-package citar + :ensure t + :bind (("C-c o c o" . citar-open)) + :config + (defvar citar-indicator-files-icons + (citar-indicator-create + :symbol (nerd-icons-octicon + "nf-oct-file" + :face 'nerd-icons-green + :v-adjust -0.1) + :function #'citar-has-files + :padding " " ; need this because the default padding is too low for these icons + :tag "has:files")) + (defvar citar-indicator-links-icons + (citar-indicator-create + :symbol (nerd-icons-octicon + "nf-oct-link" + :face 'nerd-icons-orange + :v-adjust 0.01) + :function #'citar-has-links + :padding " " + :tag "has:links")) + (defvar citar-indicator-notes-icons + (citar-indicator-create + :symbol (nerd-icons-octicon + "nf-oct-note" + :face 'nerd-icons-blue + :v-adjust -0.3) + :function #'citar-has-notes + :padding " " + :tag "has:notes")) + (defvar citar-indicator-cited-icons + (citar-indicator-create + :symbol (nerd-icons-octicon + "nf-oct-circle" + :face 'nerd-icon-green) + :function #'citar-is-cited + :padding " " + :tag "is:cited")) + :custom + (citar-bibliography (expand-file-name "main.bib" citar-base-directory)) + (citar-library-paths (list (expand-file-name "library" citar-base-directory))) + (citar-notes-paths (list (expand-file-name "notes" citar-base-directory))) + (citar-indicators (list citar-indicator-files-icons + citar-indicator-links-icons + citar-indicator-notes-icons + citar-indicator-cited-icons)))) -(use-package citar - :ensure t - :bind (("C-c o c o" . citar-open)) +(use-package khalel + :hook (org-agenda-mode . khalel-import-events) :config - (defvar citar-indicator-files-icons - (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-file" - :face 'nerd-icons-green - :v-adjust -0.1) - :function #'citar-has-files - :padding " " ; need this because the default padding is too low for these icons - :tag "has:files")) - (defvar citar-indicator-links-icons - (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-link" - :face 'nerd-icons-orange - :v-adjust 0.01) - :function #'citar-has-links - :padding " " - :tag "has:links")) - (defvar citar-indicator-notes-icons - (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-note" - :face 'nerd-icons-blue - :v-adjust -0.3) - :function #'citar-has-notes - :padding " " - :tag "has:notes")) - (defvar citar-indicator-cited-icons - (citar-indicator-create - :symbol (nerd-icons-octicon - "nf-oct-circle" - :face 'nerd-icon-green) - :function #'citar-is-cited - :padding " " - :tag "is:cited")) - (setq citar-indicators (list citar-indicator-files-icons - citar-indicator-links-icons - citar-indicator-notes-icons - citar-indicator-cited-icons))) - -(setq khalel-import-org-file (expand-file-name "calendar.org" org-directory) - khalel-import-org-file-read-only nil - khalel-import-org-file-confirm-overwrite nil - khalel-import-start-date "-30d" - khalel-import-end-date "+30d") -(when (require 'khalel nil :noerror) - (add-hook 'org-agenda-mode-hook #'khalel-import-events) - (khalel-add-capture-template "e")) + (khalel-add-capture-template "e") + :custom + (khalel-import-org-file (expand-file-name "calendar.org" org-directory)) + (khalel-import-org-file-read-only nil) + (khalel-import-org-file-confirm-overwrite nil) + (khalel-import-start-date "-30d") + (khalel-import-end-date "+30d")) ;; Disable auto-pairing of "<" in org-mode with electric-pair-mode (defun crafted-org-enhance-electric-pair-inhibit-predicate () @@ -410,27 +416,29 @@ :ensure t :hook (prog-mode)) -(setq apheleia-remote-algorithm 'local) (use-package apheleia :ensure t :defer nil :bind (("C-c c f" . apheleia-format-buffer)) + :custom (apheleia-remote-algorithm 'local) :config (apheleia-global-mode +1)) (use-package treesit-auto :config (global-treesit-auto-mode +1)) -(setq direnv-always-show-summary nil) (use-package direnv :ensure t + :custom (direnv-always-show-summary nil) :config (direnv-mode +1)) -(setq eglot-extend-to-xref t - eglot-autoshutdown t - eglot-autoreconnect nil) -(when (require 'eglot nil :noerror) - (add-hook 'prog-mode-hook #'eglot-ensure) - (keymap-global-set "C-c c e" #'eglot)) +(use-package eglot + :ensure t + :bind (("C-c c e" . eglot)) + :hook (prog-mode . eglot-ensure) + :custom + (eglot-extend-to-xref t) + (eglot-autoshutdown t) + (eglot-autoreconnect nil)) (setq project-switch-use-entire-map t project-switch-commands @@ -440,10 +448,6 @@ (project-find-dir "Find directory") (project-eshell "Eshell"))) -(setq magit-define-global-key-bindings nil - magit-clone-default-directory "~/Projects/" - magit-commit-show-diff nil - magit-commit-diff-inhibit-same-window t) (use-package magit :ensure t :bind (("C-c g g" . magit-status) @@ -454,35 +458,43 @@ ("