[neomutt] Fix mailboxes loading for NeoMutt 20191111

This commit is contained in:
lhark 2019-11-20 21:08:34 +00:00
parent be4bd80c08
commit f920216d16
3 changed files with 35 additions and 3 deletions

View file

@ -1,7 +1,17 @@
#!/bin/sh
usage() {
echo "$0 <mutt \$folder>"
echo " Generate mutt folder hooks for every maildir account in \$folder"
exit 1
}
if [ -z "$1" ]; then
usage
fi
acc_dir="$HOME/.config/neomutt/accounts/"
mail_dir="$HOME/mail/"
mail_dir="$1"
# Select default account
default="$(find "$acc_dir" -name "*.mail" -printf "source '%p'\n" -quit)"

22
config/neomutt/mailboxes.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/sh
usage() {
echo "$0 <neomutt \$folder>"
echo " Generate neomutt mailboxes & named-mailboxes for every maildir in \$folder"
exit 1
}
if [ -z "$1" ]; then
usage
fi
maildir="$1"
mailboxes=$(find "$maildir" -mindepth 1 -maxdepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch)
for m in $mailboxes; do
inbox="$(find "$m" -maxdepth 1 -iname "inbox" -type d -printf "%f" -quit)"
echo "named-mailboxes '$(basename "$m")' '$m/$inbox'"
printf "mailboxes "
find "$m" -mindepth 1 -type d ! -name cur ! -name tmp ! -name new -printf '"%p"\0' | xargs -0
done

View file

@ -3,7 +3,7 @@ set mbox_type = Maildir
set copy # See also $record (f*ckin recursion)
set folder = "~/mail"
unmailboxes *
mailboxes `find ~/mail -mindepth 1 -type d ! -name cur ! -name tmp ! -name new ! -name .notmuch -printf '"%p"\0' | xargs -0`
source "~/.config/neomutt/mailboxes.sh $folder|"
# Load external configs
source sidebar.rc
@ -12,7 +12,7 @@ source gpg.rc
source keys.rc
# Accounts
source '~/.config/neomutt/folder-hooks.sh|'
source "~/.config/neomutt/folder-hooks.sh $folder|"
# Basic options
unset wait_key # Only wait if command exited != 0