Re: [PATCH 2/2] emacs: possibility to customize the rendering of tags
authorAustin Clements <amdragon@MIT.EDU>
Mon, 25 Mar 2013 14:26:06 +0000 (10:26 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:03 +0000 (09:54 -0800)
6f/3567f6353bba962eb9adb9dac271d26cdae0f8 [new file with mode: 0644]

diff --git a/6f/3567f6353bba962eb9adb9dac271d26cdae0f8 b/6f/3567f6353bba962eb9adb9dac271d26cdae0f8
new file mode 100644 (file)
index 0000000..f6ac6d8
--- /dev/null
@@ -0,0 +1,142 @@
+Return-Path: <amdragon@mit.edu>\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 A2D81431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Mar 2013 07:26:10 -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=[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 C387H2kywnzS for <notmuch@notmuchmail.org>;\r
+       Mon, 25 Mar 2013 07:26:10 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 16426431FAF\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Mar 2013 07:26:10 -0700 (PDT)\r
+X-AuditID: 12074424-b7f936d0000008eb-dc-51505e814c7e\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 40.43.02283.18E50515; Mon, 25 Mar 2013 10:26:09 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH-1.MIT.EDU [18.9.28.11])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r2PEQ88m018332; \r
+       Mon, 25 Mar 2013 10:26:09 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r2PEQ6rk027222\r
+       (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+       Mon, 25 Mar 2013 10:26:07 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+       (envelope-from <amdragon@MIT.EDU>)\r
+       id 1UK8Le-0005kz-HT; Mon, 25 Mar 2013 10:26:06 -0400\r
+Date: Mon, 25 Mar 2013 10:26:06 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Damien Cassou <damien.cassou@gmail.com>\r
+Subject: Re: [PATCH 2/2] emacs: possibility to customize the rendering of tags\r
+Message-ID: <20130325142606.GD32584@mit.edu>\r
+References: <1364038194-19856-1-git-send-email-damien.cassou@gmail.com>\r
+       <1364038194-19856-3-git-send-email-damien.cassou@gmail.com>\r
+       <20130325142237.GB32584@mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp"\r
+Content-Disposition: inline\r
+In-Reply-To: <20130325142237.GB32584@mit.edu>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFtrPKsWRmVeSWpSXmKPExsUixCmqrNsYFxBo8HqznsWuu1uZLK7fnMns\r
+       wOSxc9Zddo9nq24xBzBFcdmkpOZklqUW6dslcGU8mv+SteCWQMX3z50sDYxLeLsYOTkkBEwk\r
+       Ji1tY4GwxSQu3FvP1sXIxSEksI9R4tePw8wQzkZGiav3+9khnNNMEr1z5zKCtAgJLGGUOHPF\r
+       GcRmEVCV2L3wERuIzSagIbFt/3KwGhEBbYk3SztYQWxmAWmJb7+bmUBsYQE/iYc/ToLZvAI6\r
+       Et3rNkMtWMEo8fn0SqiEoMTJmU9YIJqtJFpX7wI6iQNs0PJ/HCBhTgFdiXUNi8D2igqoSEw5\r
+       uY1tAqPQLCTds5B0z0LohghrSdz495IJQ1hX4vCD71CdJhLrJzYwL2BkX8Uom5JbpZubmJlT\r
+       nJqsW5ycmJeXWqRrrpebWaKXmlK6iREUN+wuKjsYmw8pHWIU4GBU4uHdEBwQKMSaWFZcmXuI\r
+       UZKDSUmUNywWKMSXlJ9SmZFYnBFfVJqTWnyIUQVo16MNqy8wSrHk5eelKonwagkB1fGmJFZW\r
+       pRblw5RJc7AoifNeT7npLySQnliSmp2aWpBaBJOV4eBQkuBdArJAsCg1PbUiLTOnBCHNxMF5\r
+       iFGCgwdoeDJIDW9xQWJucWY6RP4Uo6KUOG8rSEIAJJFRmgfXC0t3rxjFgd4S5s0FqeIBpkq4\r
+       7ldAg5mABk/96w8yuCQRISXVwJjLxmNnw/DE69E9XmaezyveBSivarglmsOV2+gQeb/fSF/c\r
+       58rurKi1EbtMdwQd28L0/A7nNd3y4oWRZdkqbperIr9X3pAP/vQseqaexa3JpQcTf05VNGLf\r
+       xpy7eF/5uX+Sl2YERuxauj5l85pDn67qaJ+Xnzvx3Aaj6eytJ1LW8J/bU8hqJqnEUpyRaKjF\r
+       XFScCAA/10O+UgMAAA==\r
+Cc: notmuch@notmuchmail.org\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, 25 Mar 2013 14:26:10 -0000\r
+\r
+\r
+--17pEHd4RhPHOinZp\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+\r
+Quoth myself on Mar 25 at 10:22 am:\r
+> I pre-applied the transformations and removed the style attributes\r
+> that had default or unimportant values.  (The script to do the path\r
+> math is attached.)\r
+\r
+Now attached.\r
+\r
+--17pEHd4RhPHOinZp\r
+Content-Type: text/x-python; charset=us-ascii\r
+Content-Disposition: attachment; filename="xform.py"\r
+\r
+import re, numpy\r
+\r
+def parse_xform(xform):\r
+    [(name, args)] = re.findall(r"([a-z]+)\(([-0-9.,]+)\)", xform)\r
+    args = map(float, args.split(","))\r
+    if name == "translate":\r
+        x, y = args\r
+        return numpy.matrix([[1,0,x], [0,1,y], [0,0,1]])\r
+    if name == "matrix":\r
+        a, b, c, d, e, f = args\r
+        return numpy.matrix([[a,c,e], [b,d,f], [0,0,1]])\r
+    raise ValueError("Couldn't parse %r" % xform)\r
+\r
+def parse_path(spath):\r
+    # Parse an 'm' path\r
+    pos = (0,0)\r
+    res = []\r
+    for op in spath.split():\r
+        dx, dy = map(float, op.split(","))\r
+        pos = (pos[0] + dx, pos[1] + dy)\r
+        res.append(numpy.matrix([pos[0], pos[1], 1]).T)\r
+    return res\r
+\r
+def str_path(path):\r
+    # Print an 'M' path (different from parse_path!)\r
+    return " ".join("%.5f,%.5f" % (c[0][0], c[1][0]) for c in path)\r
+\r
+# Star icons\r
+xform = (parse_xform("translate(-242.81601,-315.59635)") *\r
+         parse_xform("matrix(0.2484147,-0.02623394,0.02623394,0.2484147,174.63605,255.37691)"))\r
+path = parse_path("290.25762,334.31206 -17.64143,-11.77975 -19.70508,7.85447 5.75171,-20.41814 -13.55925,-16.31348 21.19618,-0.83936 11.325,-17.93675 7.34825,19.89939 20.55849,5.22795 -16.65471,13.13786")\r
+xpath = [xform * coord for coord in path]\r
+# Path\r
+print str_path(xpath)\r
+# Stroke\r
+print numpy.linalg.norm(xform * numpy.matrix([1, 0, 1]).T -\r
+                        xform * numpy.matrix([0, 0, 1]).T)\r
+print\r
+\r
+# Tag icon\r
+xform = parse_xform("translate(0,-1036.3622)")\r
+path = parse_path("0.44642857,1040.9336 12.50000043,0 2.700893,3.6161 -2.700893,3.616 -12.50000043,0")\r
+xpath = [xform * coord for coord in path]\r
+# Path\r
+print str_path(xpath)\r
+\r
+--17pEHd4RhPHOinZp--\r