1 Return-Path: <tomi.ollila@iki.fi>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 8C1F3431FCF
\r
6 for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 04:13:05 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id hCRrdx-C1gk7 for <notmuch@notmuchmail.org>;
\r
16 Thu, 14 Nov 2013 04:12:56 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 8E156431FAE
\r
19 for <notmuch@notmuchmail.org>; Thu, 14 Nov 2013 04:12:56 -0800 (PST)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id BED59100033;
\r
22 Thu, 14 Nov 2013 14:12:44 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] emacs: add '?' to some prefix keymaps to describe its
\r
27 In-Reply-To: <1384422586-21806-1-git-send-email-markwalters1009@gmail.com>
\r
28 References: <1384422586-21806-1-git-send-email-markwalters1009@gmail.com>
\r
29 User-Agent: Notmuch/0.16+174~g9a06aa2 (http://notmuchmail.org) Emacs/24.3.1
\r
30 (x86_64-unknown-linux-gnu)
\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
32 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
33 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
34 Date: Thu, 14 Nov 2013 14:12:44 +0200
\r
35 Message-ID: <m238mz5ghv.fsf@guru.guru-group.fi>
\r
37 Content-Type: text/plain
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Thu, 14 Nov 2013 12:13:05 -0000
\r
52 On Thu, Nov 14 2013, Mark Walters <markwalters1009@gmail.com> wrote:
\r
54 > Added function notmuch-subkeymap-help to describe keybindings of a
\r
55 > subkeymap (eg after . or c in notmuch-search and notmuch-show).
\r
57 > This a reimplementation of Tomi's patch at
\r
58 > id:1377346540-7094-1-git-send-email-tomi.ollila@iki.fi but the help
\r
59 > screen shows docstrings rather than function names.
\r
61 Good stuff, works fine (much better than mine). Tests pass. +1
\r
74 > emacs/notmuch-lib.el | 25 ++++++++++++++++++++++++-
\r
75 > emacs/notmuch-show.el | 2 ++
\r
76 > emacs/notmuch.el | 1 +
\r
77 > 3 files changed, 27 insertions(+), 1 deletions(-)
\r
79 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
80 > index 49fe644..2be409b 100644
\r
81 > --- a/emacs/notmuch-lib.el
\r
82 > +++ b/emacs/notmuch-lib.el
\r
83 > @@ -231,7 +231,8 @@ depending on the value of `notmuch-poll-script'."
\r
84 > "Given a prefix key code, return a human-readable string representation.
\r
86 > This is basically just `format-kbd-macro' but we also convert ESC to M-."
\r
87 > - (let ((desc (format-kbd-macro (vector key))))
\r
88 > + (let* ((key-vector (if (vectorp key) key (vector key)))
\r
89 > + (desc (format-kbd-macro key-vector)))
\r
90 > (if (string= desc "ESC")
\r
92 > (concat desc " "))))
\r
93 > @@ -337,6 +338,28 @@ of its command symbol."
\r
94 > (set-buffer-modified-p nil)
\r
95 > (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
\r
97 > +(defun notmuch-subkeymap-help ()
\r
98 > + "Show help for a subkeymap."
\r
100 > + (let* ((key (this-command-keys-vector))
\r
101 > + (prefix (make-vector (1- (length key)) nil))
\r
103 > + (while (< i (length prefix))
\r
104 > + (aset prefix i (aref key i))
\r
105 > + (setq i (1+ i)))
\r
107 > + (let* ((subkeymap (key-binding prefix))
\r
108 > + (ua-keys (where-is-internal 'universal-argument nil t))
\r
109 > + (prefix-string (notmuch-prefix-key-description prefix))
\r
110 > + (desc-alist (notmuch-describe-keymap subkeymap ua-keys subkeymap prefix-string))
\r
111 > + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))
\r
112 > + (desc (mapconcat #'identity desc-list "\n")))
\r
113 > + (with-help-window (help-buffer)
\r
114 > + (with-current-buffer standard-output
\r
115 > + (insert "\nPress 'q' to quit this window.\n\n")
\r
116 > + (insert desc)))
\r
117 > + (pop-to-buffer (help-buffer)))))
\r
119 > (defvar notmuch-buffer-refresh-function nil
\r
120 > "Function to call to refresh the current buffer.")
\r
121 > (make-variable-buffer-local 'notmuch-buffer-refresh-function)
\r
122 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
123 > index f00273a..45dca8b 100644
\r
124 > --- a/emacs/notmuch-show.el
\r
125 > +++ b/emacs/notmuch-show.el
\r
126 > @@ -1232,6 +1232,7 @@ reset based on the original query."
\r
127 > (define-key map "t" 'notmuch-show-stash-to)
\r
128 > (define-key map "l" 'notmuch-show-stash-mlarchive-link)
\r
129 > (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
\r
130 > + (define-key map "?" 'notmuch-subkeymap-help)
\r
132 > "Submap for stash commands")
\r
133 > (fset 'notmuch-show-stash-map notmuch-show-stash-map)
\r
134 > @@ -1242,6 +1243,7 @@ reset based on the original query."
\r
135 > (define-key map "v" 'notmuch-show-view-part)
\r
136 > (define-key map "o" 'notmuch-show-interactively-view-part)
\r
137 > (define-key map "|" 'notmuch-show-pipe-part)
\r
138 > + (define-key map "?" 'notmuch-subkeymap-help)
\r
140 > "Submap for part commands")
\r
141 > (fset 'notmuch-show-part-map notmuch-show-part-map)
\r
142 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
143 > index c9bc2f2..0471750 100644
\r
144 > --- a/emacs/notmuch.el
\r
145 > +++ b/emacs/notmuch.el
\r
146 > @@ -165,6 +165,7 @@ To enter a line break in customize, press \\[quoted-insert] C-j."
\r
147 > (defvar notmuch-search-stash-map
\r
148 > (let ((map (make-sparse-keymap)))
\r
149 > (define-key map "i" 'notmuch-search-stash-thread-id)
\r
150 > + (define-key map "?" 'notmuch-subkeymap-help)
\r
152 > "Submap for stash commands")
\r
153 > (fset 'notmuch-search-stash-map notmuch-search-stash-map)
\r
157 > _______________________________________________
\r
158 > notmuch mailing list
\r
159 > notmuch@notmuchmail.org
\r
160 > http://notmuchmail.org/mailman/listinfo/notmuch
\r