💾 Archived View for idiomdrottning.org › deferring-email-notmuch captured on 2023-11-04 at 12:25:58. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2021-12-03)
-=-=-=-=-=-=-
I use an email called Notmuch and Emacs.
I can hit a button to make an email go away temporarily and it asks for a date and it’ll return on that day.
Here is the elisp code that I’ve stuck in my .emacs.
(defun notmuch-search-defer () (interactive) (notmuch-search-tag `(,(string-trim-right (shell-command-to-string (concat "date '++deferred_%Y-%m-%d' --date \"" (read-from-minibuffer "If not now, when? ") "\""))))) (notmuch-search-tag '("+deferred")) (notmuch-search-archive-thread)) (defun notmuch-show-defer () (interactive) (notmuch-show-tag `(,(string-trim-right (shell-command-to-string (concat "date '++deferred_%Y-%m-%d' --date \"" (read-from-minibuffer "If not now, when? ") "\""))))) (notmuch-show-tag '("+deferred")) (notmuch-show-archive-message-then-next-or-next-thread))
I’ve bound them to the key ‘e’ like so:
(define-key notmuch-search-mode-map "e" 'notmuch-search-defer) (define-key notmuch-show-mode-map "e" 'notmuch-show-defer)
They’re not really gone, they’re in the archive. Searching for tag:deferred shows you all of these. You’ll need that if you accidentally put in today’s date (which happens if you hit enter) or a date in the past.
The script that brings them back is a shellscript that my crontab runs daily:
0 1 * * * /home/sandra/skami/sh/daily.sh
It does other stuff too, but here’s the relevant part:
#!/bin/sh lastrun=2019-12-17 today=$(date +%Y-%m-%d) chores () { notmuch tag +inbox +unread +personal -new -deferred_$lastrun -deferred -- tag:deferred_$lastrun } while [ $today != $lastrun ] do lastrun=$(date +%Y-%m-%d --date "$lastrun +1 day") chores done sed -i 's/^lastrun=.*/lastrun='$(date +%Y-%m-%d)/ $0
This shell needs exec privs and also write access to itself because it edits itself (the last line edits the second line which sets lastrun). This is so that if the script misses a day (because of computer off or similar) it’ll get caught up the next time daily.sh is run. I’ve put it in my window manager’s start up file so it starts when I first log into the computer too, even if my computer was off during the crontab hour.
This isn’t for procrastination and endlessly bouncing email off to the future. That’d be heartbreaking. It’s for when I actually can’t do the thing they’re asking because it’s not the right day. For example movie tickets but the movie isn’t until Wednesday.
The only way to get rid of an email is to archive it or delete it. If I can deal with email right away, I do so. This email deferring is meant to support that mindset, not compromise it.
So:
I have a lot of date specific searches saved, so I can keep my main inbox at zero but then at a glance search up email from the past week or so or specific people last week etc. One search I use all the time is “email that I have sent today” – that’ll find all the threads that I’m actually engaged in, to see if I need to add something to them or refer to information in them.