1 Return-Path: <markwalters1009@gmail.com>
\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 0AC34429E47
\r
6 for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:59 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,
\r
14 RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
15 Received: from olra.theworths.org ([127.0.0.1])
\r
16 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
17 with ESMTP id 2Ueqlnf5q7DZ for <notmuch@notmuchmail.org>;
\r
18 Sat, 26 Oct 2013 14:04:54 -0700 (PDT)
\r
19 Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com
\r
20 [209.85.212.182]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
21 (No client certificate requested)
\r
22 by olra.theworths.org (Postfix) with ESMTPS id 5034E429E4B
\r
23 for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:49 -0700 (PDT)
\r
24 Received: by mail-wi0-f182.google.com with SMTP id ez12so2482775wid.3
\r
25 for <notmuch@notmuchmail.org>; Sat, 26 Oct 2013 14:04:48 -0700 (PDT)
\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
\r
27 h=from:to:cc:subject:date:message-id:in-reply-to:references;
\r
28 bh=nPY1vstdys9cQ2wFwQ6SmXBiVMe7Zc1+BfN5Iy4s74g=;
\r
29 b=po3xijRtHzVECOgYTIWH8DRadD+4vX+ovjMj4i/czFofP2AJdrqbEmXzOc0bCMhP+8
\r
30 FAbpvA2rK3/fwWwH70SejE0uvjmSqQY1W6FjjNTk/v4SBqGHk5+xZjeBR4jcQyYz+fb5
\r
31 WRMX1laObTWKfgq9716Gyig3M3/HFWdYJVuJSnoOMPNDq1jzgW5ZYp/bJ3njq7uzcy2Z
\r
32 yPU69dzg02O6yGyu46RenbEbuWe5oGXwoYcv4vGXXfrwYfCCnGsxjEjzXyLQeAldttCp
\r
33 eew84FsGbWi3wfyV3INr6BDEmCVSxPpqBn9QryvnVWvW2YwEkykD+4d44HVB/+K3PtQq
\r
35 X-Received: by 10.194.239.40 with SMTP id vp8mr12583449wjc.45.1382821488193;
\r
36 Sat, 26 Oct 2013 14:04:48 -0700 (PDT)
\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])
\r
38 by mx.google.com with ESMTPSA id
\r
39 ey4sm19610558wic.11.2013.10.26.14.04.47 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sat, 26 Oct 2013 14:04:47 -0700 (PDT)
\r
42 From: Mark Walters <markwalters1009@gmail.com>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 3/4] emacs: help: remap support
\r
45 Date: Sat, 26 Oct 2013 22:04:38 +0100
\r
46 Message-Id: <1382821479-23384-4-git-send-email-markwalters1009@gmail.com>
\r
47 X-Mailer: git-send-email 1.7.9.1
\r
48 In-Reply-To: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>
\r
49 References: <1382821479-23384-1-git-send-email-markwalters1009@gmail.com>
\r
50 X-BeenThere: notmuch@notmuchmail.org
\r
51 X-Mailman-Version: 2.1.13
\r
53 List-Id: "Use and development of the notmuch mail system."
\r
54 <notmuch.notmuchmail.org>
\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
58 List-Post: <mailto:notmuch@notmuchmail.org>
\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
61 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
62 X-List-Received-Date: Sat, 26 Oct 2013 21:04:59 -0000
\r
64 If a user or mode uses remap to rebind a keybinding then it appears in
\r
65 the help as a line <remap><function> New function docstring. Special
\r
66 case these remapping lines so that we print the actual binding.
\r
68 emacs/notmuch.el | 21 ++++++++++++++-------
\r
69 1 files changed, 14 insertions(+), 7 deletions(-)
\r
71 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
72 index b9db9ba..c354b05 100644
\r
73 --- a/emacs/notmuch.el
\r
74 +++ b/emacs/notmuch.el
\r
75 @@ -140,7 +140,7 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."
\r
77 (concat desc " "))))
\r
79 -(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)
\r
80 +(defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail remap)
\r
81 "Return a list of cons cells, each describing one binding in KEYMAP.
\r
83 Each cons cell consists of a string giving a human-readable
\r
84 @@ -150,16 +150,23 @@ documentation is extracted.
\r
86 UA-KEYS should be a key sequence bound to `universal-argument'.
\r
87 It will be used to describe bindings of commands that support a
\r
88 -prefix argument. PREFIX and TAIL are used internally."
\r
89 +prefix argument. PREFIX, TAIL and REMAP are used internally."
\r
91 (lambda (key binding)
\r
92 (cond ((mouse-event-p key) nil)
\r
95 - (notmuch-describe-keymap
\r
96 - binding ua-keys (notmuch-prefix-key-description key) tail)))
\r
97 + (if (equal key 'remap)
\r
99 + (notmuch-describe-keymap
\r
100 + binding ua-keys prefix tail t))
\r
102 + (notmuch-describe-keymap
\r
103 + binding ua-keys (notmuch-prefix-key-description key) tail))))
\r
105 - (let ((key-string (concat prefix (format-kbd-macro (vector key)))))
\r
106 + (let* ((actual-key (if remap
\r
107 + (where-is-internal key nil t)
\r
109 + (key-string (concat prefix (format-kbd-macro actual-key))))
\r
110 ;; We don't include documentation if the key-binding is
\r
111 ;; over-ridden. Note, over-riding a binding
\r
112 ;; automatically hides the prefixed version too.
\r
113 @@ -168,7 +175,7 @@ prefix argument. PREFIX and TAIL are used internally."
\r
114 (get binding 'notmuch-prefix-doc))
\r
115 ;; Documentation for prefixed command
\r
116 (let ((ua-desc (key-description ua-keys)))
\r
117 - (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))
\r
118 + (push (cons (concat ua-desc " " prefix (format-kbd-macro actual-key))
\r
119 (get binding 'notmuch-prefix-doc))
\r
121 ;; Documentation for command
\r