--- /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 1680D431FC4\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:30:20 -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 9kqW3Wyo-leS for <notmuch@notmuchmail.org>;\r
+ Thu, 7 Nov 2013 19:30:13 -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 05CC7431FC0\r
+ for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:30:12 -0800 (PST)\r
+X-AuditID: 1209190d-b7fa48e0000057cd-e3-527c5ac4e35c\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\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 B9.27.22477.4CA5C725; Thu, 7 Nov 2013 22:30:12 -0500 (EST)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id rA83UATp020036; \r
+ Thu, 7 Nov 2013 22:30:11 -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 rA83U9Ru026423\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Thu, 7 Nov 2013 22:30:10 -0500\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1Veclt-0006T0-2z; Thu, 07 Nov 2013 22:30:09 -0500\r
+Date: Thu, 7 Nov 2013 22:30:09 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v2 3/5] emacs: help: split out notmuch-describe-key as a\r
+ function\r
+Message-ID: <20131108033009.GL29298@mit.edu>\r
+References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
+ <1383870096-14627-4-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-4-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpileLIzCtJLcpLzFFi42IRYrdT0T0SVRNk8G43t8XquTwW12/OZHZg\r
+ 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mv5fO8JS0KhUcWLNYZYGxktSXYycHBICJhKT\r
+ lm5lgbDFJC7cW8/WxcjFISQwm0niypLfLBDOBkaJ/v9PWSGcU0wSv2ZcYwVpERJYwihxahc3\r
+ iM0ioCLx6+cnJhCbTUBDYtv+5YwgtoiAjsTtQwvYQWxmAWmJb7+bwWqEBcIlTj9/AzaHF6jm\r
+ 1Mu3zBALOhklHu84yA6REJQ4OfMJC0SzlsSNfy+BmjnABi3/xwFicgp4SSx5XwpSIQp0wpST\r
+ 29gmMArNQtI8C0nzLITmBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3SN9HIzS/RSU0o3MYKC\r
+ mlOSdwfju4NKhxgFOBiVeHhPXKoOEmJNLCuuzD3EKMnBpCTKqxRUEyTEl5SfUpmRWJwRX1Sa\r
+ k1p8iFGCg1lJhPeZIlCONyWxsiq1KB8mJc3BoiTOe5PDPkhIID2xJDU7NbUgtQgmK8PBoSTB\r
+ +zUSqFGwKDU9tSItM6cEIc3EwQkynAdoeD5IDW9xQWJucWY6RP4Uo6KUOO8NkIQASCKjNA+u\r
+ F5Z0XjGKA70izPsRpIoHmLDgul8BDWYCGhzyqxJkcEkiQkqqgfHssa0sDMuvHw3XN1v+PLCF\r
+ T/KSw2+eX2sPfo5ZPMdiVmyB61GFXzmJRasuqwpOaE/tXCX20PlNcPvFMwXluRIrV+2qudCx\r
+ UuW6uq7Za1+7wAfdmh1eL1PEWLYp2igp1R2+v9yrIzNn2sQ56zc/n/it85ay0+9HbncSLu99\r
+ kL2B+V7rydMp8zWVWIozEg21mIuKEwHzEFcxFQMAAA==\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:30:20 -0000\r
+\r
+Quoth Mark Walters on Nov 08 at 12:21 am:\r
+> The actual documentation function notmuch-describe-keymap was getting\r
+> rather complicated so split out the code for a single key into its own\r
+> function notmuch-describe-key.\r
+> ---\r
+> emacs/notmuch-lib.el | 42 +++++++++++++++++++++++++-----------------\r
+> 1 files changed, 25 insertions(+), 17 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 2195166..8852703 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -237,6 +237,30 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
+> "M-"\r
+> (concat desc " "))))\r
+> \r
+> +\r
+> +(defun notmuch-describe-key (actual-key binding prefix ua-keys tail)\r
+> + "Prepend cons cells describing prefix-arg ACTUAL-KEY and ACTUAL-KEY to TAIL\r
+> +\r
+> +It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
+\r
+This obviously works, but I wonder if the interface would be a bit\r
+clearer if, instead of extending tail, this returned a list of just\r
+the descriptions of ACTUAL-KEY. It would still have to take the\r
+existing bindings to eliminate duplicates, but that becomes just the\r
+list of existing bindings, and not *also* the tail to prepend bindings\r
+to. I'm imagining something like,\r
+\r
+(defun notmuch-describe-key (actual-key binding prefix ua-keys existing)\r
+ ...\r
+ (let ((key-string (concat prefix (format-kbd-macro actual-key))))\r
+ ;; We don't include documentation if the key-binding is\r
+ ;; over-ridden. Note, over-riding a binding automatically hides the\r
+ ;; prefixed version too.\r
+ (unless (assoc key-string tail)\r
+ (cons\r
+ ;; Documentation for command\r
+ (cons key-string\r
+ (or (and (symbolp binding) (get binding 'notmuch-doc))\r
+ (notmuch-documentation-first-line binding)))\r
+ ;; Documentation for prefixed command\r
+ (when (and ua-keys (symbolp binding)\r
+ (get binding 'notmuch-prefix-doc))\r
+ (list\r
+ (let ((ua-desc (key-description ua-keys)))\r
+ (cons (concat ua-desc " " prefix (format-kbd-macro actual-key))\r
+ (get binding 'notmuch-prefix-doc)))))))))\r
+\r
+Then below,\r
+\r
+ (setq tail (nconc (notmuch-describe-key ...) tail))\r
+\r
+This patch is also fine as is.\r
+\r
+> + (let ((key-string (concat prefix (format-kbd-macro actual-key))))\r
+> + ;; We don't include documentation if the key-binding is\r
+> + ;; over-ridden. Note, over-riding a binding automatically hides the\r
+> + ;; 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 actual-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
+> + tail)\r
+> +\r
+> (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
+> "Return a list of cons cells, each describing one binding in KEYMAP.\r
+> \r
+> @@ -256,23 +280,7 @@ 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
+> - (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
+> + (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))\r
+> keymap)\r
+> tail)\r
+> \r