Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 85 / 4f1ea8342c8abcbdcba009df4981e3ae5f157f
1 Return-Path: <tomi.ollila@iki.fi>\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 3FA12431FCF\r
6         for <notmuch@notmuchmail.org>; Mon,  9 Dec 2013 00:21:09 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 5D+EmkDFunDc for <notmuch@notmuchmail.org>;\r
16         Mon,  9 Dec 2013 00:21:01 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 7A941431FC0\r
19         for <notmuch@notmuchmail.org>; Mon,  9 Dec 2013 00:21:01 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 0ECBD10005D;\r
22         Mon,  9 Dec 2013 10:20:52 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH 4/4] test: give unique timestamps to messages\r
26 In-Reply-To: <87lhzult3h.fsf@maritornes.cs.unb.ca>\r
27 References: <1386517946-22054-1-git-send-email-david@tethera.net>\r
28         <1386517946-22054-5-git-send-email-david@tethera.net>\r
29         <m28uvvnowo.fsf@guru.guru-group.fi>\r
30         <87lhzult3h.fsf@maritornes.cs.unb.ca>\r
31 User-Agent: Notmuch/0.17~rc1+17~ga2e1a2f (http://notmuchmail.org) Emacs/24.3.1\r
32         (x86_64-unknown-linux-gnu)\r
33 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
34         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
35         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
36 Date: Mon, 09 Dec 2013 10:20:51 +0200\r
37 Message-ID: <m28uvusae4.fsf@guru.guru-group.fi>\r
38 MIME-Version: 1.0\r
39 Content-Type: text/plain\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Mon, 09 Dec 2013 08:21:09 -0000\r
53 \r
54 On Mon, Dec 09 2013, David Bremner <david@tethera.net> wrote:\r
55 \r
56 > Tomi Ollila <tomi.ollila@iki.fi> writes:\r
57 >\r
58 >>>      if [ -z "${template[date]}" ]; then\r
59 >>> -   template[date]="Fri, 05 Jan 2001 15:43:57 +0000"\r
60 >>> +   template[date]=$(date -Ru -d@$((978709437 - gen_msg_cnt)))\r
61 >>\r
62 >> I am afraid this is not portable (although not sure). This could work:\r
63 >>\r
64 >> _s=$((3599 - gen_msg_cnt))\r
65 >> template[date]="Fri, 05 Jan 2001 15:$((_s / 60)):$((_s % 60)) +0000"\r
66 >>\r
67 >\r
68 > How about this instead?\r
69 >\r
70 > diff --git a/test/test-lib.sh b/test/test-lib.sh\r
71 > index 792e477..22a4d7f 100644\r
72 > --- a/test/test-lib.sh\r
73 > +++ b/test/test-lib.sh\r
74 > @@ -356,7 +356,8 @@ generate_message ()\r
75 >      fi\r
76 >  \r
77 >      if [ -z "${template[date]}" ]; then\r
78 > -     template[date]=$(date -Ru -d@$((978709437 - gen_msg_cnt)))\r
79 > +     template[date]=$(TZ=UTC printf "%(%a, %d %b %Y %T %z)T\n" \\r
80 > +                     $((978709437 - gen_msg_cnt)))\r
81 >      fi\r
82 \r
83 $ printf "%(%a, %d %b %Y %T %z)T\n" 978709437\r
84 printf: %(: invalid directive\r
85 zsh: exit 1\r
86 \r
87 $ bash -c 'printf "%(%a, %d %b %Y %T %z)T\n" 978709437'\r
88 Fri, 05 Jan 2001 17:43:57 +0200\r
89 \r
90 \r
91 Using bash builtin is fine by me! :D\r
92 \r
93 BTW: this works too:\r
94 \r
95 bash -c 'TZ=UTC printf -v foo[bar] "%(%a, %d %b %Y %T %z)T\n" 978709437; echo ${foo[bar]}'\r
96 \r
97 \r
98 Tomi\r