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