--- /dev/null
+Return-Path: <tomi.ollila@iki.fi>\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 8C1F3431FCF\r
+ for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 04:13:05 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 hCRrdx-C1gk7 for <notmuch@notmuchmail.org>;\r
+ Thu, 14 Nov 2013 04:12:56 -0800 (PST)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 8E156431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 04:12:56 -0800 (PST)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id BED59100033;\r
+ Thu, 14 Nov 2013 14:12:44 +0200 (EET)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] emacs: add '?' to some prefix keymaps to describe its\r
+ bindings\r
+In-Reply-To: <1384422586-21806-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1384422586-21806-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.16+174~g9a06aa2 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Thu, 14 Nov 2013 14:12:44 +0200\r
+Message-ID: <m238mz5ghv.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Thu, 14 Nov 2013 12:13:05 -0000\r
+\r
+On Thu, Nov 14 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+\r
+> Added function notmuch-subkeymap-help to describe keybindings of a\r
+> subkeymap (eg after . or c in notmuch-search and notmuch-show).\r
+> ---\r
+> This a reimplementation of Tomi's patch at\r
+> id:1377346540-7094-1-git-send-email-tomi.ollila@iki.fi but the help\r
+> screen shows docstrings rather than function names.\r
+\r
+Good stuff, works fine (much better than mine). Tests pass. +1\r
+\r
+> Best wishes\r
+>\r
+> Mark\r
+\r
+Tomi\r
+\r
+>\r
+>\r
+>\r
+>\r
+>\r
+> emacs/notmuch-lib.el | 25 ++++++++++++++++++++++++-\r
+> emacs/notmuch-show.el | 2 ++\r
+> emacs/notmuch.el | 1 +\r
+> 3 files changed, 27 insertions(+), 1 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+> index 49fe644..2be409b 100644\r
+> --- a/emacs/notmuch-lib.el\r
+> +++ b/emacs/notmuch-lib.el\r
+> @@ -231,7 +231,8 @@ depending on the value of `notmuch-poll-script'."\r
+> "Given a prefix key code, return a human-readable string representation.\r
+> \r
+> This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
+> - (let ((desc (format-kbd-macro (vector key))))\r
+> + (let* ((key-vector (if (vectorp key) key (vector key)))\r
+> + (desc (format-kbd-macro key-vector)))\r
+> (if (string= desc "ESC")\r
+> "M-"\r
+> (concat desc " "))))\r
+> @@ -337,6 +338,28 @@ of its command symbol."\r
+> (set-buffer-modified-p nil)\r
+> (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))\r
+> \r
+> +(defun notmuch-subkeymap-help ()\r
+> + "Show help for a subkeymap."\r
+> + (interactive)\r
+> + (let* ((key (this-command-keys-vector))\r
+> + (prefix (make-vector (1- (length key)) nil))\r
+> + (i 0))\r
+> + (while (< i (length prefix))\r
+> + (aset prefix i (aref key i))\r
+> + (setq i (1+ i)))\r
+> +\r
+> + (let* ((subkeymap (key-binding prefix))\r
+> + (ua-keys (where-is-internal 'universal-argument nil t))\r
+> + (prefix-string (notmuch-prefix-key-description prefix))\r
+> + (desc-alist (notmuch-describe-keymap subkeymap ua-keys subkeymap prefix-string))\r
+> + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
+> + (desc (mapconcat #'identity desc-list "\n")))\r
+> + (with-help-window (help-buffer)\r
+> + (with-current-buffer standard-output\r
+> + (insert "\nPress 'q' to quit this window.\n\n")\r
+> + (insert desc)))\r
+> + (pop-to-buffer (help-buffer)))))\r
+> +\r
+> (defvar notmuch-buffer-refresh-function nil\r
+> "Function to call to refresh the current buffer.")\r
+> (make-variable-buffer-local 'notmuch-buffer-refresh-function)\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index f00273a..45dca8b 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -1232,6 +1232,7 @@ reset based on the original query."\r
+> (define-key map "t" 'notmuch-show-stash-to)\r
+> (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
+> (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
+> + (define-key map "?" 'notmuch-subkeymap-help)\r
+> map)\r
+> "Submap for stash commands")\r
+> (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
+> @@ -1242,6 +1243,7 @@ reset based on the original query."\r
+> (define-key map "v" 'notmuch-show-view-part)\r
+> (define-key map "o" 'notmuch-show-interactively-view-part)\r
+> (define-key map "|" 'notmuch-show-pipe-part)\r
+> + (define-key map "?" 'notmuch-subkeymap-help)\r
+> map)\r
+> "Submap for part commands")\r
+> (fset 'notmuch-show-part-map notmuch-show-part-map)\r
+> diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+> index c9bc2f2..0471750 100644\r
+> --- a/emacs/notmuch.el\r
+> +++ b/emacs/notmuch.el\r
+> @@ -165,6 +165,7 @@ To enter a line break in customize, press \\[quoted-insert] C-j."\r
+> (defvar notmuch-search-stash-map\r
+> (let ((map (make-sparse-keymap)))\r
+> (define-key map "i" 'notmuch-search-stash-thread-id)\r
+> + (define-key map "?" 'notmuch-subkeymap-help)\r
+> map)\r
+> "Submap for stash commands")\r
+> (fset 'notmuch-search-stash-map notmuch-search-stash-map)\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r