From 815f603128105f97568b49262c2c4b96385cb3f4 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Mon, 23 Oct 2023 23:55:52 +0100 Subject: [PATCH] Move email config over from doom-emacs --- Makefile | 2 +- home/accounts/email.nix | 2 +- home/emacs/default.nix | 4 ++ home/emacs/init.el | 25 ++++++-- home/emacs/modules/custom-email-config.el | 70 +++++++++++++++++++++++ 5 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 home/emacs/modules/custom-email-config.el diff --git a/Makefile b/Makefile index da4365b9..d29ac486 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ switch: sudo nixos-rebuild switch --flake . mu: - mu init --maildir ~/.mail \ + mu init --maildir ~/Mail \ --my-address=e.litherlandsmith@proton.me \ --my-address=evie@xenia.me.uk \ --my-address=evie@litherlandsmith.slmail.me \ diff --git a/home/accounts/email.nix b/home/accounts/email.nix index 8a413d56..808724b2 100644 --- a/home/accounts/email.nix +++ b/home/accounts/email.nix @@ -22,7 +22,7 @@ imapnotify.enable = true; }; accounts.email = { - maildirBasePath = ".mail"; + maildirBasePath = "Mail"; accounts = let realName = "Evie Litherland-Smith"; in { proton = let diff --git a/home/emacs/default.nix b/home/emacs/default.nix index 36ec54a7..9957c5d4 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -61,6 +61,10 @@ auctex auctex-latexmk + # custom-email-packages + mu4e + mu4e-alert + # Additional packages magit vterm diff --git a/home/emacs/init.el b/home/emacs/init.el index 11282208..9f63d955 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -20,13 +20,13 @@ ;;; Configuration phase -;; Some example modules to configure Emacs. Don't blindly copy these, -;; they are here for example purposes. Find the modules which work -;; for you and add them here. +(require 'custom-email-config) + (require 'crafted-completion-config) (require 'crafted-defaults-config) (require 'crafted-ide-config) (require 'crafted-org-config) +(require 'crafted-speedbar-config) (require 'crafted-startup-config) (require 'crafted-ui-config) (require 'crafted-workspaces-packages) @@ -36,7 +36,9 @@ (setq user-full-name "Evie Litherland-Smith" user-mail-address "evie@xenia.me.uk" - display-line-numbers 'relative) + display-line-numbers 'relative + fill-column 80) +(global-display-fill-column-indicator-mode) ;; Theme settings (load-theme 'doom-tokyo-night t) @@ -45,13 +47,26 @@ (set-frame-parameter nil 'alpha-background 80) (add-to-list 'default-frame-alist '(alpha-background . 80)) -;; Profile emacs startup +;; Extra functions + (defun crafted-startup-example/display-startup-time () "Display the startup time after Emacs is fully initialized." (message "Crafted Emacs loaded in %s." (emacs-init-time))) (add-hook 'emacs-startup-hook #'crafted-startup-example/display-startup-time) +(defun my/org-move-done-tasks-to-bottom () + "Sort all tasks in the topmost heading by TODO state." + (interactive) + (save-excursion + (while (org-up-heading-safe)) + (org-sort-entries nil ?o)) + + ;; Reset the view of TODO items + (org-overview) + (org-show-entry) + (org-show-children)) + ;; Set default coding system (especially for Windows) (set-default-coding-systems 'utf-8) (set-terminal-coding-system 'utf-8) diff --git a/home/emacs/modules/custom-email-config.el b/home/emacs/modules/custom-email-config.el new file mode 100644 index 00000000..eb7d1579 --- /dev/null +++ b/home/emacs/modules/custom-email-config.el @@ -0,0 +1,70 @@ +(setq mu4e-maildir "~/Mail" + mu4e-attachment-dir "~/Downloads" + mu4e-get-mail-command "mbsync --pull-new inboxes" + mu4e-update-interval (* 5 60) ; Every 5 minutes + mu4e-sent-messages-behavior 'sent + mu4e-change-filenames-when-moving t + mu4e-alert-modeline-formatter 'mu4e-alert-default-mode-line-formatter + sendmail-program (executable-find "msmtp") + send-mail-function #'smtpmail-send-it + message-sendmail-f-is-evil t + message-sendmail-extra-arguments '("--read-envelope-from") + message-send-mail-function #'message-send-mail-with-sendmail + mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p) + (:maildir "/iCloud/Inbox/" :key ?i) + (:maildir "/Outlook/Inbox/" :key ?o)) + mu4e-modeline-all-read '("R:" . "󰑇 ") + mu4e-modeline-all-clear '("C:" . "󰚭 ") + mu4e-modeline-new-items '("N:" . "󰎔 ") + mu4e-modeline-unread-items '("U:" . "󰮒 ") + mu4e-search-full-label '("F" . "󱊖 ") + mu4e-search-hide-label '("H" . "󰘓 ") + mu4e-search-related-label '("R" . "󰌹 ") + mu4e-search-skip-duplicates-label '("D" . "󰆑 ") + mu4e-search-threaded-label'("T" . "󱇫 ")) + +(require 'mu4e) + +(setq 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")) + ) + (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")) + ) + (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")) + ) + )) +(provide 'custom-email-config)