1 Return-Path: <amdragon@mit.edu>
\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 1868A431FC4
\r
6 for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:09:41 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 XWzYl+GXiIGy for <notmuch@notmuchmail.org>;
\r
16 Thu, 7 Nov 2013 19:09:33 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 149B5431FC0
\r
22 for <notmuch@notmuchmail.org>; Thu, 7 Nov 2013 19:09:32 -0800 (PST)
\r
23 X-AuditID: 1209190d-b7fa48e0000057cd-22-527c55eb6fb0
\r
24 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
25 (using TLS with cipher AES256-SHA (256/256 bits))
\r
26 (Client did not present a certificate)
\r
27 by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP
\r
28 id A9.96.22477.BE55C725; Thu, 7 Nov 2013 22:09:32 -0500 (EST)
\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
30 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id rA839U45016420;
\r
31 Thu, 7 Nov 2013 22:09:31 -0500
\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
33 (authenticated bits=0)
\r
34 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
35 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rA839SwX020668
\r
36 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);
\r
37 Thu, 7 Nov 2013 22:09:29 -0500
\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)
\r
39 (envelope-from <amdragon@mit.edu>)
\r
40 id 1VecRs-0006MU-DK; Thu, 07 Nov 2013 22:09:28 -0500
\r
41 Date: Thu, 7 Nov 2013 22:09:28 -0500
\r
42 From: Austin Clements <amdragon@MIT.EDU>
\r
43 To: Mark Walters <markwalters1009@gmail.com>
\r
44 Subject: Re: [PATCH v2 2/5] emacs: help: remove duplicate bindings
\r
45 Message-ID: <20131108030928.GK29298@mit.edu>
\r
46 References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>
\r
47 <1383870096-14627-3-git-send-email-markwalters1009@gmail.com>
\r
49 Content-Type: text/plain; charset=us-ascii
\r
50 Content-Disposition: inline
\r
51 In-Reply-To: <1383870096-14627-3-git-send-email-markwalters1009@gmail.com>
\r
52 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
53 X-Brightmail-Tracker:
\r
54 H4sIAAAAAAAAA+NgFupjleLIzCtJLcpLzFFi42IRYrdT130TWhNksPobk8XquTwW12/OZHZg
\r
55 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mh5f/8NacEq+4uyhbsYGxkMSXYwcHBICJhKr
\r
56 F+t2MXICmWISF+6tZ+ti5OIQEpjNJLFu/UkWCGcDo0TjmZPsEM4pJokZ6++yQjhLGCWO/t3D
\r
57 AtLPIqAiMeX/VlYQm01AQ2Lb/uWMILaIgI7E7UML2EFsZgFpiW+/m5lAbGEBJ4nPxxvBenmB
\r
58 ap51/YAa2skosXvTX6iEoMTJmU9YIJq1JG78e8kEcjfIoOX/OEDCnAJeEkfuXQHbKwpyw8lt
\r
59 bBMYhWYh6Z6FpHsWQvcCRuZVjLIpuVW6uYmZOcWpybrFyYl5ealFukZ6uZkleqkppZsYQWHN
\r
60 Kcm7g/HdQaVDjAIcjEo8vCcuVQcJsSaWFVfmHmKU5GBSEuVVCqoJEuJLyk+pzEgszogvKs1J
\r
61 LT7EKMHBrCTC+0wRKMebklhZlVqUD5OS5mBREue9yWEfJCSQnliSmp2aWpBaBJNV5+AQONf2
\r
62 J1yKJS8/L1VJglcyBGiGYFFqempFWmZOCUIlEwcnyB4eoD2/QGp4iwsSc4sz0yHypxgVpcR5
\r
63 N4IkBEASGaV5cL2wZPSKURzoK2HeEyBVPMBEBtf9CmgwE9DgkF+VIINLEhFSUg2M4mtWzGk2
\r
64 7vSp68hVeaYZ0Ot+0aU1P37azuUvDbM7Vi3g8vRgfS7+JO24ZIzfm/r39rXOC8ME9m5SC+T6
\r
65 9WrFFudDc4/uaTz67PT3Y95+14+sr8xKZzmkrbS/5/OW1Xy7onbe9N5xcMsN1msbQ4u//WW8
\r
66 eqbk3Loyj3/7JLNc5wjwL1gv3Tx3tRJLcUaioRZzUXEiAAgxvN4hAwAA
\r
67 Cc: notmuch@notmuchmail.org
\r
68 X-BeenThere: notmuch@notmuchmail.org
\r
69 X-Mailman-Version: 2.1.13
\r
71 List-Id: "Use and development of the notmuch mail system."
\r
72 <notmuch.notmuchmail.org>
\r
73 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
75 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
76 List-Post: <mailto:notmuch@notmuchmail.org>
\r
77 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
78 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
79 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
80 X-List-Received-Date: Fri, 08 Nov 2013 03:09:41 -0000
\r
82 Quoth Mark Walters on Nov 08 at 12:21 am:
\r
83 > If the user (or a mode) overrides a keybinding from the common keymap
\r
84 > in one of the modes then both help lines appear in the help screen
\r
85 > even though only one of the is applicable.
\r
90 > Fix this by checking if we already have that key binding. We do this
\r
91 > by constructing an list of (key . docstring) pairs so it is easy to
\r
92 > check if we have already had that binding. Then the actual print help
\r
93 > routine changes these pairs into strings "key \t docstring"
\r
95 > emacs/notmuch-lib.el | 41 ++++++++++++++++++++++++-----------------
\r
96 > 1 files changed, 24 insertions(+), 17 deletions(-)
\r
98 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
\r
99 > index ec5a2cb..2195166 100644
\r
100 > --- a/emacs/notmuch-lib.el
\r
101 > +++ b/emacs/notmuch-lib.el
\r
102 > @@ -238,11 +238,12 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."
\r
103 > (concat desc " "))))
\r
105 > (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)
\r
106 > - "Return a list of strings, each describing one binding in KEYMAP.
\r
107 > + "Return a list of cons cells, each describing one binding in KEYMAP.
\r
109 > -Each string gives a human-readable description of the key and a
\r
110 > -one-line description of the bound function. See `notmuch-help'
\r
111 > -for an overview of how this documentation is extracted.
\r
112 > +Each cons cell consists of a string giving a human-readable
\r
113 > +description of the key, and a one-line description of the bound
\r
114 > +function. See `notmuch-help' for an overview of how this
\r
115 > +documentation is extracted.
\r
117 > UA-KEYS should be a key sequence bound to `universal-argument'.
\r
118 > It will be used to describe bindings of commands that support a
\r
119 > @@ -255,18 +256,23 @@ prefix argument. PREFIX and TAIL are used internally."
\r
120 > (notmuch-describe-keymap
\r
121 > binding ua-keys (notmuch-prefix-key-description key) tail)))
\r
123 > - (when (and ua-keys (symbolp binding)
\r
124 > - (get binding 'notmuch-prefix-doc))
\r
125 > - ;; Documentation for prefixed command
\r
126 > - (let ((ua-desc (key-description ua-keys)))
\r
127 > - (push (concat ua-desc " " prefix (format-kbd-macro (vector key))
\r
128 > - "\t" (get binding 'notmuch-prefix-doc))
\r
130 > - ;; Documentation for command
\r
131 > - (push (concat prefix (format-kbd-macro (vector key)) "\t"
\r
132 > - (or (and (symbolp binding) (get binding 'notmuch-doc))
\r
133 > - (notmuch-documentation-first-line binding)))
\r
135 > + (let ((key-string (concat prefix (format-kbd-macro (vector key)))))
\r
136 > + ;; We don't include documentation if the key-binding is
\r
137 > + ;; over-ridden. Note, over-riding a binding
\r
138 > + ;; automatically hides the prefixed version too.
\r
139 > + (unless (assoc key-string tail)
\r
140 > + (when (and ua-keys (symbolp binding)
\r
141 > + (get binding 'notmuch-prefix-doc))
\r
142 > + ;; Documentation for prefixed command
\r
143 > + (let ((ua-desc (key-description ua-keys)))
\r
144 > + (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))
\r
145 > + (get binding 'notmuch-prefix-doc))
\r
147 > + ;; Documentation for command
\r
148 > + (push (cons key-string
\r
149 > + (or (and (symbolp binding) (get binding 'notmuch-doc))
\r
150 > + (notmuch-documentation-first-line binding)))
\r
155 > @@ -277,7 +283,8 @@ prefix argument. PREFIX and TAIL are used internally."
\r
156 > (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))
\r
157 > (keymap (symbol-value (intern keymap-name)))
\r
158 > (ua-keys (where-is-internal 'universal-argument keymap t))
\r
159 > - (desc-list (notmuch-describe-keymap keymap ua-keys))
\r
160 > + (desc-alist (notmuch-describe-keymap keymap ua-keys))
\r
161 > + (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))
\r
162 > (desc (mapconcat #'identity desc-list "\n")))
\r
163 > (setq doc (replace-match desc 1 1 doc)))
\r
164 > (setq beg (match-end 0)))
\r