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