From 5aa495a7bf844bffa12b2c5297804520462d538e Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Mon, 18 Apr 2022 14:44:47 -0400 Subject: [PATCH] Cleanup email configuration --- README.org | 28 ++++++++++++++++++++++------ modules/emacs.nix | 7 +++++++ 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/README.org b/README.org index 82638b6..31258f9 100644 --- a/README.org +++ b/README.org @@ -2203,13 +2203,33 @@ Manage Docker from inside of Emacs using [[https://github.com/Silex/docker.el][D #+BEGIN_SRC nix pkgs.mu pkgs.isync +(pkgs.writeShellScriptBin "mail-init" '' + ${pkgs.mu} init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz" + ${pkgs.mu} index +'') +(pkgs.writeShellScriptBin "mail-sync" '' + ${pkgs.isync}/bin/mbsync -a +'') #+END_SRC +[[https://github.com/djcb/mu][MU]] is a tool for dealing with email messages stored in the Maildir-format. Its purpose is to help quickly find the messages needed, and allows users to view messages, extract attachments, create new maildirs, and much more. It's written in C and C++, and includes extensions for Emacs (MU4E) and guile scheme. + #+NAME: emacs-mu4e-package #+BEGIN_SRC nix epkgs.mu4e-alert #+END_SRC +[[https://emacswiki.org/emacs/mu4e][MU4E]] is an email client for Emacs. It's based on the mu email indexer / searcher. + ++ Fully search based: no folders, only queries ++ Fully documented, with example configurations ++ User-interface optimized for speed, with quick keystrokes for common actions ++ Asynchronous; heavy actions do not block Emacs ++ Support for non-English languages ++ Support for signing and encryption ++ Address auto-completion based on existing messages ++ Extensibile with existing code and snippets + #+NAME: emacs-mu4e-config #+BEGIN_SRC nix # Deploy the authinfo file. @@ -2240,11 +2260,7 @@ home.file.".mbsyncrc" = { }; #+END_SRC -#+BEGIN_SRC sh -mbsync -a -mu init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz" -mu index -#+END_SRC +Before using the software inside of Emacs, the maildir must be created in the local filesystem, and indexed. This is done with a single custom shell script binary ~mail-init~ which wraps the underlying mu commands. The emacs extension is shipped with the mu mail indexer. To utilize it, it must be added to the load path inside of Emacs. #+NAME: emacs-mu4e-elisp #+BEGIN_SRC emacs-lisp @@ -2255,7 +2271,7 @@ mu index ;; Confiugure `mu4e'. (setq mu4e-maildir "~/.cache/mail" mu4e-update-interval (* 5 60) - mu4e-get-mail-command "mbsync -a" + mu4e-get-mail-command "mail-sync" mu4e-compose-format-flowed t mu4e-change-filenames-when-moving t mu4e-compose-signature (concat "Chris Hayward\n" diff --git a/modules/emacs.nix b/modules/emacs.nix index 315bd67..0f9dc00 100644 --- a/modules/emacs.nix +++ b/modules/emacs.nix @@ -77,6 +77,13 @@ in { pkgs.pass pkgs.mu pkgs.isync + (pkgs.writeShellScriptBin "mail-init" '' + ${pkgs.mu} init --maildir="~/.cache/mail" --my-address="chris@chrishayward.xyz" + ${pkgs.mu} index + '') + (pkgs.writeShellScriptBin "mail-sync" '' + ${pkgs.isync}/bin/mbsync -a + '') pkgs.aspell pkgs.aspellDicts.en pkgs.aspellDicts.en-science