Re: [PATCH 4/6] emacs: add support for custom tag changes on message/thread archive
authorJani Nikula <jani@nikula.org>
Mon, 3 Sep 2012 12:08:17 +0000 (14:08 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:20 +0000 (09:49 -0800)
b6/e00d03578cd8b4ca3fee326279706800d0bd12 [new file with mode: 0644]

diff --git a/b6/e00d03578cd8b4ca3fee326279706800d0bd12 b/b6/e00d03578cd8b4ca3fee326279706800d0bd12
new file mode 100644 (file)
index 0000000..77ec91b
--- /dev/null
@@ -0,0 +1,185 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5ACAD431FB6\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Sep 2012 05:08:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id i-Qv6Zy1jVjY for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Sep 2012 05:08:26 -0700 (PDT)\r
+Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com\r
+       [209.85.220.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D23AC431FAF\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Sep 2012 05:08:26 -0700 (PDT)\r
+Received: by vcbfl17 with SMTP id fl17so5688446vcb.26\r
+       for <notmuch@notmuchmail.org>; Mon, 03 Sep 2012 05:08:25 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type:content-transfer-encoding\r
+       :x-gm-message-state;\r
+       bh=dKFWG0l1aOTM0PVcxOOyDjsreyk1hwEw0+v0V0kys6g=;\r
+       b=OUabjQyzxTnXC8eREzIsAORVbDzHhLXeu9esYYvLbKi81VmIt6L5QbdzhPEtAXy6qA\r
+       JLGc4C8vcmdVPj1O3GD4oJOmcGxbmSU+v2OU3hnHqkuW4SUiDx4BYF/19cJfqavp5yGE\r
+       M7uPLfXZO15fepplyjMDOz9bUOkEuIQ1CkgEmY16R3FuHilWfYCLc+aSyWz9R8GwKv3G\r
+       bJ6/+p41piEqk9GfqlbSlZ2l6PTgjSfBfR5bTkXxw9+ry2m7qrbiAEj8FC1nhIAcEwgI\r
+       PveBidoZEFv0lJnKkc3/caY11RAAXX/8pycDrN0BrldFqseQTOpAmZJxMEFX+xoekpLM\r
+       oFzQ==\r
+Received: by 10.52.73.167 with SMTP id m7mr5854093vdv.81.1346674105105;\r
+       Mon, 03 Sep 2012 05:08:25 -0700 (PDT)\r
+Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
+       by mx.google.com with ESMTPS id b3sm4562345vec.11.2012.09.03.05.08.24\r
+       (version=SSLv3 cipher=OTHER); Mon, 03 Sep 2012 05:08:24 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Michal Nazarewicz <mina86@mina86.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 4/6] emacs: add support for custom tag changes on\r
+       message/thread archive\r
+In-Reply-To: <xa1tfw6zwd0z.fsf@mina86.com>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+       <0907a84d74600df18b8663c28c26f9f7bc2f31c2.1346614915.git.jani@nikula.org>\r
+       <xa1tfw6zwd0z.fsf@mina86.com>\r
+User-Agent: Notmuch/0.14+42~g397e223 (http://notmuchmail.org) Emacs/23.2.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Mon, 03 Sep 2012 14:08:17 +0200\r
+Message-ID: <87r4qj8g26.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Gm-Message-State:\r
+ ALoCoQmuwidB2k0rsrSIObw/wg1XXP793vpxQKNBprHIXyvLkxUs+I0QkswYOKBteiRNNuzYzIMd\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 03 Sep 2012 12:08:28 -0000\r
+\r
+On Mon, 03 Sep 2012, Michal Nazarewicz <mina86@mina86.com> wrote:\r
+> Jani Nikula <jani@nikula.org> writes:\r
+>> Add support for customization of the tag changes that are applied when\r
+>> a message or a thread is archived. Instead of hard-coded removal of\r
+>> the "inbox" tag, the user can now specify a list of tag changes to\r
+>> perform.\r
+>\r
+>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+>> index ce5ea6f..e701aec 100644\r
+>> --- a/emacs/notmuch-show.el\r
+>> +++ b/emacs/notmuch-show.el\r
+>> @@ -1748,18 +1748,20 @@ argument, hide all of the messages."\r
+>>  (defun notmuch-show-archive-thread (&optional unarchive)\r
+>>    "Archive each message in thread.\r
+>>=20=20\r
+>> -Archive each message currently shown by removing the \"inbox\"\r
+>> -tag from each.  If a prefix argument is given, the messages will\r
+>> -be \"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
+>> -removed).\r
+>> +Archive each message currently shown by applying the tag changes\r
+>> +in `notmuch-archive-tags' to each (remove the \"inbox\" tag by\r
+>> +default). If a prefix argument is given, the messages will be\r
+>> +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
+>> +will be reversed.\r
+>>=20=20\r
+>>  Note: This command is safe from any race condition of new messages\r
+>>  being delivered to the same thread. It does not archive the\r
+>>  entire thread, but only the messages shown in the current\r
+>>  buffer."\r
+>>    (interactive "P")\r
+>> -  (let ((op (if unarchive "+" "-")))\r
+>> -    (notmuch-show-tag-all (concat op "inbox"))))\r
+>> +  (when notmuch-archive-tags\r
+>\r
+> Strictly speaking (when) should not be needed here (an in the following\r
+> changes).  Or is it?\r
+\r
+I noticed it was needed in some places, so decided to slam it in all\r
+places for similarity. No harm in that, IMO.\r
+\r
+Thanks for the review.\r
+\r
+Jani.\r
+\r
+\r
+>\r
+>> +    (notmuch-show-tag-all\r
+>> +     (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
+>>=20=20\r
+>>  (defun notmuch-show-archive-thread-then-next ()\r
+>>    "Archive all messages in the current buffer, then show next thread fr=\r
+om search."\r
+>> @@ -1774,14 +1776,17 @@ buffer."\r
+>>    (notmuch-show-next-thread))\r
+>>=20=20\r
+>>  (defun notmuch-show-archive-message (&optional unarchive)\r
+>> -  "Archive the current message (remove \"inbox\" tag).\r
+>> +  "Archive the current message.\r
+>>=20=20\r
+>> -If a prefix argument is given, the message will be\r
+>> -\"unarchived\" (ie. the \"inbox\" tag will be added instead of\r
+>> -removed)."\r
+>> +Archive the current message by applying the tag changes in\r
+>> +`notmuch-archive-tags' to it (remove the \"inbox\" tag by\r
+>> +default). If a prefix argument is given, the message will be\r
+>> +\"unarchived\", i.e. the tag changes in `notmuch-archive-tags'\r
+>> +will be reversed."\r
+>>    (interactive "P")\r
+>> -  (let ((op (if unarchive "+" "-")))\r
+>> -    (notmuch-show-tag-message (concat op "inbox"))))\r
+>> +  (when notmuch-archive-tags\r
+>> +    (apply 'notmuch-show-tag-message\r
+>> +      (notmuch-tag-change-list notmuch-archive-tags unarchive))))\r
+>>=20=20\r
+>>  (defun notmuch-show-archive-message-then-next-or-exit ()\r
+>>    "Archive the current message, then show the next open message in the =\r
+current thread.\r
+>> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+>> index 1c43d3e..64caa3e 100644\r
+>> --- a/emacs/notmuch.el\r
+>> +++ b/emacs/notmuch.el\r
+>> @@ -594,11 +594,19 @@ See `notmuch-tag' for information on the format of=\r
+ TAG-CHANGES."\r
+>>    (notmuch-search-tag "-"))\r
+>>=20=20\r
+>>  (defun notmuch-search-archive-thread ()\r
+>> -  "Archive the currently selected thread (remove its \"inbox\" tag).\r
+>> +  "Archive the currently selected thread.\r
+>> +\r
+>> +Archive each message in the currently selected thread by applying\r
+>> +the tag changes in `notmuch-archive-tags' to each (remove the\r
+>> +\"inbox\" tag by default). If a prefix argument is given, the\r
+>> +messages will be \"unarchived\" (i.e. the tag changes in\r
+>> +`notmuch-archive-tags' will be reversed).\r
+>>=20=20\r
+>>  This function advances the next thread when finished."\r
+>>    (interactive)\r
+>> -  (notmuch-search-tag '("-inbox"))\r
+>> +  (when notmuch-archive-tags\r
+>> +    (notmuch-search-tag\r
+>> +     (notmuch-tag-change-list notmuch-archive-tags)))\r
+>>    (notmuch-search-next-thread))\r
+>>=20=20\r
+>>  (defun notmuch-search-update-result (result &optional pos)\r
+>> --=20\r
+>> 1.7.9.5\r
+>>\r
+>\r
+> --=20\r
+> Best regards,                                         _     _\r
+> .o. | Liege of Serenely Enlightened Majesty of      o' \,=3D./ `o\r
+> ..o | Computer Science,  Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz =\r
+   (o o)\r
+> ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--\r