Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 76 / 9d0a723267f76b652f23a02cd4222eacb905b9
1 Return-Path: <amdragon@mit.edu>\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 21471431FDA\r
6         for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:47:48 -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 DZKuwQO-pI7G for <notmuch@notmuchmail.org>;\r
16         Tue, 12 Nov 2013 10:47:40 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
18         [18.9.25.15])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id B8B3D431FD7\r
22         for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:47:40 -0800 (PST)\r
23 X-AuditID: 1209190f-b7fb86d000000c36-a4-528277cb4b1f\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id E5.D1.03126.BC772825; Tue, 12 Nov 2013 13:47:39 -0500 (EST)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rACIlc23022817; \r
31         Tue, 12 Nov 2013 13:47:39 -0500\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
33         (authenticated bits=0)\r
34         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
35         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rACIla9U013398\r
36         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
37         Tue, 12 Nov 2013 13:47:37 -0500\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
39         (envelope-from <amdragon@mit.edu>)\r
40         id 1VgIzw-0005jL-7h; Tue, 12 Nov 2013 13:47:36 -0500\r
41 From: Austin Clements <amdragon@MIT.EDU>\r
42 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
43 Subject: Re: [PATCH] emacs: help: bugfix\r
44 In-Reply-To: <1384076682-16872-1-git-send-email-markwalters1009@gmail.com>\r
45 References: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
46         <1384076682-16872-1-git-send-email-markwalters1009@gmail.com>\r
47 User-Agent: Notmuch/0.16+154~g96c0ce2 (http://notmuchmail.org) Emacs/23.4.1\r
48         (i486-pc-linux-gnu)\r
49 Date: Tue, 12 Nov 2013 13:47:36 -0500\r
50 Message-ID: <87ppq54fuf.fsf@awakening.csail.mit.edu>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-Brightmail-Tracker:\r
54  H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixCmqrXu6vCnIYN9KK4vVc3ksrt+cyezA\r
55         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZZx81chU8EGiYv4v1wbGJ8JdjJwcEgImEgs/\r
56         f2CEsMUkLtxbz9bFyMUhJDCbSWLOzbPsEM5GRol5R99DOaeZJM6tWswM4SxhlNhy9g8rSD+b\r
57         gIbEtv3LwWaJCLhKPP32mRnEFgaKH9l6lAnE5hTwknhyew4rRHM7o8SqA4/YQBKiAvES0xbu\r
58         BGrg4GARUJVYeEYMJMwLdN/PCc3sELagxMmZT1hAbGYBLYkb/14yTWAUmIUkNQtJagEj0ypG\r
59         2ZTcKt3cxMyc4tRk3eLkxLy81CJdE73czBK91JTSTYzggJTk38H47aDSIUYBDkYlHt4HkU1B\r
60         QqyJZcWVuYcYJTmYlER5VYuBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR43WKAcrwpiZVVqUX5\r
61         MClpDhYlcd6bHPZBQgLpiSWp2ampBalFMFkZDg4lCV52kKGCRanpqRVpmTklCGkmDk6Q4TxA\r
62         w5VAaniLCxJzizPTIfKnGBWlxHkvFQElBEASGaV5cL2whPGKURzoFWHevyBVPMBkA9f9Cmgw\r
63         E9DgJXcbQQaXJCKkpBoYLZZNTtv95pSVNLvoHc6LKrm7Tbo3zZT4FfmWa4uX9s/sWRNVT7E7\r
64         //S3vKo0rT1ALnnp0UnCAksSph0xcJRdO8G2pf504Y4aBheJczpOzzcaaWs+a4uftP6ErI33\r
65         mpZHl0x/fYng4nwhKejOx6Wn1TadaeG6Deu/PfVLrr91VGzpvWNxbuUtSizFGYmGWsxFxYkA\r
66         5/rlTfMCAAA=\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Tue, 12 Nov 2013 18:47:48 -0000\r
80 \r
81 On Sun, 10 Nov 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
82 > Hi\r
83 >\r
84 > David found a bug in the this remap/help series. He has a global\r
85 > keybinding of "C-c s" for notmuch-search and this causes help in\r
86 > tree-mode to hang.\r
87 >\r
88 > I have mostly diagnosed this: the problem comes that all the construct\r
89 > help routines are inside a string-match/replace-match pair. Somewhere\r
90 > in these routines the match-data is being stomped on (but I have to\r
91 > admit I am not sure where).\r
92 >\r
93 > In any case putting the construct help routines inside a\r
94 > save-match-data seems to fix it.\r
95 >\r
96 > This version is a bit ugly: I am not sure of the best way to deal with\r
97 > the save-match-data macro. (I think it is best to have it round\r
98 > everything that happens between finding the match and replacing the\r
99 > match to avoid anything similar in future).\r
100 >\r
101 > This applies on top of the parent series.\r
102 >\r
103 > Any comments gratefully received!\r
104 >\r
105 > Best wishes\r
106 >\r
107 > Mark\r
108 >\r
109 > ---\r
110 >  emacs/notmuch-lib.el |   17 ++++++++++-------\r
111 >  1 files changed, 10 insertions(+), 7 deletions(-)\r
112 >\r
113 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
114 > index 7b8acb3..e98e073 100644\r
115 > --- a/emacs/notmuch-lib.el\r
116 > +++ b/emacs/notmuch-lib.el\r
117 > @@ -305,13 +305,16 @@ prefix argument.  PREFIX and TAIL are used internally."\r
118 >  (defun notmuch-substitute-command-keys (doc)\r
119 >    "Like `substitute-command-keys' but with documentation, not function names."\r
120 >    (let ((beg 0))\r
121 > -    (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)\r
122 > -      (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
123 > -          (keymap (symbol-value (intern keymap-name)))\r
124 > -          (ua-keys (where-is-internal 'universal-argument keymap t))\r
125 > -          (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))\r
126 > -          (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
127 > -          (desc (mapconcat #'identity desc-list "\n")))\r
128 > +    (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) ;; matches \{not-space}\r
129 > +      (let ((desc\r
130 > +          (save-match-data\r
131 > +            (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
132 > +                   (keymap (symbol-value (intern keymap-name)))\r
133 > +                   (ua-keys (where-is-internal 'universal-argument keymap t))\r
134 > +                   (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))\r
135 > +                   (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
136 > +                   (desc (mapconcat #'identity desc-list "\n")))\r
137 > +              desc))))\r
138 \r
139 Oof, what an annoying place to lose the match data.  My one suggestion\r
140 would be to put (mapconcat #'identity desc-list "\n") as the body of the\r
141 inner let, rather than binding `desc' and then immediately evaluating to\r
142 `desc'.  That would remove some redundancy, and it's already clear from\r
143 the outer let that the result of the mapconcat is named `desc'.\r
144 \r
145 >       (setq doc (replace-match desc 1 1 doc)))\r
146 >        (setq beg (match-end 0)))\r
147 >      doc))\r
148 > -- \r
149 > 1.7.9.1\r
150 >\r
151 > _______________________________________________\r
152 > notmuch mailing list\r
153 > notmuch@notmuchmail.org\r
154 > http://notmuchmail.org/mailman/listinfo/notmuch\r