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 16CC1431FD7 for ; Tue, 12 Nov 2013 12:16:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 2.7 X-Spam-Level: ** X-Spam-Status: No, score=2.7 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, FREEMAIL_REPLY=2.499, 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 oHgV7m3xzVDR for ; Tue, 12 Nov 2013 12:16:32 -0800 (PST) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8FE6D431FCF for ; Tue, 12 Nov 2013 12:16:32 -0800 (PST) Received: by mail-we0-f171.google.com with SMTP id t61so3228896wes.30 for ; Tue, 12 Nov 2013 12:16:27 -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; bh=myvFFB2RpJ8MsIO9Kja+GUxb0h+8EyOZoz38NkJ7lVI=; b=ozzpL0Iy+ixjbAANUMPEPOR/0m8z18gMxTglKjzHPW7ycC+I+L0x81aRXr0nfqif0E 9uIs2qyJc+9POaWGZH8MX0AHAmrV1K4CYuB4faDygT4x8HlywUJSYwuA1D+ZXfy9db4M gdMiYP3J38BiALbpE0Jsch4JTCbxBWB7SUydPvYFCkc6kH8Br6ZTEjj+LPXiMJHU4wvw eBfOejU/w9ScY1E5bpjiPvkd8aTAn9a/iIPTH797d2hAR6XguDcqvLm/t2Vr6/cm19nP AS8smy5LSq+AIVTX9+jiUBQyBIbigvwqdvinDugnrOMckjDiaHRCHi3HNctksPT8vp4b 5Vkg== X-Received: by 10.180.37.227 with SMTP id b3mr17740337wik.24.1384287065082; Tue, 12 Nov 2013 12:11:05 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id ft19sm47895052wic.5.2013.11.12.12.11.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 12 Nov 2013 12:11:04 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH v4 0/7] emacs: help: remap keybindings Date: Tue, 12 Nov 2013 20:10:52 +0000 Message-Id: <1384287059-3525-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 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: Tue, 12 Nov 2013 20:16:40 -0000 This is v4 of this patch set. v3 is at id:1383932419-12533-1-git-send-email-markwalters1009@gmail.com. David found a bug in v3 which I tracked down to some match-data being over-written. This included the bugfix id:1384076682-16872-1-git-send-email-markwalters1009@gmail.com which is folded into this series as the second patch. The diff v3+bugfix is below: it does the save-match-data as Austin suggested, and it removes an accidental added comment which I put in when finding the bug. I have also left off the last "testing patch" (a patch that added some functionality to make it easier to test the help routine but not something that should be added to mainline) Best wishes Mark diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 20ed1fb..0655bdd 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -305,16 +305,15 @@ 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) ;; matches \{not-space} + (while (string-match "\\\\{\\([^}[:space:]]*\\)}" doc beg) (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)))) + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))) + (mapconcat #'identity desc-list "\n"))))) (setq doc (replace-match desc 1 1 doc))) (setq beg (match-end 0))) doc)) Mark Walters (7): emacs: help: check for nil key binding emacs: help: save-match-data emacs: help: remove duplicate bindings emacs: help: split out notmuch-describe-key as a function emacs: help: add base-keymap emacs: help: add a special function to deal with remaps emacs: tree: use remap for the over-ridden global bindings emacs/notmuch-lib.el | 85 ++++++++++++++++++++++++++++++++++-------------- emacs/notmuch-tree.el | 8 ++-- 2 files changed, 64 insertions(+), 29 deletions(-) -- 1.7.9.1