--- /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 1868A431FC4\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:09:41 -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 XWzYl+GXiIGy for <notmuch@notmuchmail.org>;\r
+ Thu, 7 Nov 2013 19:09:33 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
+ [18.9.25.13])\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 149B5431FC0\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:09:32 -0800 (PST)\r
+X-AuditID: 1209190d-b7fa48e0000057cd-22-527c55eb6fb0\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ (using TLS with cipher AES256-SHA (256/256 bits))\r
+ (Client did not present a certificate)\r
+ by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id A9.96.22477.BE55C725; Thu, 7 Nov 2013 22:09:32 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id rA839U45016420; \r
+ Thu, 7 Nov 2013 22:09:31 -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 rA839SwX020668\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Thu, 7 Nov 2013 22:09:29 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VecRs-0006MU-DK; Thu, 07 Nov 2013 22:09:28 -0500\r
+Date: Thu, 7 Nov 2013 22:09:28 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v2 2/5] emacs: help: remove duplicate bindings\r
+Message-ID: <20131108030928.GK29298@mit.edu>\r
+References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
+ <1383870096-14627-3-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1383870096-14627-3-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IRYrdT130TWhNksPobk8XquTwW12/OZHZg\r
+ 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mh5f/8NacEq+4uyhbsYGxkMSXYwcHBICJhKr\r
+ F+t2MXICmWISF+6tZ+ti5OIQEpjNJLFu/UkWCGcDo0TjmZPsEM4pJokZ6++yQjhLGCWO/t3D\r
+ AtLPIqAiMeX/VlYQm01AQ2Lb/uWMILaIgI7E7UML2EFsZgFpiW+/m5lAbGEBJ4nPxxvBenmB\r
+ ap51/YAa2skosXvTX6iEoMTJmU9YIJq1JG78e8kEcjfIoOX/OEDCnAJeEkfuXQHbKwpyw8lt\r
+ bBMYhWYh6Z6FpHsWQvcCRuZVjLIpuVW6uYmZOcWpybrFyYl5ealFukZ6uZkleqkppZsYQWHN\r
+ Kcm7g/HdQaVDjAIcjEo8vCcuVQcJsSaWFVfmHmKU5GBSEuVVCqoJEuJLyk+pzEgszogvKs1J\r
+ LT7EKMHBrCTC+0wRKMebklhZlVqUD5OS5mBREue9yWEfJCSQnliSmp2aWpBaBJNV5+AQONf2\r
+ J1yKJS8/L1VJglcyBGiGYFFqempFWmZOCUIlEwcnyB4eoD2/QGp4iwsSc4sz0yHypxgVpcR5\r
+ N4IkBEASGaV5cL2wZPSKURzoK2HeEyBVPMBEBtf9CmgwE9DgkF+VIINLEhFSUg2M4mtWzGk2\r
+ 7vSp68hVeaYZ0Ot+0aU1P37azuUvDbM7Vi3g8vRgfS7+JO24ZIzfm/r39rXOC8ME9m5SC+T6\r
+ 9WrFFudDc4/uaTz67PT3Y95+14+sr8xKZzmkrbS/5/OW1Xy7onbe9N5xcMsN1msbQ4u//WW8\r
+ eqbk3Loyj3/7JLNc5wjwL1gv3Tx3tRJLcUaioRZzUXEiAAgxvN4hAwAA\r
+Cc: notmuch@notmuchmail.org\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 03:09:41 -0000\r
+\r
+Quoth Mark Walters on Nov 08 at 12:21 am:\r
+> If the user (or a mode) overrides a keybinding from the common keymap\r
+> in one of the modes then both help lines appear in the help screen\r
+> even though only one of the is applicable.\r
+\r
+s/the/them/\r
+\r
+> \r
+> Fix this by checking if we already have that key binding. We do this\r
+> by constructing an list of (key . docstring) pairs so it is easy to\r
+> check if we have already had that binding. Then the actual print help\r
+> routine changes these pairs into strings "key \t docstring"\r
+> ---\r
+> emacs/notmuch-lib.el | 41 ++++++++++++++++++++++++-----------------\r
+> 1 files changed, 24 insertions(+), 17 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index ec5a2cb..2195166 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -238,11 +238,12 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
+> (concat desc " "))))\r
+> \r
+> (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
+> - "Return a list of strings, each describing one binding in KEYMAP.\r
+> + "Return a list of cons cells, each describing one binding in KEYMAP.\r
+> \r
+> -Each string gives a human-readable description of the key and a\r
+> -one-line description of the bound function. See `notmuch-help'\r
+> -for an overview of how this documentation is extracted.\r
+> +Each cons cell consists of a string giving a human-readable\r
+> +description of the key, and a one-line description of the bound\r
+> +function. See `notmuch-help' for an overview of how this\r
+> +documentation is extracted.\r
+> \r
+> UA-KEYS should be a key sequence bound to `universal-argument'.\r
+> It will be used to describe bindings of commands that support a\r
+> @@ -255,18 +256,23 @@ prefix argument. PREFIX and TAIL are used internally."\r
+> (notmuch-describe-keymap\r
+> binding ua-keys (notmuch-prefix-key-description key) tail)))\r
+> (binding\r
+> - (when (and ua-keys (symbolp binding)\r
+> - (get binding 'notmuch-prefix-doc))\r
+> - ;; Documentation for prefixed command\r
+> - (let ((ua-desc (key-description ua-keys)))\r
+> - (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
+> - "\t" (get binding 'notmuch-prefix-doc))\r
+> - tail)))\r
+> - ;; Documentation for command\r
+> - (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
+> - (or (and (symbolp binding) (get binding 'notmuch-doc))\r
+> - (notmuch-documentation-first-line binding)))\r
+> - tail))))\r
+> + (let ((key-string (concat prefix (format-kbd-macro (vector key)))))\r
+> + ;; We don't include documentation if the key-binding is\r
+> + ;; over-ridden. Note, over-riding a binding\r
+> + ;; automatically hides the prefixed version too.\r
+> + (unless (assoc key-string tail)\r
+> + (when (and ua-keys (symbolp binding)\r
+> + (get binding 'notmuch-prefix-doc))\r
+> + ;; Documentation for prefixed command\r
+> + (let ((ua-desc (key-description ua-keys)))\r
+> + (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))\r
+> + (get binding 'notmuch-prefix-doc))\r
+> + tail)))\r
+> + ;; Documentation for command\r
+> + (push (cons key-string\r
+> + (or (and (symbolp binding) (get binding 'notmuch-doc))\r
+> + (notmuch-documentation-first-line binding)))\r
+> + tail))))))\r
+> keymap)\r
+> tail)\r
+> \r
+> @@ -277,7 +283,8 @@ 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-list (notmuch-describe-keymap keymap ua-keys))\r
+> + (desc-alist (notmuch-describe-keymap keymap ua-keys))\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
+> (setq beg (match-end 0)))\r