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