notmuch and "mute" -- useful to anyone?
authorMatt Armstrong <marmstrong@google.com>
Tue, 2 Aug 2016 17:39:41 +0000 (10:39 +1700)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:16 +0000 (16:22 -0700)
a0/a72537ad00d30fe716f250eedd65e524b32af7 [new file with mode: 0644]

diff --git a/a0/a72537ad00d30fe716f250eedd65e524b32af7 b/a0/a72537ad00d30fe716f250eedd65e524b32af7
new file mode 100644 (file)
index 0000000..77a12bb
--- /dev/null
@@ -0,0 +1,135 @@
+Return-Path: <marmstrong@google.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id CAA1C6DE00BD\r
+ for <notmuch@notmuchmail.org>; Tue,  2 Aug 2016 10:39:52 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.829\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.829 tagged_above=-999 required=5 tests=[AWL=0.002,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id gT4XapKFBQNP for <notmuch@notmuchmail.org>;\r
+ Tue,  2 Aug 2016 10:39:45 -0700 (PDT)\r
+Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com\r
+ [209.85.220.50])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id D75296DE00B8\r
+ for <notmuch@notmuchmail.org>; Tue,  2 Aug 2016 10:39:44 -0700 (PDT)\r
+Received: by mail-pa0-f50.google.com with SMTP id b2so12661470pat.0\r
+ for <notmuch@notmuchmail.org>; Tue, 02 Aug 2016 10:39:44 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113; h=from:to:subject:user-agent:date:message-id:mime-version;\r
+ bh=J9kZjS2aXEXjfIE79leirpdXNRd6V0wEh7wWox7bvj4=;\r
+ b=mb7O5HJF3vMZq15K/H8PjVFWYLdt78GIAuSVHuzXKVnxP4bQk2crvaXt3oFWecmIwT\r
+ yU3MEu1bwVpBdIeoaFErF15m5Eu5QU/Z6yu4YGOfU/hT9KgWssqBlln+cuoYdKWPOGVg\r
+ 7fFUO2Lt31GmIVSeQEptt5/D9w37V/j+Pggww3W1ibQl/qyVzgq8v5MVoBRl2JCScjnK\r
+ P+nFz4NYUWmYX7REkzOfxIQn0RzIrJV4DFx8HDEYJ2tSvulASFYI041fDd+MumZ4/Sbl\r
+ /JvK84wu/R/QZpqCl6uAw+TCQKW54UZUsXYowVud7HruGu3v2sF/7xBZiePmTggx1MME kHTA==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:user-agent:date:message-id\r
+ :mime-version;\r
+ bh=J9kZjS2aXEXjfIE79leirpdXNRd6V0wEh7wWox7bvj4=;\r
+ b=gdhW6uUkPAbkwl4PVoXvDe5eFwCnvbiULF1/S0qO5iICD6psvVgLIQFoVYCRJ/rXtR\r
+ qqg50OBUay5ZUulD+igZWpU+cPPrkvsR7rJMzmQCJRgHzDB5Kz5S8yzLuLCyc3JSrMG0\r
+ 0VhZGMDWlCbLBhHpEL4IhuGS7jXczmJBXOXP6mJ7T5JO/SIHwbVNfQY2RnJHZ5ing2/M\r
+ bn+Lekx3LFXC4GkG07S4oO2hbchLVc4tECMfRKymdzgT3sAPAhYMDHcT82FuzxYEsKDD\r
+ IhjqIs4YN77Wu4wBRUDVDlktQ+NhDGxCopvQJ9TMHihlpfEBbpojpFZg+LK4UoAxsHPO\r
+ lBZA==\r
+X-Gm-Message-State:\r
+ AEkooutxwiXOf5G91T+aFph3cxOhXgLOOUdMAt+m/1Fquwn4jmZPL/yVsE3vzUirP8AhckJC\r
+X-Received: by 10.66.222.202 with SMTP id qo10mr107820580pac.76.1470159583894;\r
+  Tue, 02 Aug 2016 10:39:43 -0700 (PDT)\r
+Received: from marmstrong-linux.kir.corp.google.com\r
+ ([2620:0:1008:1101:419b:e62d:4938:a6b6])\r
+ by smtp.gmail.com with ESMTPSA id f6sm6344116pfa.17.2016.08.02.10.39.42\r
+ for <notmuch@notmuchmail.org>\r
+ (version=TLS1_2 cipher=AES128-SHA bits=128/128);\r
+ Tue, 02 Aug 2016 10:39:42 -0700 (PDT)\r
+From: Matt Armstrong <marmstrong@google.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: notmuch and "mute" -- useful to anyone?\r
+User-Agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 02 Aug 2016 10:39:41 -0700\r
+Message-ID: <qf5vazjjciq.fsf@marmstrong-linux.kir.corp.google.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 02 Aug 2016 17:39:52 -0000\r
+\r
+Is anyone else interested in Gmail-like "mute" support in notmuch.el?\r
+If so, I can think about polishing the below off and adding it to\r
+notmuch.\r
+\r
+I've managed to implement Gmail's "mute" in notmuch as follows in my\r
+notmuch-post-new:\r
+\r
+----------------------------------------------------------------------\r
+# Unmute all threads with new messages sent to me.\r
+notmuch search --output=threads tag:new AND tag:me | \\r
+  xargs --no-run-if-empty notmuch tag -muted --\r
+\r
+# Remove all muted threads from the inbox and mark every message in them\r
+# muted.  Ideally this would be atomic with the above.\r
+notmuch search --output=threads tag:muted | \\r
+  xargs --no-run-if-empty notmuch tag -inbox +muted --\r
+----------------------------------------------------------------------\r
+\r
+Then in .emacs:\r
+\r
+----------------------------------------------------------------------\r
+(defcustom my-notmuch-mute-tags '("+muted" "-inbox")\r
+  "List of tag changes to apply to a message or a thread when it is muted.\r
+\r
+Tags starting with \"+\" (or not starting with either \"+\" or\r
+\"-\") in the list will be added, and tags starting with \"-\"\r
+will be removed from the message or thread being archived.\r
+\r
+For example, if you wanted to remove an \"inbox\" tag and add an\r
+\"archived\" tag, you would set:\r
+    (\"-inbox\" \"+archived\")"\r
+  :type '(repeat string)\r
+  :group 'notmuch-search\r
+  :group 'notmuch-show)\r
+\r
+;; TODO: consider defadvice?\r
+(defun my-notmuch-search-mute-thread (&optional unarchive beg end)\r
+  "Mute the currently selected thread or region.\r
+\r
+Mute  each message in the currently selected thread by applying the\r
+tag changes in `my-notmuch-mute-tags' to each (remove the \"inbox\"\r
+tag by default). If a prefix argument is given, the messages will\r
+be \"unarchived\" (i.e. the tag changes in `my-notmuch-mute-tags'\r
+will be reversed).\r
+\r
+This function advances the next thread when finished."\r
+  (interactive (cons current-prefix-arg (notmuch-search-interactive-region)))\r
+  (let ((notmuch-archive-tags my-notmuch-mute-tags))\r
+    (notmuch-search-archive-thread unarchive beg end)))\r
+\r
+(defun my-notmuch-show-mute-thread-then-next ()\r
+  (interactive)\r
+  "Mute all messages in the current buffer, then show next thread from search."\r
+  (let ((notmuch-archive-tags my-notmuch-mute-tags))\r
+    (notmuch-show-archive-thread-then-next)))\r
+\r
+(define-key notmuch-search-mode-map "m" 'my-notmuch-search-mute-thread)\r
+(define-key notmuch-show-mode-map "m" 'my-notmuch-show-mute-thread-then-next)\r
+----------------------------------------------------------------------\r