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 7C13F431FC2 for ; Sun, 10 Nov 2013 01:44:56 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 ecEm8Z0nGG03 for ; Sun, 10 Nov 2013 01:44:50 -0800 (PST) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C2307431FAF for ; Sun, 10 Nov 2013 01:44:49 -0800 (PST) Received: by mail-wi0-f169.google.com with SMTP id cb5so1278423wib.0 for ; Sun, 10 Nov 2013 01:44:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7jpbeBLoh0GyU8mdI5OgUKAbKAO5H5xZ2MzgvOP3y2s=; b=HEarD/ePFDollGjStg0C0RW5UA4qts1YdkzqWeadGMaxXclcGmVhIX2XgNPk6oQPdR OdvCzHipntaQLIQfEw131F63blaayAFONSC4qFiQafYSB2V1/0N6DRa0eStv/mOz1j9c kATC2bGEIBfZWrBnEOL79c2o5vhlhJyd/mPTyq1nwe3jzLU+7NuaFJUAwzkQ2fwPIyyV SNyI0pKN17gnpSRq7ZNKHBtr4vm2rJAJtW6+ecV62axQ8qx7GliKI3If0gA+IhhojyAs gtTWM88sdRGRFAo36M8PxbD78T/xp2Fm1csY9lcXQaOkmtqqvsXSvyuE7FW+9NOt2/L6 EOlg== X-Received: by 10.180.75.142 with SMTP id c14mr8320132wiw.54.1384076687162; Sun, 10 Nov 2013 01:44:47 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id hv5sm22822963wib.2.2013.11.10.01.44.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 10 Nov 2013 01:44:46 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH] emacs: help: bugfix Date: Sun, 10 Nov 2013 09:44:42 +0000 Message-Id: <1384076682-16872-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com> References: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com> 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: Sun, 10 Nov 2013 09:44:56 -0000 Hi David found a bug in the this remap/help series. He has a global keybinding of "C-c s" for notmuch-search and this causes help in tree-mode to hang. I have mostly diagnosed this: the problem comes that all the construct help routines are inside a string-match/replace-match pair. Somewhere in these routines the match-data is being stomped on (but I have to admit I am not sure where). In any case putting the construct help routines inside a save-match-data seems to fix it. This version is a bit ugly: I am not sure of the best way to deal with the save-match-data macro. (I think it is best to have it round everything that happens between finding the match and replacing the match to avoid anything similar in future). This applies on top of the parent series. Any comments gratefully received! Best wishes Mark --- emacs/notmuch-lib.el | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 7b8acb3..e98e073 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -305,13 +305,16 @@ prefix argument. PREFIX and TAIL are used internally." (defun notmuch-substitute-command-keys (doc) "Like `substitute-command-keys' but with documentation, not function names." (let ((beg 0)) - (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) - (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1))) - (keymap (symbol-value (intern keymap-name))) - (ua-keys (where-is-internal 'universal-argument keymap t)) - (desc-alist (notmuch-describe-keymap keymap ua-keys keymap)) - (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist)) - (desc (mapconcat #'identity desc-list "\n"))) + (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) ;; matches \{not-space} + (let ((desc + (save-match-data + (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1))) + (keymap (symbol-value (intern keymap-name))) + (ua-keys (where-is-internal 'universal-argument keymap t)) + (desc-alist (notmuch-describe-keymap keymap ua-keys keymap)) + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist)) + (desc (mapconcat #'identity desc-list "\n"))) + desc)))) (setq doc (replace-match desc 1 1 doc))) (setq beg (match-end 0))) doc)) -- 1.7.9.1