Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 62 / 1ce45e3ae8349b8504c3114294313bf76e07a7
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 21368429E35\r
6         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:21:55 -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 IHHMNWBuHKD7 for <notmuch@notmuchmail.org>;\r
18         Thu,  7 Nov 2013 16:21:47 -0800 (PST)\r
19 Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
20         [209.85.212.175]) (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 7E59F431E84\r
23         for <notmuch@notmuchmail.org>; Thu,  7 Nov 2013 16:21:47 -0800 (PST)\r
24 Received: by mail-wi0-f175.google.com with SMTP id hm2so212468wib.14\r
25         for <notmuch@notmuchmail.org>; Thu, 07 Nov 2013 16:21:45 -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=Ekt5q/L/15USwBMINdrGEmbEVrmJKQn1BCjnkBE1JNM=;\r
29         b=kVwz+OZHraFW9D/eF6VVb9TV4wFPPH8yZyMudlGRJz8GCZ4A3TvJGWGcBJXzTvgjvK\r
30         A1DRHIpFDnnL2lHiNYT0Wig1bOmzadYDNynwuPhB3cwlY5Y40pThY8u3GDf+un8pc7Q/\r
31         +JaGIL4YA7r3zanYX9r8kdjbMIxi1cBxeTA67p2TayF9VnwhhSB0xqZqnmX84D0Icgd4\r
32         6kui9sUsIBMl89k/9kK29q6jfWoQ7m6Vfjd/WMmJkVIFF0kpdWM2IKwJX6fPfAwJMxRg\r
33         2oJB3L4mPtImujLnbGUb9uKe/sFid7MwYQKg9B/5uULLGa3rlhH3dIdCANVRDv+cbveH\r
34         FFBA==\r
35 X-Received: by 10.180.73.70 with SMTP id j6mr54093wiv.47.1383870104983;\r
36         Thu, 07 Nov 2013 16:21:44 -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 ev4sm394291wib.7.2013.11.07.16.21.44\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Thu, 07 Nov 2013 16:21:44 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 2/5] emacs: help: remove duplicate bindings\r
45 Date: Fri,  8 Nov 2013 00:21:33 +0000\r
46 Message-Id: <1383870096-14627-3-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1383870096-14627-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\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: Fri, 08 Nov 2013 00:21:55 -0000\r
63 \r
64 If the user (or a mode) overrides a keybinding from the common keymap\r
65 in one of the modes then both help lines appear in the help screen\r
66 even though only one of the is applicable.\r
67 \r
68 Fix this by checking if we already have that key binding. We do this\r
69 by constructing an list of (key . docstring) pairs so it is easy to\r
70 check if we have already had that binding. Then the actual print help\r
71 routine changes these pairs into strings "key \t docstring"\r
72 ---\r
73  emacs/notmuch-lib.el |   41 ++++++++++++++++++++++++-----------------\r
74  1 files changed, 24 insertions(+), 17 deletions(-)\r
75 \r
76 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
77 index ec5a2cb..2195166 100644\r
78 --- a/emacs/notmuch-lib.el\r
79 +++ b/emacs/notmuch-lib.el\r
80 @@ -238,11 +238,12 @@ This is basically just `format-kbd-macro' but we also convert ESC to M-."\r
81        (concat desc " "))))\r
82  \r
83  (defun notmuch-describe-keymap (keymap ua-keys &optional prefix tail)\r
84 -  "Return a list of strings, each describing one binding in KEYMAP.\r
85 +  "Return a list of cons cells, each describing one binding in KEYMAP.\r
86  \r
87 -Each string gives a human-readable description of the key and a\r
88 -one-line description of the bound function.  See `notmuch-help'\r
89 -for an overview of how this documentation is extracted.\r
90 +Each cons cell consists of a string giving a human-readable\r
91 +description of the key, and a one-line description of the bound\r
92 +function.  See `notmuch-help' for an overview of how this\r
93 +documentation is extracted.\r
94  \r
95  UA-KEYS should be a key sequence bound to `universal-argument'.\r
96  It will be used to describe bindings of commands that support a\r
97 @@ -255,18 +256,23 @@ prefix argument.  PREFIX and TAIL are used internally."\r
98                   (notmuch-describe-keymap\r
99                    binding ua-keys (notmuch-prefix-key-description key) tail)))\r
100            (binding\r
101 -           (when (and ua-keys (symbolp binding)\r
102 -                      (get binding 'notmuch-prefix-doc))\r
103 -             ;; Documentation for prefixed command\r
104 -             (let ((ua-desc (key-description ua-keys)))\r
105 -               (push (concat ua-desc " " prefix (format-kbd-macro (vector key))\r
106 -                             "\t" (get binding 'notmuch-prefix-doc))\r
107 -                     tail)))\r
108 -           ;; Documentation for command\r
109 -           (push (concat prefix (format-kbd-macro (vector key)) "\t"\r
110 -                         (or (and (symbolp binding) (get binding 'notmuch-doc))\r
111 -                             (notmuch-documentation-first-line binding)))\r
112 -                 tail))))\r
113 +           (let ((key-string (concat prefix (format-kbd-macro (vector key)))))\r
114 +             ;; We don't include documentation if the key-binding is\r
115 +             ;; over-ridden. Note, over-riding a binding\r
116 +             ;; automatically hides the prefixed version too.\r
117 +             (unless (assoc key-string tail)\r
118 +               (when (and ua-keys (symbolp binding)\r
119 +                          (get binding 'notmuch-prefix-doc))\r
120 +                 ;; Documentation for prefixed command\r
121 +                 (let ((ua-desc (key-description ua-keys)))\r
122 +                   (push (cons (concat ua-desc " " prefix (format-kbd-macro (vector key)))\r
123 +                               (get binding 'notmuch-prefix-doc))\r
124 +                         tail)))\r
125 +               ;; Documentation for command\r
126 +               (push (cons key-string\r
127 +                           (or (and (symbolp binding) (get binding 'notmuch-doc))\r
128 +                               (notmuch-documentation-first-line binding)))\r
129 +                     tail))))))\r
130     keymap)\r
131    tail)\r
132  \r
133 @@ -277,7 +283,8 @@ prefix argument.  PREFIX and TAIL are used internally."\r
134        (let* ((keymap-name (substring doc (match-beginning 1) (match-end 1)))\r
135              (keymap (symbol-value (intern keymap-name)))\r
136              (ua-keys (where-is-internal 'universal-argument keymap t))\r
137 -            (desc-list (notmuch-describe-keymap keymap ua-keys))\r
138 +            (desc-alist (notmuch-describe-keymap keymap ua-keys))\r
139 +            (desc-list (mapcar (lambda (arg) (concat (car arg) "\t" (cdr arg))) desc-alist))\r
140              (desc (mapconcat #'identity desc-list "\n")))\r
141         (setq doc (replace-match desc 1 1 doc)))\r
142        (setq beg (match-end 0)))\r
143 -- \r
144 1.7.9.1\r
145 \r