[PATCH 1/6] emacs: add helper for tag change list manipulation
authorJani Nikula <jani@nikula.org>
Sun, 2 Sep 2012 19:58:00 +0000 (22:58 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:18 +0000 (09:49 -0800)
9a/7823b8fcae43a4501f6bc024d8cfdd9d6c27b8 [new file with mode: 0644]

diff --git a/9a/7823b8fcae43a4501f6bc024d8cfdd9d6c27b8 b/9a/7823b8fcae43a4501f6bc024d8cfdd9d6c27b8
new file mode 100644 (file)
index 0000000..73c1808
--- /dev/null
@@ -0,0 +1,104 @@
+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 4DAF8431FC4\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Sep 2012 12:58:22 -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 LvZuDkdKEYXC for <notmuch@notmuchmail.org>;\r
+       Sun,  2 Sep 2012 12:58:20 -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 E0A2E431FC2\r
+       for <notmuch@notmuchmail.org>; Sun,  2 Sep 2012 12:58:14 -0700 (PDT)\r
+Received: by lahc1 with SMTP id c1so3430631lah.26\r
+       for <notmuch@notmuchmail.org>; Sun, 02 Sep 2012 12:58:13 -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=GFmrz+2vzZpdJHZluDIQkuM7tZ+QToNsrJcsOpgb3os=;\r
+       b=apS5U7iOuf0mck0R5Zs5blVGXMHzJxg6kfTzftYJ9DXVdeHuzW7OX3Y3uP6JGH27TN\r
+       nabjpBgMCGYEzECpN+YrXQVt+M4xnoav7zeiQkOCr+hMef6LWjCWGqIlaXLK9MkmSB+0\r
+       s3UA2HnYunyFORHTEQZkv3eu8cgQTgO3kfuy8LGw3NDQ4UhkuX2T7yFASHC0onEqZcD0\r
+       Zoeo5ddpTg0Y5hxQmMK+2LRwySd6/8Co6ZtogrFLLwWdpnBsClj1d1qoLW/fCJdyOYyx\r
+       8Qd6N22jtpvFeCNH0e83xXOOC3UfhT++aWtMCnu5OWxjAVc5kbb/PG2mxCh6EiPfh3R2\r
+       yAmw==\r
+Received: by 10.112.17.161 with SMTP id p1mr2927015lbd.64.1346615893216;\r
+       Sun, 02 Sep 2012 12:58:13 -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 n7sm2750552lbk.10.2012.09.02.12.58.11\r
+       (version=SSLv3 cipher=OTHER); Sun, 02 Sep 2012 12:58:12 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/6] emacs: add helper for tag change list manipulation\r
+Date: Sun,  2 Sep 2012 22:58:00 +0300\r
+Message-Id:\r
+ <9dbf16fb95f40812ad246f95b954681bc895ceb2.1346614915.git.jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.9.5\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+In-Reply-To: <cover.1346614915.git.jani@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+X-Gm-Message-State:\r
+ ALoCoQlhKpRqZd852T0c+HnfZ/UrLB2bWFw3vxyQ8wgwQ1XGsvl8aJMRntlORTM8Zz5rIasPKBYg\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: Sun, 02 Sep 2012 19:58:23 -0000\r
+\r
+Add a helper to create (and optionally reverse) a list of tag changes.\r
+---\r
+ emacs/notmuch-tag.el |   17 +++++++++++++++++\r
+ 1 file changed, 17 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
+index 0c0fc87..c1aeb99 100644\r
+--- a/emacs/notmuch-tag.el\r
++++ b/emacs/notmuch-tag.el\r
+@@ -140,6 +140,23 @@ 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 (not (string-match "^[+-]" str))\r
++                       (concat "+" str)\r
++                     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