From 5304303207a36a4533f8837e22b5bf70b652ff0f Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 22 May 2019 23:48:26 +0200
Subject: [PATCH] Improve mail setup.

---
 buster/apt-mark/eeepc                         | 1 +
 buster/home_files/user_eeepc/.emacs.d/init.el | 9 ++++++++-
 buster/home_files/user_eeepc/.notmuch-config  | 5 +++++
 buster/setup_scripts/setup_home_eeepc.sh      | 2 +-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/buster/apt-mark/eeepc b/buster/apt-mark/eeepc
index fec65b7..3b92f84 100644
--- a/buster/apt-mark/eeepc
+++ b/buster/apt-mark/eeepc
@@ -60,4 +60,5 @@ elpa-elfeed
 isync
 notmuch
 elpa-notmuch
+pinentry-gtk2
 #
diff --git a/buster/home_files/user_eeepc/.emacs.d/init.el b/buster/home_files/user_eeepc/.emacs.d/init.el
index 389126c..8717957 100644
--- a/buster/home_files/user_eeepc/.emacs.d/init.el
+++ b/buster/home_files/user_eeepc/.emacs.d/init.el
@@ -122,11 +122,18 @@
 (setq smtpmail-smtp-service 465)
 (setq smtpmail-stream-type 'ssl)
 (setq smtpmail-smtp-user "plom")
-(setq mail-host-address "plomlompom.com")
+(setq mml-secure-openpgp-encrypt-to-self t)
+
+;; constructs From: domain if mail composer directly called (from without
+;; notmuch), but we don't actually intend to do that
+;(setq mail-host-address "plomlompom.com")
 
 ;; otherwise notmuch becomes extremely slow in some cases
 (setq-default notmuch-show-indent-content nil)
 
+;; this only works if we use notmuch-mua-send instead of message-send
+(setq notmuch-fcc-dirs '(("plom@plomlompom.com" . "maildir/Sent")))
+
 
 ;; org mode
 ;; ========
diff --git a/buster/home_files/user_eeepc/.notmuch-config b/buster/home_files/user_eeepc/.notmuch-config
index 230bbe3..1fddbcd 100644
--- a/buster/home_files/user_eeepc/.notmuch-config
+++ b/buster/home_files/user_eeepc/.notmuch-config
@@ -2,3 +2,8 @@
 path=/home/plom/mail
 [search]
 exclude_tags=deleted;spam;
+# the fields below set the From: if the mail composer is called from
+# within notmuch
+[user]
+name=Christian Heller
+primary_email=plom@plomlompo.com
diff --git a/buster/setup_scripts/setup_home_eeepc.sh b/buster/setup_scripts/setup_home_eeepc.sh
index 1b54a56..6e58ef4 100755
--- a/buster/setup_scripts/setup_home_eeepc.sh
+++ b/buster/setup_scripts/setup_home_eeepc.sh
@@ -40,7 +40,7 @@ cp id_rsa ~/.ssh
 stty -echo
 ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
 stty echo
-gpg --import secret_keys.asc
+script -c 'gpg --import secret_keys.asc' /dev/null
 tar xf borg_keyfiles.tar
 mkdir -p "${borgkeys_dir}"
 mv borg_keyfiles/* "${borgkeys_dir}"
-- 
2.30.2