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
This commit is contained in:
Evie Litherland-Smith 2023-11-19 09:34:23 +00:00
parent a5fb84978d
commit 382ba548ea
2 changed files with 268 additions and 230 deletions

View file

@ -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,10 +337,6 @@
))
(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))
@ -376,19 +376,25 @@
:function #'citar-is-cited
:padding " "
:tag "is:cited"))
(setq citar-indicators (list citar-indicator-files-icons
: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)))
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"))
(use-package khalel
:hook (org-agenda-mode . khalel-import-events)
:config
(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 @@
("<remap> <project-vc-dir" . magit-project-status)
:map project-prefix-map
("m" . magit-project-status))
:custom
(magit-define-global-key-bindings nil)
(magit-clone-default-directory "~/Projects/")
(magit-commit-show-diff nil)
(magit-commit-diff-inhibit-same-window t)
:config
(add-to-list 'project-switch-commands '(magit-project-status "Magit") t))
(setq vertico-cycle t)
(use-package vertico
:ensure t
:custom
(vertico-cycle t)
:config
(require 'vertico-directory)
(vertico-mode +1))
(setq marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(use-package marginalia
:ensure t
:custom
(marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
:config (marginalia-mode +1))
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion))))))
(setq corfu-cycle t
corfu-auto t
corfu-auto-prefix 3)
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles . (partial-completion))))))
(use-package corfu
:ensure t
:custom
(corfu-cycle t)
(corfu-auto t)
(corfu-auto-prefix 3)
:config
(global-corfu-mode +1)
(when (require 'corfu-popupinfo nil :noerror)
@ -525,8 +537,14 @@
(use-package consult-yasnippet
:ensure t
:after consult
:commands (consult-yasnippet)
:bind (("C-c s s" . consult-yasnippet)))
:commands (consult-yasnippet))
(use-package consult-eglot
:ensure t
:after consult
:requires eglot
:commands (consult-eglot-symbols)
:bind (("C-c s s" . consult-eglot-symbols)))
(use-package embark
:ensure t
@ -655,28 +673,27 @@
(mu4e-alert-enable-mode-line-display))
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:custom
(elfeed-db-directory (expand-file-name "db" elfeed-base-directory))
(elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory))
(rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory)))
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
:config (elfeed-tube-setup))))
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
(setq ement-save-sessions t)
:commands mastodon
:custom
(mastodon-instance-url "https://tech.lgbt")
(mastodon-active-user "Tux922"))
(defun my/ement-connect-pantalaimon ()
"Connect to ement.el by calling `ement-connect' with pantalaimon service as uri-prefix"
@ -693,7 +710,9 @@
("C-c m j" . ement-room-join)
("C-c m l" . ement-room-leave)
("C-c m v" . ement-room-view)
("C-c m c" . my/ement-connect-pantalaimon)))
("C-c m c" . my/ement-connect-pantalaimon))
:custom
(ement-save-sessions t))
(when (require 'emms-setup nil :noerror)
(setq emms-player-list '(emms-player-mpv)

View file

@ -292,15 +292,15 @@
*** Doom Modeline
#+begin_src emacs-lisp
(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))
#+end_src
@ -329,7 +329,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
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
@ -357,7 +356,9 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(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))
#+end_src
** org-agenda
@ -377,9 +378,12 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
** org-journal
#+BEGIN_SRC emacs-lisp :results output silent
(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"))
#+END_SRC
** Capture templates
@ -406,10 +410,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
** Citar
#+begin_src emacs-lisp :results output silent
(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))
@ -449,22 +449,28 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
:function #'citar-is-cited
:padding " "
:tag "is:cited"))
(setq citar-indicators (list citar-indicator-files-icons
: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)))
citar-indicator-cited-icons))))
#+end_src
** Khalel
#+begin_src emacs-lisp :results output silent
(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"))
(use-package khalel
:hook (org-agenda-mode . khalel-import-events)
:config
(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"))
#+end_src
** TODO Crafted config
#+BEGIN_SRC emacs-lisp
@ -493,30 +499,32 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
: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))
#+END_SRC
** Eglot LSP
#+BEGIN_SRC emacs-lisp
(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))
#+END_SRC
** Project
#+BEGIN_SRC emacs-lisp
@ -531,10 +539,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
** Version control
*** Magit
#+begin_src emacs-lisp
(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)
@ -545,15 +549,21 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
("<remap> <project-vc-dir" . magit-project-status)
:map project-prefix-map
("m" . magit-project-status))
:custom
(magit-define-global-key-bindings nil)
(magit-clone-default-directory "~/Projects/")
(magit-commit-show-diff nil)
(magit-commit-diff-inhibit-same-window t)
:config
(add-to-list 'project-switch-commands '(magit-project-status "Magit") t))
#+end_src
** Completion
*** Vertico
#+begin_src emacs-lisp
(setq vertico-cycle t)
(use-package vertico
:ensure t
:custom
(vertico-cycle t)
:config
(require 'vertico-directory)
(vertico-mode +1))
@ -561,11 +571,12 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
*** Marginalia
#+begin_src emacs-lisp
(setq marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
(use-package marginalia
:ensure t
:custom
(marginalia-annotators '(marginalia-annotators-heavy
marginalia-annotators-light
nil))
:config (marginalia-mode +1))
#+end_src
@ -573,19 +584,20 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
#+begin_src emacs-lisp
(use-package orderless
:ensure t
:config (setq completion-styles '(orderless basic)
completion-category-defaults nil
completion-category-overrides '((file (styles . (partial-completion))))))
:custom
(completion-styles '(orderless basic))
(completion-category-defaults nil)
(completion-category-overrides '((file (styles . (partial-completion))))))
#+end_src
*** Corfu and Cape
#+begin_src emacs-lisp
(setq corfu-cycle t
corfu-auto t
corfu-auto-prefix 3)
(use-package corfu
:ensure t
:custom
(corfu-cycle t)
(corfu-auto t)
(corfu-auto-prefix 3)
:config
(global-corfu-mode +1)
(when (require 'corfu-popupinfo nil :noerror)
@ -631,8 +643,14 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
(use-package consult-yasnippet
:ensure t
:after consult
:commands (consult-yasnippet)
:bind (("C-c s s" . consult-yasnippet)))
:commands (consult-yasnippet))
(use-package consult-eglot
:ensure t
:after consult
:requires eglot
:commands (consult-eglot-symbols)
:bind (("C-c s s" . consult-eglot-symbols)))
#+end_src
*** Embark
@ -682,7 +700,7 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
#+end_src
* Internet
** Email
** TODO Email
#+BEGIN_SRC emacs-lisp
(setq sendmail-program (executable-find "msmtp")
send-mail-function #'smtpmail-send-it
@ -780,37 +798,36 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
** Feeds
#+BEGIN_SRC emacs-lisp
(let ((elfeed-base-directory "~/.elfeed"))
(setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory)
elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory)
rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory))))
(use-package elfeed
:bind (("C-c f f" . elfeed)
("C-c f u" . elfeed-update))
:hook (elfeed-search-mode . elfeed-update)
:custom
(elfeed-db-directory (expand-file-name "db" elfeed-base-directory))
(elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory))
(rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory)))
:config
(use-package elfeed-org
:ensure t
:config (elfeed-org))
(use-package elfeed-tube
:ensure t
:config (elfeed-tube-setup)))
:config (elfeed-tube-setup))))
#+END_SRC
** Social
*** Mastodon
#+BEGIN_SRC emacs-lisp
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922")
(use-package mastodon
:commands mastodon)
:commands mastodon
:custom
(mastodon-instance-url "https://tech.lgbt")
(mastodon-active-user "Tux922"))
#+END_SRC
*** Matrix / Ement.el
#+begin_src emacs-lisp
(setq ement-save-sessions t)
(defun my/ement-connect-pantalaimon ()
"Connect to ement.el by calling `ement-connect' with pantalaimon service as uri-prefix"
(interactive)
@ -826,7 +843,9 @@ For reference information, see [[https://orgmode.com][Org-mode website]]
("C-c m j" . ement-room-join)
("C-c m l" . ement-room-leave)
("C-c m v" . ement-room-view)
("C-c m c" . my/ement-connect-pantalaimon)))
("C-c m c" . my/ement-connect-pantalaimon))
:custom
(ement-save-sessions t))
#+end_src