Mutt: Support message caching with purging
parent
5ecc4e52f6
commit
eedbc32156
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
## Purge old message in Mutt's message cache.
|
||||
## This is intended to be run at startup, but can be run manually anytime.
|
||||
## It should not output anything to stdout.
|
||||
|
||||
## In KB.
|
||||
CACHE_LIMIT=51200
|
||||
|
||||
cd ~/.cache/mutt_msg 2>/dev/null
|
||||
[ $? -ne 0 ] && exit
|
||||
|
||||
[ $(du -s . | cut -f1 -d' ') -lt $CACHE_LIMIT ] && exit
|
||||
while IFS= read -r i; do
|
||||
rm "$i"
|
||||
[ $(du -s . | cut -f1 -d' ') -lt $CACHE_LIMIT ] && exit
|
||||
done <<EOF
|
||||
$(ls -rt $(find . -type f))
|
||||
EOF
|
|
@ -30,6 +30,8 @@ source "~/.mutt/maileditor.sh|"
|
|||
## folder is specified, it is even faster. If no folder exists, the cache will
|
||||
## be a single file.
|
||||
set header_cache = "~/.cache/mutt"
|
||||
set message_cachedir = "~/.cache/mutt_msg"
|
||||
source "~/.mutt/cachepurge.sh|"
|
||||
|
||||
## Tell Mutt to check all IMAP folders. This will add all of them to the
|
||||
## sidebar. Contrary to the manu 'mailboxes' way, order cannot be controlled, so
|
||||
|
|
|
@ -20,7 +20,7 @@ fi
|
|||
if command -v mutt >/dev/null 2>&1; then
|
||||
echo "==> Mutt"
|
||||
[ -d "$SOURCEDIR" ] && ln -snf "$SOURCEDIR/mails" "$HOME/.mutt.d"
|
||||
mkdir -p "$HOME/.cache/mutt/hcache"
|
||||
mkdir -p "$HOME/.cache/mutt/"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in New Issue