[PATCH v2 1/6] emacs: add helper for tag change list manipulation
authorJani Nikula <jani@nikula.org>
Thu, 6 Sep 2012 15:32:37 +0000 (18:32 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:25 +0000 (09:49 -0800)
b1/3bc91b732aa025e8d211400b86c43655b55719 [new file with mode: 0644]

diff --git a/b1/3bc91b732aa025e8d211400b86c43655b55719 b/b1/3bc91b732aa025e8d211400b86c43655b55719
new file mode 100644 (file)
index 0000000..3b417e8
--- /dev/null
@@ -0,0 +1,103 @@
+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 765CF431FD7\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:32:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\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 lplGmwXME-gn for <notmuch@notmuchmail.org>;\r
+       Thu,  6 Sep 2012 08:32:50 -0700 (PDT)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id BE3AE431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 08:32:49 -0700 (PDT)\r
+Received: by mail-lpp01m010-f53.google.com with SMTP id c1so1301010lah.26\r
+       for <notmuch@notmuchmail.org>; Thu, 06 Sep 2012 08:32:49 -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:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
+       :in-reply-to:references:x-gm-message-state;\r
+       bh=P+V2XjotYGUTABCSAd57sHvTUV1y04qGir8aa4yLu0o=;\r
+       b=YkMP7nRK7mzJi+IYvYQj/1KQpIlkPS38PIFikiLUESTfETShuCN7S82xC0pxwWlh5Q\r
+       MqUbcJPCVizvUCK+7YqKvRGIiFgJoXgcRWK9Zjh52eRSjO+tC5E65PgsqgX1nSlS+ybz\r
+       ZYsFQfJFZKPs6NQtNA5vF5VQlF0fBJ0McofV4Mh5uJEyHRswiAdG+FbkWfw+/IjT2X5B\r
+       ypIoaX1dJj8pm/nnCPHOWB6fM30ap6i3A/GL8qUjK3etrxGDYkSkev+qfdGyDVmieHku\r
+       nxgujF2tZKrsmrhvjAUz0vhkKnPSk5+CpIG4D0Mn4MudZDCJ5oSMQKlF2aZ9+v6dsEZb\r
+       J3fQ==\r
+Received: by 10.152.46.209 with SMTP id x17mr2306990lam.38.1346945569312;\r
+       Thu, 06 Sep 2012 08:32:49 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw4-fe51df00-27.dhcp.inet.fi.\r
+       [80.223.81.27])\r
+       by mx.google.com with ESMTPS id lr17sm2416863lab.12.2012.09.06.08.32.47\r
+       (version=SSLv3 cipher=OTHER); Thu, 06 Sep 2012 08:32:48 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/6] emacs: add helper for tag change list manipulation\r
+Date: Thu,  6 Sep 2012 18:32:37 +0300\r
+Message-Id:\r
+ <507c09a1872c15b3febeb215542a81fc8dce6938.1346945257.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1346945257.git.jani@nikula.org>\r
+References: <cover.1346945257.git.jani@nikula.org>\r
+In-Reply-To: <cover.1346945257.git.jani@nikula.org>\r
+References: <cover.1346945257.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQnP6RINp1+tUKpom1ZwUf6qAF8AUoy+KS2YCriFz79hg+MeZJwtuLdwCKwULMjrn78qCFnc\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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: Thu, 06 Sep 2012 15:32:50 -0000\r
+\r
+Add a helper to create (and optionally reverse) a list of tag changes.\r
+---\r
+ emacs/notmuch-tag.el |   15 +++++++++++++++\r
+ 1 file changed, 15 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
+index 0c0fc87..4fce3a9 100644\r
+--- a/emacs/notmuch-tag.el\r
++++ b/emacs/notmuch-tag.el\r
+@@ -140,6 +140,21 @@ notmuch-after-tag-hook will be run."\r
+   ;; in all cases we return tag-changes as a list\r
+   tag-changes)\r
\r
++(defun notmuch-tag-change-list (tags &optional reverse)\r
++  "Convert TAGS into a list of tag changes.\r
++\r
++Add a \"+\" prefix to any tag in TAGS list that doesn't already\r
++begin with a \"+\" or a \"-\". If REVERSE is non-nil, replace all\r
++\"+\" prefixes with \"-\" and vice versa in the result."\r
++  (mapcar (lambda (str)\r
++          (let ((s (if (string-match "^[+-]" str) str (concat "+" str))))\r
++            (if reverse\r
++                (concat (if (= (string-to-char s) ?-) "+" "-")\r
++                        (substring s 1))\r
++              s)))\r
++        tags))\r
++\r
++\r
+ ;;\r
\r
+ (provide 'notmuch-tag)\r
+-- \r
+1.7.9.5\r
+\r