From 8675c2980ee6fda4c582789465aa11b58243a7b8 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Mon, 12 Aug 2019 00:35:56 +0200
Subject: [PATCH] WIP.

---
 buster/home_files/user/.tridactylrc |  3 ++-
 buster/home_files/user/mail_sync.sh | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/buster/home_files/user/.tridactylrc b/buster/home_files/user/.tridactylrc
index c46948a..631e25a 100644
--- a/buster/home_files/user/.tridactylrc
+++ b/buster/home_files/user/.tridactylrc
@@ -1,2 +1,3 @@
-guiset statuspanel top-left
+guiset statuspanel top-right
 set newtab file:///opt/firefox/blank.html
+autocmd DocStart www.reddit.com urlmodify -t www old
diff --git a/buster/home_files/user/mail_sync.sh b/buster/home_files/user/mail_sync.sh
index 0837390..6962800 100755
--- a/buster/home_files/user/mail_sync.sh
+++ b/buster/home_files/user/mail_sync.sh
@@ -1,9 +1,21 @@
 #!/bin/sh
 set -e
 
+basedir="/home/plom/mail/maildir/"
+# Ensure directories exist for all "dir:*" tags.
+for tag in $(notmuch search --output=tags '*'); do
+    if [ ! $(echo "${tag}" | cut -c-4) = "dir:" ]; then
+        continue
+    fi
+    target_dir="${basedir}"$(echo "${tag}" | cut -c5-)"/cur/"
+    if [ ! -d "${target_dir}" ]; then
+        echo "Directory ${target_dir} does not exist."
+        exit 1
+    fi
+done
+
 # Ensure all "dir:*"-tagged mails are in proper directories,
 # remove all "dir:*" tags.
-basedir="/home/plom/mail/maildir/"
 for tag in $(notmuch search --output=tags '*'); do
     if [ ! $(echo "${tag}" | cut -c-4) = "dir:" ]; then
         continue
-- 
2.30.2