Re: [PATCH 1/6] emacs: add helper for tag change list manipulation
authorMichal Nazarewicz <mina86@mina86.com>
Mon, 3 Sep 2012 11:33:55 +0000 (13:33 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:19 +0000 (09:49 -0800)
1b/b09d03a913b3767e8d82bbf1b707402e94304d [new file with mode: 0644]

diff --git a/1b/b09d03a913b3767e8d82bbf1b707402e94304d b/1b/b09d03a913b3767e8d82bbf1b707402e94304d
new file mode 100644 (file)
index 0000000..1cad9a2
--- /dev/null
@@ -0,0 +1,168 @@
+Return-Path: <mpn@google.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 5E115431FB6\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Sep 2012 04:34:06 -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=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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 UnUVb9HlEy1h for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Sep 2012 04:34:05 -0700 (PDT)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ EBFDB431FAF   for <notmuch@notmuchmail.org>; Mon,  3 Sep 2012 04:34:04 -0700\r
+ (PDT)\r
+Received: by eekb47 with SMTP id b47so2227210eek.26\r
+       for <notmuch@notmuchmail.org>; Mon, 03 Sep 2012 04:34:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113;   h=sender:from:to:cc:subject:in-reply-to:organization:references\r
+       :user-agent:x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version\r
+       :content-type; bh=1p3W9PRWaISrAdzQsGE37M9H5DhjVe3cXKWU1sc2wko=;\r
+       b=jooXuhCEslLstlvTDNldWn+diD6eBBZ6iOvFO/43t81I+ppsWYMMcU5gezXu4uPpdz\r
+       IZsnPPEV1GYkYWVejUDrex1CZvC2B152xp3g49SK1wTwdE/CMZ2tzHnt4XYku24U3i5e\r
+       ZJg6QtwYhVXDxIJiUgiMncTa1zrC3CkvJpKQwKtAtveXA51k3pmBXz5sUkjPsn6I7VZz\r
+       4faPA+/PuHo5AJPb5JWLjQChsC+0yLBQW4AA7OTUElaGLT61W8eNtqxRelLYvmc+H06S\r
+       aKBsc/dKTlX8V6BT84kznA1i2ZZZnqJLz7ivU0uLBVwplFcm0diiCfV+FGEFFOvq3x0f    tdJw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=sender:from:to:cc:subject:in-reply-to:organization:references\r
+       :user-agent:x-face:face:x-pgp:x-pgp-fp:date:message-id:mime-version\r
+       :content-type:x-gm-message-state;\r
+       bh=1p3W9PRWaISrAdzQsGE37M9H5DhjVe3cXKWU1sc2wko=;\r
+       b=ZEkR6krpxIkt543iNCzd7v3mXlOcRVzuyYukQQ3D9fnsI+o6v7FOHHtD9JKp9wHqvE\r
+       jeAO9kzlDd8kFRp3LFnUCG7UYcmHTSLdy4rqLAaf0GDaZbN3mL6R5It0Yn/A967BYgX9\r
+       pi4ONEo0czRE1n91NTPQlryT4uyqfCBH65yWYV5KCLOBAjHHjfs6AIxK4PRVDes5UmdU\r
+       xIofUq4FE0CqqveBpMuAdl8LeEDZFd56FVWfNTng2PhyHhgFjTo9eAktgaBpwYYMX2oI\r
+       kBi3zHihRzqw8FjWDSCDA/Jrp4taqgTxjwjAWuSRiTYhMIfjKcmNBJiTmu/ZFO2p8Fki\r
+       6sdQ==\r
+Received: by 10.14.203.73 with SMTP id e49mr21070156eeo.27.1346672042349;\r
+       Mon, 03 Sep 2012 04:34:02 -0700 (PDT)\r
+Received: by 10.14.203.73 with SMTP id e49mr21070147eeo.27.1346672042223;\r
+       Mon, 03 Sep 2012 04:34:02 -0700 (PDT)\r
+Received: from mpn-glaptop ([2620:0:105f:5:f2de:f1ff:fe35:1a72])\r
+       by mx.google.com with ESMTPS id h42sm35722724eem.5.2012.09.03.04.34.00\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Mon, 03 Sep 2012 04:34:00 -0700 (PDT)\r
+Sender: Michal Nazarewicz <mpn@google.com>\r
+From: Michal Nazarewicz <mina86@mina86.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/6] emacs: add helper for tag change list manipulation\r
+In-Reply-To:\r
+ <9dbf16fb95f40812ad246f95b954681bc895ceb2.1346614915.git.jani@nikula.org>\r
+Organization: http://mina86.com/\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+       <9dbf16fb95f40812ad246f95b954681bc895ceb2.1346614915.git.jani@nikula.org>\r
+User-Agent: Notmuch/0.14+2~g416b120 (http://notmuchmail.org) Emacs/24.2.50.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: PbkBB1w#)bOqd`iCe"Ds{e+!C7`pkC9a|f)Qo^BMQvy\q5x3?vDQJeN(DS?|-^$uMti[3D*#^_Ts"pU$jBQLq~Ud6iNwAw_r_o_4]|JO?]}P_}Nc&"p#D(ZgUb4uCNPe7~a[DbPG0T~!&c.y$Ur,=N4RT>]dNpd;       KFrfMCylc}gc??'U2j,!8%xdD\r
+Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAJFBMVEWbfGlUPDDHgE57V0jUupKjgIObY0PLrom9mH4dFRK4gmjPs41MxjOgAAACQElEQVQ4jW3TMWvbQBQHcBk1xE6WyALX1069oZBMlq+ouUwpEQQ6uRjttkWP4CmBgGM0BQLBdPFZYPsyFUo6uEtKDQ7oy/U96XR2Ux8ehH/89Z6enqxBcS7Lg81jmSuujrfCZcLI/TYYvbGj+jbgFpHJ/bqQAUISj8iLyu4LuFHJTosxsucO4jSDNE0Hq3hwK/ceQ5sx97b8LcUDsILfk+ovHkOIsMbBfg43VuQ5Ln9YAGCkUdKJoXR9EclFBhixy3EGVz1K6eEkhxCAkeMMnqoAhAKwhoUJkDrCqvbecaYINlFKSRS1i12VKH1XpUd4qxL876EkMcDvHj3s5RBajHHMlA5iK32e0C7VgG0RlzFPvoYHZLRmAC0BmNcBruhkE0KsMsbEc62ZwUJDxWUdMsMhVqovoT96i/DnX/ASvz/6hbCabELLk/6FF/8PNpPCGqcZTGFcBhhAaZZDbQPaAB3+KrWWy2XgbYDNIinkdWAFcCpraDE/knwe5DBqGmgzESl1p2E4MWAz0VUPgYYzmfWb9yS4vCvgsxJriNTHoIBz5YteBvg+VGISQWUqhMiByPIPpygeDBE6elD973xWwKkEiHZAHKjhuPsFnBuArrzxtakRcISv+XMIPl4aGBUJm8Emk7qBYU8IlgNEIpiJhk/No24jHwkKTFHDWfPniR4iw5vJaw2nzSjfq2zffcE/GDjRC2dn0J0XwPAbDL84TvaFCJEU4Oml9pRyEUhR3Cl2t01AoEjRbs0sYugp14/4X5n4pU4EHHnMAAAAAElFTkSuQmCC\r
+X-PGP: 50751FF4\r
+X-PGP-FP: AC1F 5F5C D418 88F8 CC84 5858 2060 4012 5075 1FF4\r
+Date: Mon, 03 Sep 2012 13:33:55 +0200\r
+Message-ID: <xa1tipbvwdb0.fsf@mina86.com>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="=-=-="\r
+X-Gm-Message-State: ALoCoQm4VOTCnz6FvJp62kQCEn0GSkzElrEUf23/qAWr5rF7li2bu8AZXhBS9xd+LBo6CKzeQjKefG9CEReuFme+noP2rIS/EQk/jAotm3ZntG9S6yvR758Q7xAgdmrxJLN3we6BG4YuTMMBsLH+nTfBAFwYjWIzy6DwlPLGJgz3jCRnh6GnpRIkTHqgRWQjpBiHwFPPNgBx\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 11:34:06 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Jani Nikula <jani@nikula.org> writes:\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
+>=20=20\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
+\r
+(if (string-match "^[-+]" str) str (concat "+" str))\r
+\r
+Negation only makes things less readable IMO.\r
+\r
+> +          (if reverse\r
+> +              (concat (if (=3D (string-to-char s) ?-) "+" "-")\r
+> +                      (substring s 1))\r
+> +            s)))\r
+> +      tags))\r
+> +\r
+> +\r
+>  ;;\r
+>=20=20\r
+>  (provide 'notmuch-tag)\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
+--=-=-=\r
+Content-Type: multipart/signed; boundary="==-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+\r
+--==-=-=\r
+Content-Type: text/plain\r
+\r
+\r
+--==-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iQIcBAEBAgAGBQJQRJWjAAoJECBgQBJQdR/0HCgP/2QaZyjEqq9PP/8YoUqx7zUY\r
+9U9AoP+f7hxjT4387Fpm4HOFSw6cKK4jxGKZQ97v7vFKf0tLaIp18bosHHGSoX29\r
+nuDP2tvwo4Psuih17yV9STzHkaSCgaFPa27s/baTYIvFP2iD7CX0d7W2H+LIaYFl\r
+fIFVuLHLMWH5PqGXaE5vu3I1wXK07L8YwjTL4XBvWg3h904S8m/unpINP/XuBOq1\r
+jpIQv5op+EbenXvdFU8t5x8xvdwhIc+plJg02RqB12gXHJMQq0Wp36WX0BaKH34V\r
+huCEBAV3Tv+Ihbm/0Mg8goWsyE3kfZ1hKFwZksnEpuZREmawBDYwL9EaNCt1GE65\r
+eHwL/ZA1xQ1GkhdEuBV6yRldVlYOVNqsiFSM4DffpqUfbLDC8oQSX6aRpX8CQr12\r
+KBDOHBIgpYE+uojMjTeoNHsoF02z3/tsHoCZspm/e6/FYKVBzbTeuDXPBv7st8Qu\r
+cMsIBXMRGKKD7YWRIdF2+nF7rPdOvhGo5k9RAJU5l/3bHyQ7tr4aaZdVUi0feNlE\r
+OxbG32w3zjhBo2LpOHYU/+whylsiipUqsN01tzUvc3aETSeyLz3reQNfSiJhJbGZ\r
+EPDHGlj4kHfdi0zI+IHSbmscRQvC8r29yZCZrUMaHomlMRr+C6+wEYgvsJ6lcj48\r
+xl+Y5CTOs+2vqxXpWyjs\r
+=xmOa\r
+-----END PGP SIGNATURE-----\r
+--==-=-=--\r
+\r
+--=-=-=--\r