From 27ce6af0809019c2f4b62d07cac16701e1530437 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 31 Oct 2023 07:12:55 +0000 Subject: [PATCH] Switch everything back to mu4e (from notmuch) --- home/accounts/afew/config | 44 --------- home/accounts/email.nix | 60 +----------- home/emacs/default.nix | 4 - home/emacs/modules/custom-email-config.el | 109 ++++++++++++++-------- home/emacs/modules/custom-ui-config.el | 3 +- system/emacs.nix | 4 +- 6 files changed, 77 insertions(+), 147 deletions(-) delete mode 100644 home/accounts/afew/config diff --git a/home/accounts/afew/config b/home/accounts/afew/config deleted file mode 100644 index 4eeb9c30..00000000 --- a/home/accounts/afew/config +++ /dev/null @@ -1,44 +0,0 @@ -[SpamFilter] - -[KillThreadsFilter] - -[ListMailsFilter] - -[ArchiveSentMailsFilter] -sent_tag = sent - -[FolderNameFilter] -folder_explicit_list = Proton/Archive Proton/Trash iCloud/Archive 'iCloud/Deleted Messages' Outlook/Archive Outlook/Trash -folder_transforms = Archive:archive Trash:deleted 'Deleted Messages':deleted -folder_lowercases = true -maildir_separator = / - -[Filter.1] -message = Removing new/inbox/unread tags from archived mail -query = tag:archive -tags = -new;-inbox;-unread - -[Filter.2] -message = Removing new/inbox/unread tags from deleted mail -query = tag:deleted -tags = -new;-inbox;-unread - -[Filter.3] -message = Tag ReqCo emails -query = from:reqco@jet.uk -tags = +reqco - -[Filter.4] -message = Tag operations update emails -query = from:no-reply@jet.uk -tags = +operations - -[MailMover] -folders = Proton/Inbox iCloud/Inbox Outlook/Inbox -rename = True -max_age = 15 -Proton/Inbox = 'tag:archive':Proton/Archive 'tag:deleted':Proton/Trash -iCloud/Inbox = 'tag:archive':iCloud/Archive 'tag:deleted':'iCloud/Deleted Messages' -Outlook/Inbox = 'tag:archive':Outlook/Archive 'tag:deleted':Outlook/Trash - -[InboxFilter] \ No newline at end of file diff --git a/home/accounts/email.nix b/home/accounts/email.nix index 627b8b89..6e3595a6 100644 --- a/home/accounts/email.nix +++ b/home/accounts/email.nix @@ -3,6 +3,7 @@ { home.packages = with pkgs; [ davmail ]; programs = { + mu.enable = true; msmtp.enable = true; mbsync = { enable = true; @@ -12,33 +13,6 @@ outlook = [ "INBOX" ]; }; }; - notmuch = { - enable = true; - maildir.synchronizeFlags = true; - new.tags = [ "new" ]; - hooks = { - preNew = "${pkgs.isync}/bin/mbsync inboxes"; - postNew = '' - if [ $(${pkgs.notmuch}/bin/notmuch count is:new) -gt 0 ]; then - ${pkgs.libnotify}/bin/notify-send "Notmuch Email" "Unread emails in inbox" - fi - ${pkgs.afew}/bin/afew --new --tag - ${pkgs.afew}/bin/afew --move-mail - ''; - }; - }; - afew = { - enable = true; - extraConfig = builtins.readFile ./afew/config; - }; - }; - services = { - mbsync = { - enable = true; - frequency = "*:0/15"; - postExec = "${pkgs.notmuch}/bin/notmuch new"; - }; - imapnotify.enable = true; }; accounts.email = { maildirBasePath = "Mail"; @@ -65,16 +39,6 @@ userName = address; passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${userName}"; - imapnotify = { - enable = lib.mkDefault accountEnabled; - boxes = [ "INBOX" ]; - onNotify = "${pkgs.notmuch}/bin/notmuch new"; - extraConfig = { - wait = 300; - tls = false; - tlsOptions.rejectUnauthorized = false; - }; - }; mbsync = { enable = lib.mkDefault accountEnabled; create = "both"; @@ -91,7 +55,7 @@ auth = "login"; }; }; - notmuch.enable = lib.mkDefault accountEnabled; + mu.enable = lib.mkDefault accountEnabled; }; icloud = let accountEnabled = true; in rec { @@ -104,12 +68,6 @@ userName = address; passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${userName}"; - imapnotify = { - enable = lib.mkDefault accountEnabled; - boxes = [ "INBOX" ]; - onNotify = "${pkgs.notmuch}/bin/notmuch new"; - extraConfig.wait = 300; - }; mbsync = { enable = lib.mkDefault accountEnabled; create = "both"; @@ -119,7 +77,7 @@ subFolders = "Verbatim"; }; msmtp.enable = lib.mkDefault accountEnabled; - notmuch.enable = lib.mkDefault accountEnabled; + mu.enable = lib.mkDefault accountEnabled; }; outlook = let host = "127.0.0.1"; @@ -142,16 +100,6 @@ userName = address; passwordCommand = "${pkgs.libsecret}/bin/secret-tool lookup email ${userName}"; - imapnotify = { - enable = lib.mkDefault accountEnabled; - boxes = [ "INBOX" ]; - onNotify = "${pkgs.notmuch}/bin/notmuch new"; - extraConfig = { - wait = 300; - tls = false; - tlsOptions.rejectUnauthorized = false; - }; - }; mbsync = { enable = lib.mkDefault accountEnabled; create = "both"; @@ -176,7 +124,7 @@ auth = "login"; }; }; - notmuch.enable = lib.mkDefault accountEnabled; + mu.enable = lib.mkDefault accountEnabled; }; }; }; diff --git a/home/emacs/default.nix b/home/emacs/default.nix index 2605c21a..d9aa86e3 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -11,10 +11,6 @@ services.git-sync = { enable = true; repositories = with config.home; { - notmuch = { - path = "${homeDirectory}/.notmuch"; - uri = "git+https://git.xenia.me.uk/xenia/notmuch.git"; - }; elfeed = { path = "${homeDirectory}/.elfeed"; uri = "git+https://git.xenia.me.uk/xenia/elfeed.git"; diff --git a/home/emacs/modules/custom-email-config.el b/home/emacs/modules/custom-email-config.el index 2b72783b..2790e0a0 100644 --- a/home/emacs/modules/custom-email-config.el +++ b/home/emacs/modules/custom-email-config.el @@ -5,46 +5,75 @@ message-send-mail-function #'message-send-mail-with-sendmail message-kill-buffer-on-exit t) -(when (require 'notmuch nil :noerror) - (keymap-set global-map "C-c m m" #'notmuch) - (keymap-set global-map "C-c m c" #'notmuch-mua-new-mail) - (keymap-set global-map "C-c m s" #'notmuch-search) - (setq mail-user-agent 'notmuch-user-agent - notmuch-search-oldest-first nil - notmuch-show-logo nil - notmuch-hello-thousands-separator "," - notmuch-archive-tags '("+archive" "-inbox") - notmuch-message-headers-visible nil - notmuch-multipart/alternative-discouraged '("text/plain" "multipart/related") - notmuch-show-all-multipart/alternative-parts nil - notmuch-hello-sections '(notmuch-hello-insert-header - notmuch-hello-insert-saved-searches - notmuch-hello-insert-inbox - notmuch-hello-insert-alltags) - notmuch-fcc-dirs '((".*@xenia.me.uk" . "Proton/Sent") - (".*@proton.me" . "Proton/Sent") - (".*@litherlandsmith.slmail.me" . "Proton/Sent") - (".*@icloud.com" . "iCloud/Sent") - (".*@ukaea.uk" . "Outlook/Sent") - (".*@jet.uk" . "Outlook/Sent")) - notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i" :sort-order newest-first) - (:name "unread" :query "tag:unread AND tag:inbox" :key "u" :sort-order newest-first) - (:name "flagged" :query "tag:flagged" :key "f" :sort-order newest-first) - (:name "sent" :query "tag:sent" :key "t" :sort-order newest-first) - (:name "drafts" :query "tag:draft" :key "d" :sort-order newest-first) - (:name "all mail" :query "*" :key "a" :sort-order newest-first)) - notmuch-tagging-keys '(("a" notmuch-archive-tags "Archive") - ("u" notmuch-show-mark-read-tags "Mark read") - ("f" ("+flagged") "Flag") - ("s" ("+spam" "-inbox") "Mark as spam") - ("d" ("+deleted" "-inbox" "-unread") "Delete"))) +(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)) - (when (require 'notmuch-indicator nil :noerror) - (setq notmuch-indicator-refresh-count 60 - notmuch-indicator-args '((:terms "tag:unread AND tag:inbox" :label "󰮒 ")) - notmuch-indicator-force-refresh-commands '(notmuch-refresh-this-buffer - notmuch-refresh-all-buffers - notmuch-poll-and-refresh-this-buffer)) - (notmuch-indicator-mode +1))) + (setq mu4e-maildir "~/Mail" + mu4e-attachment-dir "~/Downloads" + mu4e-get-mail-command "mbsync -a" + mu4e-update-interval (* 5 60) ; Every 5 minutes + mu4e-sent-messages-behavior 'sent + mu4e-change-filenames-when-moving t + mu4e-context-policy 'pick-first + 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-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-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" . "󱇫 ") + mu4e-headers-fields '((:human-date . 12) + (:flags . 6) + (:from-or-to . 25) + (:subject)) + mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p) + (:maildir "/iCloud/Inbox/" :key ?i) + (:maildir "/Outlook/Inbox/" :key ?o)) + 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) diff --git a/home/emacs/modules/custom-ui-config.el b/home/emacs/modules/custom-ui-config.el index 45903a45..f81a7c04 100644 --- a/home/emacs/modules/custom-ui-config.el +++ b/home/emacs/modules/custom-ui-config.el @@ -38,7 +38,8 @@ ;; Doom-Modeline (when (require 'doom-modeline nil :noerror) - (setq doom-modeline-icon t) + (setq doom-modeline-icon t + doom-modeline-mu4e t) (display-battery-mode) (doom-modeline-mode +1)) diff --git a/system/emacs.nix b/system/emacs.nix index d7c512d3..a230c6ea 100644 --- a/system/emacs.nix +++ b/system/emacs.nix @@ -84,8 +84,8 @@ auctex-latexmk # email-packages - notmuch - notmuch-indicator + mu4e + mu4e-alert # feed-packages elfeed