Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 4f / e56a9262a4072e8a4721b4e2eb80a327b27ba1
1 Return-Path: <dmitry.kurochkin@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 A70AA40EC27\r
6         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 09:55:03 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id dUW28tDTK3EU for <notmuch@notmuchmail.org>;\r
17         Wed, 25 Jan 2012 09:55:03 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id CB02C431FBC\r
22         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 09:55:02 -0800 (PST)\r
23 Received: by bkbzt19 with SMTP id zt19so3708470bkb.26\r
24         for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 09:55:01 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=daDWbYSaTr/pg1tUUyrkR/vzutJLildjTlYCXPjbeSc=;\r
29         b=CIRuQas+RbZCGkzs6IG9oDM9j1tLRg/KmMcJPGKNhy9UwKR8MdcqXpPFndirKRku9T\r
30         meI355B6l76y3+OGlExMArQzkCqZYWVCtAuS0aQOYTNXBAmKh1I7A5sgiwwXjb7ezE0G\r
31         vWXhzJP1mGeIa3mIZjBiW37+Fqqy7lJQUm6wM=\r
32 Received: by 10.205.141.76 with SMTP id jd12mr7525105bkc.42.1327514101436;\r
33         Wed, 25 Jan 2012 09:55:01 -0800 (PST)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id fg16sm2541068bkb.16.2012.01.25.09.54.59\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Wed, 25 Jan 2012 09:55:00 -0800 (PST)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH 4/4 v2] emacs: Take more care when hiding regions with\r
41         buttons.\r
42 In-Reply-To: <1327506328-22126-5-git-send-email-dme@dme.org>\r
43 References: <1327503908-17226-1-git-send-email-dme@dme.org>\r
44         <1327506328-22126-1-git-send-email-dme@dme.org>\r
45         <1327506328-22126-5-git-send-email-dme@dme.org>\r
46 User-Agent: Notmuch/0.11+116~ge6e10b8 (http://notmuchmail.org) Emacs/23.3.1\r
47         (x86_64-pc-linux-gnu)\r
48 Date: Wed, 25 Jan 2012 21:53:54 +0400\r
49 Message-ID: <87ipjzhdn1.fsf@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=us-ascii\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Wed, 25 Jan 2012 17:55:03 -0000\r
65 \r
66 On Wed, 25 Jan 2012 15:45:28 +0000, David Edmondson <dme@dme.org> wrote:\r
67 > If the region to be hidden with a button by\r
68 > `notmuch-wash-region-to-button' starts at the beginning of the buffer,\r
69 > the invisible region will include the inserted button. This is\r
70 > unfortunate, as it means that it is not possible to see the button to\r
71 > be pressed.\r
72\r
73 > Make a little space at the start of the buffer before inserting the\r
74 > button to avoid this, not forgetting to remove the inserted space upon\r
75 > completion.\r
76\r
77 > Mark the relevant test as no longer broken.\r
78 > ---\r
79 \r
80 I will try to find some time to play with the test and look for\r
81 alternative solutions.\r
82 \r
83 Regards,\r
84   Dmitry\r
85 \r
86 >  emacs/notmuch-wash.el                 |   57 ++++++++++++++++++++++-----------\r
87 >  test/emacs-original-message-hiding.sh |    1 -\r
88 >  2 files changed, 38 insertions(+), 20 deletions(-)\r
89\r
90 > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
91 > index 5c1e830..4afd3b3 100644\r
92 > --- a/emacs/notmuch-wash.el\r
93 > +++ b/emacs/notmuch-wash.el\r
94 > @@ -147,25 +147,44 @@ insert before the button, probably for indentation."\r
95 >    ;; symbols because of the way the button code works. Note that\r
96 >    ;; replacing intern-soft with make-symbol will cause this to fail,\r
97 >    ;; since the newly created symbol has no plist.\r
98 > -\r
99 > -  (let ((overlay (make-overlay beg end))\r
100 > -     (message-invis-spec (plist-get msg :message-invis-spec))\r
101 > -     (invis-spec (make-symbol (concat "notmuch-" type "-region")))\r
102 > -     (button-type (intern-soft (concat "notmuch-wash-button-"\r
103 > -                                       type "-toggle-type"))))\r
104 > -    (add-to-invisibility-spec invis-spec)\r
105 > -    (overlay-put overlay 'invisible (list invis-spec message-invis-spec))\r
106 > -    (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)\r
107 > -    (overlay-put overlay 'priority 10)\r
108 > -    (overlay-put overlay 'type type)\r
109 > -    (goto-char (1+ end))\r
110 > -    (save-excursion\r
111 > -      (goto-char (1- beg))\r
112 > -      (insert prefix)\r
113 > -      (insert-button (notmuch-wash-button-label overlay)\r
114 > -                  'invisibility-spec invis-spec\r
115 > -                  'overlay overlay\r
116 > -                  :type button-type))))\r
117 > +  (save-excursion\r
118 > +    ;; If the beginning of the region to be converted to a button is the\r
119 > +    ;; beginning of the buffer we must move forward a little to avoid\r
120 > +    ;; creating an overlay that will hide the button intended to be used\r
121 > +    ;; to reveal the hidden region.\r
122 > +    (let (scene-of-crime)\r
123 > +      (when (eq beg (point-min))\r
124 > +     (goto-char (point-min))\r
125 > +     (insert "\n")\r
126 > +     (setq scene-of-crime (point-min)\r
127 > +           beg (point)))\r
128 > +\r
129 > +      ;; This uses some slightly tricky conversions between strings and\r
130 > +      ;; symbols because of the way the button code works. Note that\r
131 > +      ;; replacing intern-soft with make-symbol will cause this to fail,\r
132 > +      ;; since the newly created symbol has no plist.\r
133 > +\r
134 > +      (let ((overlay (make-overlay beg end))\r
135 > +         (message-invis-spec (plist-get msg :message-invis-spec))\r
136 > +         (invis-spec (make-symbol (concat "notmuch-" type "-region")))\r
137 > +         (button-type (intern-soft (concat "notmuch-wash-button-"\r
138 > +                                           type "-toggle-type"))))\r
139 > +     (add-to-invisibility-spec invis-spec)\r
140 > +     (overlay-put overlay 'invisible (list invis-spec message-invis-spec))\r
141 > +     (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)\r
142 > +     (overlay-put overlay 'priority 10)\r
143 > +     (overlay-put overlay 'type type)\r
144 > +\r
145 > +     (goto-char (1- beg))\r
146 > +     (insert prefix)\r
147 > +     (insert-button (notmuch-wash-button-label overlay)\r
148 > +                    'invisibility-spec invis-spec\r
149 > +                    'overlay overlay\r
150 > +                    :type button-type))\r
151 > +\r
152 > +      (when scene-of-crime\r
153 > +             (goto-char scene-of-crime)\r
154 > +             (delete-char 1)))))\r
155 >  \r
156 >  (defun notmuch-wash-excerpt-citations (msg depth)\r
157 >    "Excerpt citations and up to one signature."\r
158 > diff --git a/test/emacs-original-message-hiding.sh b/test/emacs-original-message-hiding.sh\r
159 > index 01cf98d..038ef4f 100755\r
160 > --- a/test/emacs-original-message-hiding.sh\r
161 > +++ b/test/emacs-original-message-hiding.sh\r
162 > @@ -13,7 +13,6 @@ add_message \\r
163 >      '[body]="-----Original Message-----\r
164 >  Text here.\r
165 >  "'\r
166 > -test_subtest_known_broken\r
167 >  test_emacs_expect_t \\r
168 >      '(load "emacs-original-message-hiding.el") (notmuch-test-original-message-hiding)'\r
169 >  \r
170 > -- \r
171 > 1.7.8.3\r
172\r
173 > _______________________________________________\r
174 > notmuch mailing list\r
175 > notmuch@notmuchmail.org\r
176 > http://notmuchmail.org/mailman/listinfo/notmuch\r