Re: [PATCH v4] emacs: Call "notmuch tag" once when applying tag changes to a thread.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Wed, 8 Feb 2012 16:56:48 +0000 (20:56 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:17 +0000 (09:44 -0800)
40/70529daef309ebd24ae4861e94cc769632d520 [new file with mode: 0644]

diff --git a/40/70529daef309ebd24ae4861e94cc769632d520 b/40/70529daef309ebd24ae4861e94cc769632d520
new file mode 100644 (file)
index 0000000..5f6abec
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <dmitry.kurochkin@gmail.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 olra.theworths.org (Postfix) with ESMTP id E9D8E431FAF\r
+       for <notmuch@notmuchmail.org>; Wed,  8 Feb 2012 08:58:08 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.7\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.7 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, FREEMAIL_REPLY=2.499, RCVD_IN_DNSWL_LOW=-0.7]\r
+       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 MlKvkJ0h8SJm for <notmuch@notmuchmail.org>;\r
+       Wed,  8 Feb 2012 08:58:08 -0800 (PST)\r
+Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
+       [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id E8FA0431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  8 Feb 2012 08:58:07 -0800 (PST)\r
+Received: by bkcjk7 with SMTP id jk7so807835bkc.26\r
+       for <notmuch@notmuchmail.org>; Wed, 08 Feb 2012 08:58:06 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=hJYQuOxjWR6pYUSe6AL5aWfazoo7547u421qFrfnJ1M=;\r
+       b=M5fHnxKu2F19zg1PX68tFXc6tA6Cr3TVgr+ISxX2zC0BXAirD9PEQnB32Cv1wVH2++\r
+       OHQFMAH3Ej9rEaOY5gq1d7I644rR9lmvRUPDrCivPYG7kbBcMSuOW/p4EtBWFNXJ7X68\r
+       kEvgnobFpiGBJ7VYH3P72BloCbtSyeBcCA04c=\r
+Received: by 10.205.127.147 with SMTP id ha19mr3425996bkc.64.1328720286614;\r
+       Wed, 08 Feb 2012 08:58:06 -0800 (PST)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id x20sm6232651bka.9.2012.02.08.08.58.05\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 08 Feb 2012 08:58:05 -0800 (PST)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v4] emacs: Call "notmuch tag" once when applying tag\r
+       changes to a thread.\r
+In-Reply-To: <1328719395-6333-1-git-send-email-dme@dme.org>\r
+References: <1328632303-31877-1-git-send-email-jani@nikula.org>\r
+       <1328719395-6333-1-git-send-email-dme@dme.org>\r
+User-Agent: Notmuch/0.11.1+167~g6e72434 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 08 Feb 2012 20:56:48 +0400\r
+Message-ID: <87sjil8drj.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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: Wed, 08 Feb 2012 16:58:09 -0000\r
+\r
+On Wed,  8 Feb 2012 16:43:15 +0000, David Edmondson <dme@dme.org> wrote:\r
+> Optimize thread tagging by combining all the tagging operations to a\r
+> single "notmuch tag" call.\r
+> \r
+> For threads in the order of tens or a hundred inbox tagged messages,\r
+> this gives a noticeable speedup. On two different machines, archiving\r
+> a thread of about 50 inbox tagged messages goes down from 10+ seconds\r
+> to about 0.5 seconds.\r
+> \r
+> The bottleneck is not within emacs; the same behaviour can be observed\r
+> in the CLI. This approach has the added benefit of being more\r
+> reliable: any of the individual tagging operations might face a locked\r
+> database, leading to partial results.\r
+> \r
+> This introduces a limitation to the number of messages that can be\r
+> archived at the same time (through ARG_MAX limiting the command\r
+> line). While at least on Linux this seems more like a theoretical\r
+> limitation than a real one, it could be avoided by archiving at most a\r
+> few hundred messages at a time.\r
+> \r
+> Based on code from Jani Nikula <jani@nikula.org>.\r
+> ---\r
+> \r
+> v4:\r
+> - Rebased after Dmitry's tagging changes (yay!).\r
+> \r
+\r
+Now, that my tagging changes are pushed, the same effect can be (and\r
+should be) achieved by some code cleanup and function reuse.\r
+\r
+This patch is obsoleted by [1].\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+[1] id:"1328719731-13402-1-git-send-email-dmitry.kurochkin@gmail.com"\r
+\r
+>  emacs/notmuch-show.el |   18 +++++++++++-------\r
+>  1 files changed, 11 insertions(+), 7 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index faa9f9b..9294bc8 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1599,14 +1599,18 @@ argument, hide all of the messages."\r
+>    (backward-button 1))\r
+>  \r
+>  (defun notmuch-show-tag-thread-internal (tag &optional remove)\r
+> -  "Add tag to the current set of messages.\r
+> +  "Add TAG to the current set of messages.\r
+>  \r
+> -If the remove switch is given, tags will be removed instead of\r
+> -added."\r
+> -  (goto-char (point-min))\r
+> -  (let ((op (if remove "-" "+")))\r
+> -    (loop do (notmuch-show-tag-message (concat op tag))\r
+> -      until (not (notmuch-show-goto-message-next)))))\r
+> +If REMOVE is non-nil, TAG will be removed rather than added."\r
+> +  (save-excursion\r
+> +    (goto-char (point-min))\r
+> +    (let ((tag-op (concat (if remove "-" "+") tag))\r
+> +      (message-ids\r
+> +       (loop collect (notmuch-show-get-message-id)\r
+> +             until (not (notmuch-show-goto-message-next)))))\r
+> +      (if message-ids\r
+> +      (notmuch-tag (mapconcat #'identity message-ids " OR ")\r
+> +                   tag-op)))))\r
+>  \r
+>  (defun notmuch-show-add-tag-thread (tag)\r
+>    "Add tag to all messages in the current thread."\r
+> -- \r
+> 1.7.8.3\r
+> \r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r