From cc139355c31e045204a7d4b49479286f6e91271e Mon Sep 17 00:00:00 2001 From: nathan mccarty Date: Wed, 6 Jul 2022 01:15:21 -0400 Subject: [PATCH] Fix mu4e --- doom.d/config.el | 5 ++++- doom.d/config.org | 7 ++++++- home-manager/programs/emacs.nix | 9 +++++++++ home-manager/services/email.nix | 3 ++- scripts/update-mu4e.sh | 4 ++++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doom.d/config.el b/doom.d/config.el index 729cef4..3ceeca8 100644 --- a/doom.d/config.el +++ b/doom.d/config.el @@ -377,4 +377,7 @@ work if it thinks it needs to." (setq +mu4e-backend nil) (after! mu4e (setq mu4e-get-mail-command "true" - mu4e-update-interval 300)) + mu4e-update-interval nil)) + +(after! mu4e + (setq mu4e-change-filenames-when-moving t)) diff --git a/doom.d/config.org b/doom.d/config.org index fa249d0..36bffd1 100644 --- a/doom.d/config.org +++ b/doom.d/config.org @@ -594,5 +594,10 @@ Tell it not to update the mail itself, we have a systemd unit for that (setq +mu4e-backend nil) (after! mu4e (setq mu4e-get-mail-command "true" - mu4e-update-interval 300)) + mu4e-update-interval nil)) +#+end_src +We need to tell mu4e to rename files when they are moved, or else mbsync will break, see [[https://github.com/djcb/mu/issues/613#issuecomment-166714305][issue]] and [[http://tiborsimko.org/mbsync-duplicate-uid.html][blog post]] +#+begin_src emacs-lisp +(after! mu4e + (setq mu4e-change-filenames-when-moving t)) #+end_src diff --git a/home-manager/programs/emacs.nix b/home-manager/programs/emacs.nix index 33b7093..dc93344 100644 --- a/home-manager/programs/emacs.nix +++ b/home-manager/programs/emacs.nix @@ -17,6 +17,15 @@ libnotify # For flash cards anki + # Desktop file for org-protocol + (makeDesktopItem { + name = "org-protocol"; + exec = "emacsclient %u"; + comment = "Org protocol"; + desktopName = "org-protocol"; + type = "Application"; + mimeTypes = [ "x-scheme-handler/org-protocol" ]; + }) ]; # Setup doom emacs programs.doom-emacs = { diff --git a/home-manager/services/email.nix b/home-manager/services/email.nix index 8387ca4..05a0fd0 100644 --- a/home-manager/services/email.nix +++ b/home-manager/services/email.nix @@ -60,6 +60,7 @@ with lib; { mbsync = { enable = true; create = "maildir"; + remove = "both"; }; mu.enable = true; msmtp = { @@ -81,7 +82,7 @@ with lib; { postExec = if config.nathan.programs.emacs.service then - ''${config.nathan.programs.emacs.package}/bin/emacsclient --eval "(mu4e-update-mail-and-index t)"'' + "${../../scripts/update-mu4e.sh}" else "${pkgs.mu}/bin/mu index"; }; diff --git a/scripts/update-mu4e.sh b/scripts/update-mu4e.sh index f1f641a..772a7b1 100755 --- a/scripts/update-mu4e.sh +++ b/scripts/update-mu4e.sh @@ -1 +1,5 @@ #!/usr/bin/env bash +# Turn on the guard rails +set -exou pipefail +# Tell emacs to update mu4e +emacsclient --eval "(mu4e-update-index)"