From 78ce1a96dc54356f5be8c0801090488635a192ed Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Fri, 4 Mar 2022 15:54:15 +0100 Subject: email: well, restrictions are stupid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'ajuntament' maildir has to be handled separately and manually because resources there are scarce, and after 2GiB of space consumed, it does not allow to proceed further. Therefore, I am nuking everything on the server while preserving things locally with a 'Pull New Flags' mode on mbsync. This has the side-effect that now emails that have been already handled on the website and moved into archive are no longer perceived to be moved, and the 'inbox' folder might keep on growing. That is why I have set up a hook before mu4e's update so these emails are removed every time. Again, restrictions are stupid and I should not have to do this. Signed-off-by: Miquel Sabaté Solà --- .doom.d/config.el | 19 +++++++++++++++++++ .mbsyncrc | 12 ++++++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.doom.d/config.el b/.doom.d/config.el index 3b068d2..1150ec4 100644 --- a/.doom.d/config.el +++ b/.doom.d/config.el @@ -330,5 +330,24 @@ littering will happen locally." (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime) +(defun mssola/clean-email-env () + "Clean the maildir environment." + + (interactive) + + ;; The 'ajuntament' maildir is a bit special, since I have to handle it + ;; manually for embarrasing reasons. + (mapc (lambda (f) + (unless (file-directory-p f) + (delete-file f))) + (directory-files (concat (file-name-as-directory (getenv "HOME")) + ".mail/ajuntament/inbox/new") + t))) + +;; This is the only hook that `mu4e' allows us to actually do something around +;; fetching emails. Let's clean the environment before anything, which should be +;; fine for stupid maildirs such as 'ajuntament'. +(add-hook 'mu4e-update-pre-hook 'mssola/clean-email-env) + ;; And a binding! (map! "C-c m" #'mu4e) diff --git a/.mbsyncrc b/.mbsyncrc index d903691..006aa9d 100644 --- a/.mbsyncrc +++ b/.mbsyncrc @@ -119,7 +119,11 @@ Expunge Both SyncState * ## -# ajuntament +# ajuntament: notice that in this case the mailbox is configured to 'Pull' only +# and that deletions are not propagated. This is done to workaround the +# shamefully-low capacity given on this service, in a way that I have to +# periodically *remove everything* on the server. This is hence manually backed +# up. IMAPAccount ajuntament Host mail.diba.cat @@ -142,9 +146,9 @@ Channel ajuntament Master :ajuntament-remote: Slave :ajuntament-local: Patterns * !Calendar -Create Both -Sync All -Expunge Both +Create None +Sync Pull New Flags +Expunge None SyncState * ## -- cgit v1.2.3