Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f3 / 8015c1a6b915751c191528dec7ca733828f305
1 Return-Path: <dme@dme.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 66345429E29\r
6         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 01:21:46 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id JC7f4cT-ZF2H for <notmuch@notmuchmail.org>;\r
16         Wed, 21 Dec 2011 01:21:45 -0800 (PST)\r
17 Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com\r
18         [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id D0B43431FB6\r
21         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 01:21:45 -0800 (PST)\r
22 Received: by qcha6 with SMTP id a6so5368187qch.26\r
23         for <notmuch@notmuchmail.org>; Wed, 21 Dec 2011 01:21:45 -0800 (PST)\r
24 Received: by 10.229.75.135 with SMTP id y7mr2312448qcj.40.1324459305042;\r
25         Wed, 21 Dec 2011 01:21:45 -0800 (PST)\r
26 Received: from hotblack-desiato.hh.sledj.net\r
27         (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
28         by mx.google.com with ESMTPS id h9sm9388833qac.13.2011.12.21.01.21.42\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Wed, 21 Dec 2011 01:21:44 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 10478A0501; Wed, 21 Dec 2011 09:21:41 +0000 (GMT)\r
33 To: Austin Clements <amdragon@MIT.EDU>, Jani Nikula <jani@nikula.org>\r
34 Subject: Re: [PATCH] emacs: create patch filename from subject for inline\r
35         patch fake parts\r
36 In-Reply-To: <20111220215229.GF10376@mit.edu>\r
37 References: <1321657368-13872-1-git-send-email-jani@nikula.org>\r
38         <87aa6nxb3o.fsf@nikula.org> <20111220215229.GF10376@mit.edu>\r
39 User-Agent: Notmuch/0.10.2+107~ga2d0215 (http://notmuchmail.org)\r
40         Emacs/24.0.92.1 (x86_64-pc-linux-gnu)\r
41 From: David Edmondson <dme@dme.org>\r
42 Date: Wed, 21 Dec 2011 09:21:37 +0000\r
43 Message-ID: <cun4nwuxota.fsf@hotblack-desiato.hh.sledj.net>\r
44 MIME-Version: 1.0\r
45 Content-Type: multipart/signed; boundary="=-=-=";\r
46         micalg=pgp-sha1; protocol="application/pgp-signature"\r
47 Cc: notmuch@notmuchmail.org\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Wed, 21 Dec 2011 09:21:46 -0000\r
61 \r
62 --=-=-=\r
63 Content-Type: text/plain\r
64 Content-Transfer-Encoding: quoted-printable\r
65 \r
66 On Tue, 20 Dec 2011 16:52:52 -0500, Austin Clements <amdragon@MIT.EDU> wrot=\r
67 e:\r
68 > Seems like a definite improvement, but perhaps a let* instead of all\r
69 > of the setq's?\r
70 \r
71 What would be a lispy approach? I tried:\r
72 \r
73 (defun notmuch-subject-to-patch-filename (subject)\r
74   "Convert a typical patch mail subject line into a suitable filename."\r
75   (concat=20\r
76    (let ((filename subject)\r
77          (transforms\r
78           '(("^ *\\(\\[[^]]*\\]\\)? *" . "")\r
79             ("[. ]*$" . "")\r
80             ("[^A-Za-z0-9._-]+" . "-")\r
81             ("\\.+" . "."))))\r
82      (mapc (lambda (transform)\r
83              (setq filename (replace-regexp-in-string (car transform) (cdr transfo=\r
84 rm) filename)))\r
85            transforms)\r
86      (substring filename 0 (min (length filename) 50)))\r
87    ".patch"))\r
88 \r
89 ...but that seems a bit unwieldy. `let*' looks best, but still feels a\r
90 bit odd:\r
91 \r
92 (defun notmuch-subject-to-patch-filename (subject)\r
93   "Convert a typical patch mail subject line into a suitable filename."\r
94   (concat=20\r
95    (let* ((filename (replace-regexp-in-string "^ *\\(\\[[^]]*\\]\\)? *" "" =\r
96 subject))\r
97           (filename (replace-regexp-in-string "[. ]*$" "" filename))\r
98           (filename (replace-regexp-in-string "[^A-Za-z0-9._-]+" "-" filename))\r
99           (filename (replace-regexp-in-string "\\.+" "." filename)))\r
100      (substring filename 0 (min (length filename) 50)))\r
101    ".patch"))\r
102 \r
103 dme.\r
104 =2D-=20\r
105 David Edmondson, http://dme.org\r
106 \r
107 --=-=-=\r
108 Content-Type: application/pgp-signature\r
109 \r
110 -----BEGIN PGP SIGNATURE-----\r
111 Version: GnuPG v1.4.11 (GNU/Linux)\r
112 \r
113 iEYEARECAAYFAk7xpSEACgkQaezQq/BJZRYGGwCfQYZkbnDdCwCppuPST+dBrgn8\r
114 pqgAoIEdLro1vT+U8OnrcAnFIXve/osf\r
115 =NfGm\r
116 -----END PGP SIGNATURE-----\r
117 --=-=-=--\r