1 Return-Path: <dme@dme.org>
\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 32B75429E39
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:18: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 d1QzB2gVT7YT for <notmuch@notmuchmail.org>;
\r
16 Wed, 25 Jan 2012 07:18:40 -0800 (PST)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 C7F1B429E36 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:18:39 -0800
\r
22 Received: by wgbdt12 with SMTP id dt12so4908511wgb.2
\r
23 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:18:38 -0800 (PST)
\r
24 Received: by 10.180.73.111 with SMTP id k15mr1076953wiv.5.1327504718495;
\r
25 Wed, 25 Jan 2012 07:18:38 -0800 (PST)
\r
26 Received: from hotblack-desiato.hh.sledj.net
\r
27 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
28 by mx.google.com with ESMTPS id ho4sm385021wib.3.2012.01.25.07.18.36
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Wed, 25 Jan 2012 07:18:37 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 6B3E89FE67; Wed, 25 Jan 2012 15:18:35 +0000 (GMT)
\r
33 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
34 Subject: Re: [PATCH 1/1] emacs: Take more care when hiding regions with
\r
36 In-Reply-To: <871uqng6ms.fsf@gmail.com>
\r
37 References: <1327503908-17226-1-git-send-email-dme@dme.org>
\r
38 <871uqng6ms.fsf@gmail.com>
\r
39 User-Agent: Notmuch/0.11+114~g550724b (http://notmuchmail.org) Emacs/24.0.92.1
\r
40 (x86_64-pc-linux-gnu)
\r
41 From: David Edmondson <dme@dme.org>
\r
42 Date: Wed, 25 Jan 2012 15:18:31 +0000
\r
43 Message-ID: <cun62fzn73s.fsf@hotblack-desiato.hh.sledj.net>
\r
45 Content-Type: multipart/signed; boundary="=-=-=";
\r
46 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
48 ALoCoQkA/jE2qEpXxZBDoJ1AZthYK9Nocf+6i7/MDuORUfmpgvLrRADOP5oOAY9gbJjeSkPJw484
\r
49 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\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: Wed, 25 Jan 2012 15:18:41 -0000
\r
65 Content-Type: text/plain
\r
66 Content-Transfer-Encoding: quoted-printable
\r
68 On Wed, 25 Jan 2012 19:10:35 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmai=
\r
70 > On Wed, 25 Jan 2012 15:05:08 +0000, David Edmondson <dme@dme.org> wrote:
\r
71 > > If the region to be hidden with a button by
\r
72 > > `notmuch-wash-region-to-button' starts at the beginning of the buffer,
\r
73 > > the invisible region will include the inserted button. This is
\r
74 > > unfortunate, as it means that it is not possible to see the button to
\r
77 > > Make a little space at the start of the buffer before inserting the
\r
78 > > button to avoid this, not forgetting to remove the inserted space upon
\r
82 > > This is a hack, but I couldn't see another way around it. Can anyone
\r
83 > > find a better solution?
\r
86 > I think it would be much easier to understand the problem and probably
\r
87 > suggest a solution if there is a test :)
\r
89 Wow, and I have that new test infrastructure to use!
\r
95 > > emacs/notmuch-wash.el | 57 ++++++++++++++++++++++++++++++++---------=
\r
97 > > 1 files changed, 38 insertions(+), 19 deletions(-)
\r
99 > > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
100 > > index 5c1e830..4afd3b3 100644
\r
101 > > --- a/emacs/notmuch-wash.el
\r
102 > > +++ b/emacs/notmuch-wash.el
\r
103 > > @@ -147,25 +147,44 @@ insert before the button, probably for indentatio=
\r
105 > > ;; symbols because of the way the button code works. Note that
\r
106 > > ;; replacing intern-soft with make-symbol will cause this to fail,
\r
107 > > ;; since the newly created symbol has no plist.
\r
109 > > - (let ((overlay (make-overlay beg end))
\r
110 > > - (message-invis-spec (plist-get msg :message-invis-spec))
\r
111 > > - (invis-spec (make-symbol (concat "notmuch-" type "-region")))
\r
112 > > - (button-type (intern-soft (concat "notmuch-wash-button-"
\r
113 > > - type "-toggle-type"))))
\r
114 > > - (add-to-invisibility-spec invis-spec)
\r
115 > > - (overlay-put overlay 'invisible (list invis-spec message-invis-spe=
\r
117 > > - (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region=
\r
119 > > - (overlay-put overlay 'priority 10)
\r
120 > > - (overlay-put overlay 'type type)
\r
121 > > - (goto-char (1+ end))
\r
122 > > - (save-excursion
\r
123 > > - (goto-char (1- beg))
\r
124 > > - (insert prefix)
\r
125 > > - (insert-button (notmuch-wash-button-label overlay)
\r
126 > > - 'invisibility-spec invis-spec
\r
127 > > - 'overlay overlay
\r
128 > > - :type button-type))))
\r
129 > > + (save-excursion
\r
130 > > + ;; If the beginning of the region to be converted to a button is t=
\r
132 > > + ;; beginning of the buffer we must move forward a little to avoid
\r
133 > > + ;; creating an overlay that will hide the button intended to be us=
\r
135 > > + ;; to reveal the hidden region.
\r
136 > > + (let (scene-of-crime)
\r
137 > > + (when (eq beg (point-min))
\r
138 > > + (goto-char (point-min))
\r
139 > > + (insert "\n")
\r
140 > > + (setq scene-of-crime (point-min)
\r
141 > > + beg (point)))
\r
143 > > + ;; This uses some slightly tricky conversions between strings and
\r
144 > > + ;; symbols because of the way the button code works. Note that
\r
145 > > + ;; replacing intern-soft with make-symbol will cause this to fai=
\r
147 > > + ;; since the newly created symbol has no plist.
\r
149 > > + (let ((overlay (make-overlay beg end))
\r
150 > > + (message-invis-spec (plist-get msg :message-invis-spec))
\r
151 > > + (invis-spec (make-symbol (concat "notmuch-" type "-region")))
\r
152 > > + (button-type (intern-soft (concat "notmuch-wash-button-"
\r
153 > > + type "-toggle-type"))))
\r
154 > > + (add-to-invisibility-spec invis-spec)
\r
155 > > + (overlay-put overlay 'invisible (list invis-spec message-invis-spec))
\r
156 > > + (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-is=
\r
158 > > + (overlay-put overlay 'priority 10)
\r
159 > > + (overlay-put overlay 'type type)
\r
161 > > + (goto-char (1- beg))
\r
162 > > + (insert prefix)
\r
163 > > + (insert-button (notmuch-wash-button-label overlay)
\r
164 > > + 'invisibility-spec invis-spec
\r
165 > > + 'overlay overlay
\r
166 > > + :type button-type))
\r
168 > > + (when scene-of-crime
\r
169 > > + (goto-char scene-of-crime)
\r
170 > > + (delete-char 1)))))
\r
172 > > (defun notmuch-wash-excerpt-citations (msg depth)
\r
173 > > "Excerpt citations and up to one signature."
\r
177 > > _______________________________________________
\r
178 > > notmuch mailing list
\r
179 > > notmuch@notmuchmail.org
\r
180 > > http://notmuchmail.org/mailman/listinfo/notmuch
\r
183 Content-Type: application/pgp-signature
\r
185 -----BEGIN PGP SIGNATURE-----
\r
186 Version: GnuPG v1.4.11 (GNU/Linux)
\r
188 iEYEARECAAYFAk8gHUcACgkQaezQq/BJZRb+UQCgg6OTsoocoq6hKc5ViAB873I/
\r
189 pI4An10/4r8Z/JPUIv+mlmn46y8F0Iuq
\r
191 -----END PGP SIGNATURE-----
\r