Re: [PATCH 1/6] emacs: add helper for tag change list manipulation
authorTomi Ollila <tomi.ollila@iki.fi>
Thu, 6 Sep 2012 14:30:56 +0000 (17:30 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:24 +0000 (09:49 -0800)
be/a70a3b6f5d2dd4010a3eff86b580f9bface2cf [new file with mode: 0644]

diff --git a/be/a70a3b6f5d2dd4010a3eff86b580f9bface2cf b/be/a70a3b6f5d2dd4010a3eff86b580f9bface2cf
new file mode 100644 (file)
index 0000000..2ed82e2
--- /dev/null
@@ -0,0 +1,115 @@
+Return-Path: <tomi.ollila@iki.fi>\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 38000431FAF\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 07:30:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\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 I4tFRUlP-Don for <notmuch@notmuchmail.org>;\r
+       Thu,  6 Sep 2012 07:30:49 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8B840431FAE\r
+       for <notmuch@notmuchmail.org>; Thu,  6 Sep 2012 07:30:49 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+       by guru.guru-group.fi (Postfix) with ESMTP id 0F8A51000E5;\r
+       Thu,  6 Sep 2012 17:30:57 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Jani Nikula <jani@nikula.org>, Michal Nazarewicz <mina86@mina86.com>,\r
+       notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 1/6] emacs: add helper for tag change list manipulation\r
+In-Reply-To: <87txvf8g5b.fsf@nikula.org>\r
+References: <cover.1346614915.git.jani@nikula.org>\r
+       <9dbf16fb95f40812ad246f95b954681bc895ceb2.1346614915.git.jani@nikula.org>\r
+       <xa1tipbvwdb0.fsf@mina86.com> <87txvf8g5b.fsf@nikula.org>\r
+User-Agent: Notmuch/0.14+11~gd9bf007 (http://notmuchmail.org) Emacs/24.2.1\r
+       (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+       $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+       !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Thu, 06 Sep 2012 17:30:56 +0300\r
+Message-ID: <m2obljxly7.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=utf-8\r
+Content-Transfer-Encoding: quoted-printable\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 14:30:50 -0000\r
+\r
+On Mon, Sep 03 2012, Jani Nikula wrote:\r
+\r
+> On Mon, 03 Sep 2012, Michal Nazarewicz <mina86@mina86.com> wrote:\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
+> Agreed.\r
+\r
+The whole series LGTM -- but are you still going to do=20\r
+changes here ?\r
+\r
+> Jani.\r
+\r
+Tomi\r
+\r
+\r
+>\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