Switch emacs package definitions to use use-package

First pass, think I got everything but may need tweaking with use and testing
This commit is contained in:
Evie Litherland-Smith 2023-10-31 07:45:39 +00:00
parent 27ce6af080
commit 32436bb052
8 changed files with 122 additions and 92 deletions

View file

@ -5,17 +5,12 @@
message-send-mail-function #'message-send-mail-with-sendmail
message-kill-buffer-on-exit t)
(when (require 'mu4e nil :noerror)
(keymap-set global-map "C-c m m" #'mu4e)
(keymap-set global-map "C-c m u" #'mu4e-update-index)
(keymap-set global-map "C-c m c" #'mu4e-compose-new)
(when (require 'mu4e-alert nil :noerror)
(setq mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter)
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
(use-package mu4e
:defer t
:bind (("C-c m m" . mu4e)
("C-c m u" . mu4e-update-index)
("C-c m c" . mu4e-compose-new))
:config
(setq mu4e-maildir "~/Mail"
mu4e-attachment-dir "~/Downloads"
mu4e-get-mail-command "mbsync -a"
@ -29,11 +24,11 @@
message-sendmail-extra-arguments '("--read-envelope-from")
message-send-mail-function #'message-send-mail-with-sendmail
mu4e-headers-thread-single-orphan-prefix '("─>" . "─▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶ ")
mu4e-headers-thread-connection-prefix '("" . "")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
mu4e-headers-thread-orphan-prefix '("┬>" . "┬▶ ")
mu4e-headers-thread-connection-prefix '("" . "")
mu4e-headers-thread-first-child-prefix '("├>" . "├▶")
mu4e-headers-thread-child-prefix '("├>" . "├▶")
mu4e-headers-thread-last-child-prefix '("└>" . "╰▶")
mu4e-modeline-all-read '("R:" . "󰑇 ")
mu4e-modeline-all-clear '("C:" . "󰚭 ")
mu4e-modeline-new-items '("N:" . "󰎔 ")
@ -53,27 +48,42 @@
mu4e-contexts (list
(make-mu4e-context
:name "Proton"
:match-func (lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "e.litherlandsmith@proton.me")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
:match-func
(lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
:vars
'((user-mail-address . "e.litherlandsmith@proton.me")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-drafts-folder . "/Proton/Drafts")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")))
(make-mu4e-context
:name "iCloud"
:match-func (lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "e.litherlandsmith@icloud.com")
(mu4e-sent-folder . "/iCloud/Sent")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Trash")
(mu4e-refile-folder . "/iCloud/Archive")))
:match-func
(lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))))
:vars
'((user-mail-address . "e.litherlandsmith@icloud.com")
(mu4e-sent-folder . "/iCloud/Sent")
(mu4e-drafts-folder . "/iCloud/Drafts")
(mu4e-trash-folder . "/iCloud/Trash")
(mu4e-refile-folder . "/iCloud/Archive")))
(make-mu4e-context
:name "Outlook"
:match-func (lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
:vars '((user-mail-address . "evie.litherland-smith@ukaea.uk")
(mu4e-sent-folder . "/Outlook/Sent")
(mu4e-drafts-folder . "/Outlook/Drafts")
(mu4e-trash-folder . "/Outlook/Trash")
(mu4e-refile-folder . "/Outlook/Archive"))))))
:match-func
(lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
:vars
'((user-mail-address . "evie.litherland-smith@ukaea.uk")
(mu4e-sent-folder . "/Outlook/Sent")
(mu4e-drafts-folder . "/Outlook/Drafts")
(mu4e-trash-folder . "/Outlook/Trash")
(mu4e-refile-folder . "/Outlook/Archive"))))))
(use-package mu4e-alert
:requires mu4e
:after mu4e
:config
(setq mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter)
(mu4e-alert-set-default-style 'libnotify)
(mu4e-alert-enable-notifications)
(mu4e-alert-enable-mode-line-display))
(provide 'custom-email-config)

View file

@ -1,10 +1,20 @@
(when (require 'elfeed nil :noerror)
(use-package elfeed
:defer t
:config
(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))))
(add-hook 'elfeed-search-mode-hook #'elfeed-update)
(when (require 'elfeed-org nil :noerror) (elfeed-org))
(when (require 'elfeed-tube nil :noerror) (elfeed-tube-setup)))
(add-hook 'elfeed-search-mode-hook #'elfeed-update))
(use-package elfeed-org
:requires elfeed
:after elfeed
:config (elfeed-org))
(use-package elfeed-tube
:requires elfeed
:after elfeed
:config (elfeed-tube-setup))
(provide 'custom-feed-config)

View file

@ -1,24 +1,32 @@
(when (require 'rainbow-delimiters nil :noerror)
(use-package rainbow-delimiters
:ensure t
:config
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
(when (require 'treesit-aut nil :noerror)
(use-package treesit-auto
:config
(global-treesit-auto-mode +1))
(when (require 'apheleia nil :noerror)
(use-package apheleia
:ensure t
:config
(setq apheleia-remote-algorithm 'local)
(keymap-set global-map "C-c c f" #'apheleia-format-buffer)
(apheleia-global-mode +1))
(when (require 'eglot nil :noerror)
(eglot-ensure))
(when (require 'direnv nil :noerror)
(use-package direnv
:ensure t
:config
(setq direnv-always-show-summary nil)
(direnv-mode +1))
(when (require 'yasnippet nil :noerror)
(use-package yasnippet
:ensure t
:config
(require 'yasnippet-snippets nil :noerror)
(yas-reload-all)
(add-hook 'prog-mode-hook #'yas-minor-mode))
(eglot-ensure)
(provide 'custom-ide-config)

View file

@ -1,4 +1,6 @@
(when (require 'emms-setup nil :noerror)
(use-package emms
:defer t
:config
(setq emms-player-list '(emms-player-mpv)
emms-info-functions '(emms-info-native)
emms-source-file-default-directory "~/Music"

View file

@ -50,7 +50,10 @@
:emptry-lines 1)
))
(when (require 'khalel nil :noerror)
(use-package khalel
:requires org
:after org
:config
(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

View file

@ -6,7 +6,10 @@
(project-find-dir "Find directory")
(project-eshell "Eshell")))
(when (require 'magit nil :noerror)
(use-package magit
:ensure t
:defer t
:config
(setq magit-clone-default-directory "~/Projects/"))
(provide 'custom-project-config)

View file

@ -1,4 +1,6 @@
(when (require 'mastodon nil :noerror)
(use-package mastodon
:defer t
:config
(setq mastodon-instance-url "https://tech.lgbt"
mastodon-active-user "Tux922"))

View file

@ -21,72 +21,64 @@
(set-frame-parameter nil 'alpha-background 80)
(add-hook 'server-after-make-frame-hook (lambda () (set-frame-parameter nil 'alpha-background 80)))
(when (require 'doom-themes nil :noerror)
(use-package doom-themes
:ensure t
:config
(load-theme 'doom-tokyo-night t))
;; Nerd-Icons modes
(when (require 'nerd-icons-dired nil :noerror)
(use-package nerd-icons-dired
:requires nerd-icons
:ensure t
:config
(add-hook 'dired-mode-hook #'nerd-icons-dired-mode))
(when (require 'nerd-icons-ibuffer nil :noerror)
(use-package nerd-icons-ibuffer
:requires nerd-icons
:ensure t
:config
(add-hook 'ibuffer-mode-hook #'nerd-icons-ibuffer-mode))
(when (require 'nerd-icons-completion nil :noerror)
(nerd-icons-completion-mode)
(when (require 'marginalia nil :noerror)
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)))
(use-package nerd-icons-completion
:requires (nerd-icons marginalia)
:ensure t
:config
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup))
;; Doom-Modeline
(when (require 'doom-modeline nil :noerror)
(use-package doom-modeline
:ensure t
:config
(setq doom-modeline-icon t
doom-modeline-mu4e t)
(display-battery-mode)
(doom-modeline-mode +1))
;; Dashboard
(when (require 'dashboard nil :noerror)
(setq initial-buffer-choice 'dashboard-open
dashboard-icon-type 'nerd-icons
dashboard-set-heading-icons t
dashboard-set-file-icons t
dashboard-set-navigator t
dashboard-set-init-info t
dashboard-startup-banner 'ascii
dashboard-projects-backend 'project-el
dashboard-projects-switch-function 'project-switch-project
dashboard-projects-show-base t
dashboard-recentf-show-base 'align
dashboard-items '((projects . 5) (agenda . 5) (recents . 5))
dashboard-banner-ascii (concat " .000000. \n"
" .0. .0. \n"
" .00. .00. \n"
" .000cl. .lc000. \n"
".0 0.\n"
"0. .o0000o. .0\n"
" 00 .0' '0. 00 \n"
" 00 .0 0. 00 \n"
" HHHHH HHHHHHHHHHHH HHHHH \n"
"HHHH HHH HHHHHHHHHHHHHH HHHH\n"
" HHHHHH HHHHHHHHH HHHHHHHH \n"
" HHH HHHH HHHHHHHHH HHHH \n"
" HHH HHHHHH \n"
" HHHHH HH \n")))
;; Extra minor-modes
(when (require 'which-key nil :noerror)
(use-package which-key
:ensure t
:config
(which-key-mode +1))
(when (require 'page-break nil :noerror)
(use-package page-break
:ensure t
:config
(global-page-break-lines-mode +1))
;; Weather in modeline
(setq display-wttr-format 1)
(when (require 'display-wttr nil :noerror) (display-wttr-mode +1))
(use-package display-wttr
:ensure t
:config
(setq display-wttr-format 1)
(display-wttr-mode +1))
;;;; Help Buffers
;; Make `describe-*' screens more helpful
(when (require 'helpful nil :noerror)
(use-package helpful
:ensure t
:config
(keymap-set helpful-mode-map "<remap> <revert-buffer>" #'helpful-update)
(keymap-global-set "<remap> <describe-command>" #'helpful-command)
(keymap-global-set "<remap> <describe-function>" #'helpful-callable)