Re: Hi all
[notmuch-archives.git] / 58 / 0b76640fb2c2cb304333cb246c1f4524a8dece
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 A19CC429E2E\r
6         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:27:07 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \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 tXp24CWFD9zG for <notmuch@notmuchmail.org>;\r
18         Thu,  7 Nov 2013 16:27:00 -0800 (PST)\r
19 Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com\r
20         [209.85.212.172]) (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 DE571429E26\r
23         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:26:59 -0800 (PST)\r
24 Received: by mail-wi0-f172.google.com with SMTP id ez12so1465506wid.17\r
25         for <notmuch@notmuchmail.org>; Thu, 07 Nov 2013 16:26:56 -0800 (PST)\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=N4YMpZq/47KojcpG7f1UnE8UkxVX65eUWBrE04y5R88=;\r
29         b=uLzAyBnv75ZMYfhuG0aqEX06rP4I3A78/prvqQN4yBZEdNmDfF2rGavZsjyCk0a26Y\r
30         JK+qvA/32a3eH8mXJuufyzTVW6V7r7pM30DUqTxhxBpN7u10MF48vrntgBWApiScXsu5\r
31         dVC51+MXYHvn3rEYDwN7CwmrsOyvlb6tJ6MsMFOcD/wsiW6LQdPsyTszvyJO5QOnahKr\r
32         SHelJFZbSBGLJHGo4FZijp4tvUufPiFYCBf2yzYDVzoVNDfuLXXhsi5SUr0nABTOjyu+\r
33         7dEE2em2EhXiRr00/I6NIP/ny0uVEksPgzRn+Exv6RgM6i+eXzpL9+TXoWPs1S5J2YbK\r
34         +Uzw==\r
35 X-Received: by 10.194.122.99 with SMTP id lr3mr9439478wjb.21.1383870106419;\r
36         Thu, 07 Nov 2013 16:21:46 -0800 (PST)\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 y11sm395566wie.7.2013.11.07.16.21.45\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Thu, 07 Nov 2013 16:21:46 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 3/5] emacs: help: split out notmuch-describe-key as a\r
45         function\r
46 Date: Fri,  8 Nov 2013 00:21:34 +0000\r
47 Message-Id: <1383870096-14627-4-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 In-Reply-To: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Fri, 08 Nov 2013 00:27:07 -0000\r
64 \r
65 The actual documentation function notmuch-describe-keymap was getting\r
66 rather complicated so split out the code for a single key into its own\r
67 function notmuch-describe-key.\r
68 ---\r
69  emacs/notmuch-lib.el |   42 +++++++++++++++++++++++++-----------------\r
70  1 files changed, 25 insertions(+), 17 deletions(-)\r
71 \r
72 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
73 index 2195166..8852703 100644\r
74 --- a/emacs/notmuch-lib.el\r
75 +++ b/emacs/notmuch-lib.el\r
76 @@ -237,6 +237,30 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
77         "M-"\r
78        (concat desc " "))))\r
79  \r
80 +\r
81 +(defun notmuch-describe-key (actual-key binding prefix ua-keys tail)\r
82 +  "Prepend cons cells describing prefix-arg ACTUAL-KEY and ACTUAL-KEY to TAIL\r
83 +\r
84 +It does not prepend if ACTUAL-KEY is already listed in TAIL."\r
85 +  (let ((key-string (concat prefix (format-kbd-macro actual-key))))\r
86 +    ;; We don't include documentation if the key-binding is\r
87 +    ;; over-ridden. Note, over-riding a binding automatically hides the\r
88 +    ;; prefixed version too.\r
89 +    (unless (assoc key-string tail)\r
90 +      (when (and ua-keys (symbolp binding)\r
91 +                (get binding 'notmuch-prefix-doc))\r
92 +       ;; Documentation for prefixed command\r
93 +       (let ((ua-desc (key-description ua-keys)))\r
94 +         (push (cons (concat ua-desc " " prefix (format-kbd-macro actual-key))\r
95 +                     (get binding 'notmuch-prefix-doc))\r
96 +               tail)))\r
97 +      ;; Documentation for command\r
98 +      (push (cons key-string\r
99 +                 (or (and (symbolp binding) (get binding 'notmuch-doc))\r
100 +                     (notmuch-documentation-first-line binding)))\r
101 +           tail)))\r
102 +    tail)\r
103 +\r
104  (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
105    "Return a list of cons cells, each describing one binding in KEYMAP.\r
106  \r
107 @@ -256,23 +280,7 @@ prefix argument.  PREFIX and TAIL are used internally."\r
108                   (notmuch-describe-keymap\r
109                    binding ua-keys (notmuch-prefix-key-description key) tail)))\r
110            (binding\r
111 -           (let ((key-string (concat prefix (format-kbd-macro (vector key)))))\r
112 -             ;; We don't include documentation if the key-binding is\r
113 -             ;; over-ridden. Note, over-riding a binding\r
114 -             ;; automatically hides the prefixed version too.\r
115 -             (unless (assoc key-string tail)\r
116 -               (when (and ua-keys (symbolp binding)\r
117 -                          (get binding 'notmuch-prefix-doc))\r
118 -                 ;; Documentation for prefixed command\r
119 -                 (let ((ua-desc (key-description ua-keys)))\r
120 -                   (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))\r
121 -                               (get binding 'notmuch-prefix-doc))\r
122 -                         tail)))\r
123 -               ;; Documentation for command\r
124 -               (push (cons key-string\r
125 -                           (or (and (symbolp binding) (get binding 'notmuch-doc))\r
126 -                               (notmuch-documentation-first-line binding)))\r
127 -                     tail))))))\r
128 +           (setq tail (notmuch-describe-key (vector key) binding prefix ua-keys tail)))))\r
129     keymap)\r
130    tail)\r
131  \r
132 -- \r
133 1.7.9.1\r
134 \r