--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 09232429E39\r
+ for <notmuch@notmuchmail.org>; Fri, 8 Nov 2013 09:40:40 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 2.7\r
+X-Spam-Level: **\r
+X-Spam-Status: No, score=2.7 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ FREEMAIL_REPLY=2.499, 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 d7fTxdfY68Ww for <notmuch@notmuchmail.org>;\r
+ Fri, 8 Nov 2013 09:40:34 -0800 (PST)\r
+Received: from mail-wg0-f47.google.com (mail-wg0-f47.google.com\r
+ [74.125.82.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 23B93431FDE for <notmuch@notmuchmail.org>; Fri, 8 Nov 2013 09:40:28 -0800\r
+ (PST)\r
+Received: by mail-wg0-f47.google.com with SMTP id c11so2276874wgh.14\r
+ for <notmuch@notmuchmail.org>; Fri, 08 Nov 2013 09:40:25 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id;\r
+ bh=1moXW+By+9yTflAVMIyRQPcFePHEFWoqOhhDXYUo9Ek=;\r
+ b=059QzF9J1KjmFpWRrHfdtT9whjZnR7l7LacWLBykYppltVCIODzFiCsp34W6V9baxD\r
+ Df1/KchxlOqTPfnrZmkgt8j1buQQGud+H56uJpf1nTkT0Y8skewiwPfIlIyaQU5gMCci\r
+ RxUlj0KOQZmxofmUk66yv3BDs4I+OsTGZD79GSZ+kFKFjUwAy7+pxgdcOMXH4ZDzrI3/\r
+ 0W5bcM8n4t7tqNaa9YLZrJPP+B353EVQMzFtrps+5MVRLx2NZiVJD19oVuN650XyeR2h\r
+ pJqa5+0cGpDWCg7JPMMS7YAXomiQpVlPZI71Ihhi+0VwEO25MZeQj6J4h30wy3WV1I7K\r
+ G/Aw==\r
+X-Received: by 10.180.94.38 with SMTP id cz6mr3255559wib.27.1383932423260;\r
+ Fri, 08 Nov 2013 09:40:23 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id td6sm7508300wic.10.2013.11.08.09.40.22\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Fri, 08 Nov 2013 09:40:22 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 0/7] emacs: help: remap keybindings\r
+Date: Fri, 8 Nov 2013 17:40:12 +0000\r
+Message-Id: <1383932419-12533-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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: Fri, 08 Nov 2013 17:40:40 -0000\r
+\r
+This is version 3 of the series. v2 is at\r
+id:1383870096-14627-1-git-send-email-markwalters1009@gmail.com\r
+\r
+The changes are in response to Austin's review of v2. I have not\r
+changed notmuch-describe-key.\r
+\r
+The other change is to add a base-keymap to look up the remapped\r
+commands in (since notmuch-substitute-command-keys could refer to\r
+something other than the current keymap). Currently this never happens\r
+but this makes the code more robust.\r
+\r
+The final patch of the series is (probably) just for testing\r
+purposes. It lets you call notmuch-help and specify which mode you\r
+want to display help for. This means you can call it without having\r
+the mode as current-mode and hence test the base-keymap code.\r
+\r
+Finally the diff from v2 below (with the testing patch omitted) is below.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index ef616d5..4b3a86e 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -261,7 +261,7 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
+ tail)))\r
+ tail)\r
+ \r
+-(defun notmuch-describe-remaps (remap-keymap ua-keys prefix tail)\r
++(defun notmuch-describe-remaps (remap-keymap ua-keys base-keymap prefix tail)\r
+ ;; Remappings are represented as a binding whose first "event" is\r
+ ;; 'remap. Hence, if the keymap has any remappings, it will have a\r
+ ;; binding whose "key" is 'remap, and whose "binding" is itself a\r
+@@ -272,11 +272,11 @@ It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
+ (mapc\r
+ (lambda (actual-key)\r
+ (setq tail (notmuch-describe-key actual-key binding prefix ua-keys tail)))\r
+- (where-is-internal command)))\r
++ (where-is-internal command base-keymap)))\r
+ remap-keymap)\r
+ tail)\r
+ \r
+-(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
++(defun notmuch-describe-keymap (keymap ua-keys base-keymap &optional prefix tail)\r
+ "Return a list of cons cells, each describing one binding in KEYMAP.\r
+ \r
+ Each cons cell consists of a string giving a human-readable\r
+@@ -291,13 +291,12 @@ prefix argument. PREFIX and TAIL are used internally."\r
+ (lambda (key binding)\r
+ (cond ((mouse-event-p key) nil)\r
+ ((keymapp binding)\r
+- (if (eq key 'remap)\r
+- (setq tail\r
++ (setq tail\r
++ (if (eq key 'remap)\r
+ (notmuch-describe-remaps\r
+- binding ua-keys prefix tail))\r
+- (setq tail\r
++ binding ua-keys base-keymap prefix tail)\r
+ (notmuch-describe-keymap\r
+- binding ua-keys (notmuch-prefix-key-description key) tail))))\r
++ binding ua-keys base-keymap (notmuch-prefix-key-description key) tail))))\r
+ (binding\r
+ (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))\r
+ keymap)\r
+@@ -310,7 +309,7 @@ prefix argument. PREFIX and TAIL are used internally."\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))\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
+ (setq doc (replace-match desc 1 1 doc)))\r
+\r
+\r
+\r
+Mark Walters (7):\r
+ emacs: help: check for nil key binding\r
+ emacs: help: remove duplicate bindings\r
+ emacs: help: split out notmuch-describe-key as a function\r
+ emacs: help: add base-keymap\r
+ emacs: help: add a special function to deal with remaps\r
+ emacs: tree: use remap for the over-ridden global bindings\r
+ emacs: help: base-keymap-test-help\r
+\r
+ emacs/notmuch-lib.el | 79 ++++++++++++++++++++++++++++++++++--------------\r
+ emacs/notmuch-tree.el | 8 ++--\r
+ 2 files changed, 60 insertions(+), 27 deletions(-)\r
+\r
+\r
+\r
+\r
+-- \r
+1.7.9.1\r
+\r