--- /dev/null
+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 21471431FDA\r
+ for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:47:48 -0800 (PST)\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 DZKuwQO-pI7G for <notmuch@notmuchmail.org>;\r
+ Tue, 12 Nov 2013 10:47:40 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (dmz-mailsec-scanner-4.mit.edu\r
+ [18.9.25.15])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id B8B3D431FD7\r
+ for <notmuch@notmuchmail.org>; Tue, 12 Nov 2013 10:47:40 -0800 (PST)\r
+X-AuditID: 1209190f-b7fb86d000000c36-a4-528277cb4b1f\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id E5.D1.03126.BC772825; Tue, 12 Nov 2013 13:47:39 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rACIlc23022817; \r
+ Tue, 12 Nov 2013 13:47:39 -0500\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 rACIla9U013398\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Tue, 12 Nov 2013 13:47:37 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VgIzw-0005jL-7h; Tue, 12 Nov 2013 13:47:36 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: help: bugfix\r
+In-Reply-To: <1384076682-16872-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
+ <1384076682-16872-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.16+154~g96c0ce2 (http://notmuchmail.org) Emacs/23.4.1\r
+ (i486-pc-linux-gnu)\r
+Date: Tue, 12 Nov 2013 13:47:36 -0500\r
+Message-ID: <87ppq54fuf.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixCmqrXu6vCnIYN9KK4vVc3ksrt+cyezA\r
+ 5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZZx81chU8EGiYv4v1wbGJ8JdjJwcEgImEgs/\r
+ f2CEsMUkLtxbz9bFyMUhJDCbSWLOzbPsEM5GRol5R99DOaeZJM6tWswM4SxhlNhy9g8rSD+b\r
+ gIbEtv3LwWaJCLhKPP32mRnEFgaKH9l6lAnE5hTwknhyew4rRHM7o8SqA4/YQBKiAvES0xbu\r
+ BGrg4GARUJVYeEYMJMwLdN/PCc3sELagxMmZT1hAbGYBLYkb/14yTWAUmIUkNQtJagEj0ypG\r
+ 2ZTcKt3cxMyc4tRk3eLkxLy81CJdE73czBK91JTSTYzggJTk38H47aDSIUYBDkYlHt4HkU1B\r
+ QqyJZcWVuYcYJTmYlER5VYuBQnxJ+SmVGYnFGfFFpTmpxYcYJTiYlUR43WKAcrwpiZVVqUX5\r
+ MClpDhYlcd6bHPZBQgLpiSWp2ampBalFMFkZDg4lCV52kKGCRanpqRVpmTklCGkmDk6Q4TxA\r
+ w5VAaniLCxJzizPTIfKnGBWlxHkvFQElBEASGaV5cL2whPGKURzoFWHevyBVPMBkA9f9Cmgw\r
+ E9DgJXcbQQaXJCKkpBoYLZZNTtv95pSVNLvoHc6LKrm7Tbo3zZT4FfmWa4uX9s/sWRNVT7E7\r
+ //S3vKo0rT1ALnnp0UnCAksSph0xcJRdO8G2pf504Y4aBheJczpOzzcaaWs+a4uftP6ErI33\r
+ mpZHl0x/fYng4nwhKejOx6Wn1TadaeG6Deu/PfVLrr91VGzpvWNxbuUtSizFGYmGWsxFxYkA\r
+ 5/rlTfMCAAA=\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: Tue, 12 Nov 2013 18:47:48 -0000\r
+\r
+On Sun, 10 Nov 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> Hi\r
+>\r
+> David found a bug in the this remap/help series. He has a global\r
+> keybinding of "C-c s" for notmuch-search and this causes help in\r
+> tree-mode to hang.\r
+>\r
+> I have mostly diagnosed this: the problem comes that all the construct\r
+> help routines are inside a string-match/replace-match pair. Somewhere\r
+> in these routines the match-data is being stomped on (but I have to\r
+> admit I am not sure where).\r
+>\r
+> In any case putting the construct help routines inside a\r
+> save-match-data seems to fix it.\r
+>\r
+> This version is a bit ugly: I am not sure of the best way to deal with\r
+> the save-match-data macro. (I think it is best to have it round\r
+> everything that happens between finding the match and replacing the\r
+> match to avoid anything similar in future).\r
+>\r
+> This applies on top of the parent series.\r
+>\r
+> Any comments gratefully received!\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+> ---\r
+> emacs/notmuch-lib.el | 17 ++++++++++-------\r
+> 1 files changed, 10 insertions(+), 7 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 7b8acb3..e98e073 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -305,13 +305,16 @@ prefix argument. PREFIX and TAIL are used internally."\r
+> (defun notmuch-substitute-command-keys (doc)\r
+> "Like `substitute-command-keys' but with documentation, not function names."\r
+> (let ((beg 0))\r
+> - (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg)\r
+> - (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
+> - (keymap (symbol-value (intern keymap-name)))\r
+> - (ua-keys (where-is-internal 'universal-argument keymap t))\r
+> - (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))\r
+> - (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
+> - (desc (mapconcat #'identity desc-list "\n")))\r
+> + (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) ;; matches \{not-space}\r
+> + (let ((desc\r
+> + (save-match-data\r
+> + (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
+> + (keymap (symbol-value (intern keymap-name)))\r
+> + (ua-keys (where-is-internal 'universal-argument keymap t))\r
+> + (desc-alist (notmuch-describe-keymap keymap ua-keys keymap))\r
+> + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
+> + (desc (mapconcat #'identity desc-list "\n")))\r
+> + desc))))\r
+\r
+Oof, what an annoying place to lose the match data. My one suggestion\r
+would be to put (mapconcat #'identity desc-list "\n") as the body of the\r
+inner let, rather than binding `desc' and then immediately evaluating to\r
+`desc'. That would remove some redundancy, and it's already clear from\r
+the outer let that the result of the mapconcat is named `desc'.\r
+\r
+> (setq doc (replace-match desc 1 1 doc)))\r
+> (setq beg (match-end 0)))\r
+> doc))\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r