From 95ffd3ca0b7ddf0edd2e69a17084c15ed40ed21a Mon Sep 17 00:00:00 2001 From: Richard Lawrence Date: Thu, 11 Dec 2014 09:00:17 +1600 Subject: [PATCH] Re: email snoozing in notmuch --- 7d/1f208be6ec3f23a3e5f65fdfd1b0f1ce104582 | 117 ++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 7d/1f208be6ec3f23a3e5f65fdfd1b0f1ce104582 diff --git a/7d/1f208be6ec3f23a3e5f65fdfd1b0f1ce104582 b/7d/1f208be6ec3f23a3e5f65fdfd1b0f1ce104582 new file mode 100644 index 000000000..2f21f0933 --- /dev/null +++ b/7d/1f208be6ec3f23a3e5f65fdfd1b0f1ce104582 @@ -0,0 +1,117 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 0E28E431FDB + for ; Wed, 10 Dec 2014 09:05:15 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id PB6xoC6Ngtkk for ; + Wed, 10 Dec 2014 09:05:11 -0800 (PST) +Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 46B95431FBF + for ; Wed, 10 Dec 2014 09:05:11 -0800 (PST) +Received: from list by plane.gmane.org with local (Exim 4.69) + (envelope-from ) id 1XykhC-0007GT-W3 + for notmuch@notmuchmail.org; Wed, 10 Dec 2014 18:05:03 +0100 +Received: from c-67-169-117-151.hsd1.ca.comcast.net ([67.169.117.151]) + by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Wed, 10 Dec 2014 18:05:02 +0100 +Received: from richard.lawrence by c-67-169-117-151.hsd1.ca.comcast.net with + local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 + for ; Wed, 10 Dec 2014 18:05:02 +0100 +X-Injected-Via-Gmane: http://gmane.org/ +To: notmuch@notmuchmail.org +From: Richard Lawrence +Subject: Re: email snoozing in notmuch +Date: Wed, 10 Dec 2014 09:00:17 -0800 +Lines: 56 +Message-ID: <87bnnbmoda.fsf@berkeley.edu> +References: <87wq60e2q5.fsf@uwaterloo.ca> + <548800d5ecc8b_551ca3e88c@TP_L520.notmuch> +Mime-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Complaints-To: usenet@ger.gmane.org +X-Gmane-NNTP-Posting-Host: c-67-169-117-151.hsd1.ca.comcast.net +User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) +Cancel-Lock: sha1:I4hxtJlHs/z6q/FZgOii5c3eVFU= +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 10 Dec 2014 17:05:15 -0000 + +Franz Fellner +writes: + +> Sebastian Fischmeister wrote: + +>> I'm thinking of how to realize the mail snoozing feature with notmuch, +>> so that certain emails won't become visible (in the search) until a +>> certain day/time (e.g., 10 days from now). +>> +>> Using the tag as an absolute date when the mail should become visible +>> again, tags should be searchable and interpretable as dates. The search +>> would then be something like: notmuch search tag-as-date < now and +>> tag:inbox +> +> It is not neccessary to make notmuch interpret tags as date - just interpret them yourself ;) +> You can easily run your own scripts and modify tags/mails. So a simple solution might be: +> * Add "snoozed" to your notmuch exclude_tags (see config file) +> * To snooze a mail run in your mail client "tag +snoozed +snoozeby-10-days" +> or "tag +snoozed +snoozeuntil-2015-01-09" +> * Your script (e.g. run as cronjob or after notmuch new) now +> - queries for "tag:snoozed" +> - looks for snoozeuntil-* tag and parses the tag into a date. If date < now remove snooze-tags. +> - looks for (relative) snoozeby tag and transform it into (absolute) snoozeuntil tag. +> (should be not too hard using e.g. the python or ruby bindings) + +I actually do something like this. It's not everything Sebastian was +looking for, but it's very simple, and works great for me. + +I use a combination of a "pending" tag and a "byYYYYMMDD" tag. + +>From cron, I run the following to refile pending mail back to the inbox +when it comes due: + +#!/bin/bash +DATE_STR=$(date +'%Y%m%d') +notmuch tag +inbox -pending -by$DATE_STR -- tag:by$DATE_STR + +and in Emacs, I use the following key binding to snooze mail (or in the Mutt +terminology I borrowed, `postpone' it, hence the key): + +(define-key notmuch-search-mode-map "P" + (lambda () + "postpone message (remove inbox tag, add pending tag and refile date)" + (interactive) + (let* ((date-string (format-time-string "%Y%m%d" (org-read-date nil t))) + (date-tag (concat "+by" date-string))) + (notmuch-search-tag `("-inbox" "+pending" ,date-tag))))) + +(The `org-read-date' function gives me a nice easy way to pick a date +from a calendar. I bind "P" to the same function in +notmuch-show-mode-map, too.) + +Hope that helps! + +Best, +Richard + -- 2.26.2