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 3AAE7429E36
\r
6 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:11:46 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 0R3OBXI7r48E for <notmuch@notmuchmail.org>;
\r
17 Wed, 25 Jan 2012 07:11:45 -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 3A942431FBC
\r
22 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:11:45 -0800 (PST)
\r
23 Received: by bkbzt19 with SMTP id zt19so3531795bkb.26
\r
24 for <notmuch@notmuchmail.org>; Wed, 25 Jan 2012 07:11:42 -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=y7H/TK6SixpM6OOrl9ya9OJhXt+5Vuevvx4KeivZmPM=;
\r
29 b=fOA0ijKVMdV1PJW6lRp8hD+nBhyJU0KxdCJ1081cAjilqm2HfZ2JqdQp/A5u1rb+4m
\r
30 y8qD9SM+6gXaAu/FNmNsAszbOHv9AbXj+rAYMHifNcWss8fx5gMwNihc9lV6xBJuuMef
\r
31 yVEDaGTJFak6FA4a1j9yG4FsnfI3CsJD2aULg=
\r
32 Received: by 10.204.155.89 with SMTP id r25mr7136193bkw.11.1327504302317;
\r
33 Wed, 25 Jan 2012 07:11:42 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id sp6sm1615622bkb.2.2012.01.25.07.11.40
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Wed, 25 Jan 2012 07:11:41 -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 1/1] emacs: Take more care when hiding regions with
\r
42 In-Reply-To: <1327503908-17226-1-git-send-email-dme@dme.org>
\r
43 References: <1327503908-17226-1-git-send-email-dme@dme.org>
\r
44 User-Agent: Notmuch/0.11+100~gd650abf (http://notmuchmail.org) Emacs/23.3.1
\r
45 (x86_64-pc-linux-gnu)
\r
46 Date: Wed, 25 Jan 2012 19:10:35 +0400
\r
47 Message-ID: <871uqng6ms.fsf@gmail.com>
\r
49 Content-Type: text/plain; charset=us-ascii
\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:11:46 -0000
\r
64 On Wed, 25 Jan 2012 15:05:08 +0000, David Edmondson <dme@dme.org> wrote:
\r
65 > If the region to be hidden with a button by
\r
66 > `notmuch-wash-region-to-button' starts at the beginning of the buffer,
\r
67 > the invisible region will include the inserted button. This is
\r
68 > unfortunate, as it means that it is not possible to see the button to
\r
71 > Make a little space at the start of the buffer before inserting the
\r
72 > button to avoid this, not forgetting to remove the inserted space upon
\r
76 > This is a hack, but I couldn't see another way around it. Can anyone
\r
77 > find a better solution?
\r
80 I think it would be much easier to understand the problem and probably
\r
81 suggest a solution if there is a test :)
\r
86 > emacs/notmuch-wash.el | 57 ++++++++++++++++++++++++++++++++----------------
\r
87 > 1 files changed, 38 insertions(+), 19 deletions(-)
\r
89 > diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
90 > index 5c1e830..4afd3b3 100644
\r
91 > --- a/emacs/notmuch-wash.el
\r
92 > +++ b/emacs/notmuch-wash.el
\r
93 > @@ -147,25 +147,44 @@ insert before the button, probably for indentation."
\r
94 > ;; symbols because of the way the button code works. Note that
\r
95 > ;; replacing intern-soft with make-symbol will cause this to fail,
\r
96 > ;; since the newly created symbol has no plist.
\r
98 > - (let ((overlay (make-overlay beg end))
\r
99 > - (message-invis-spec (plist-get msg :message-invis-spec))
\r
100 > - (invis-spec (make-symbol (concat "notmuch-" type "-region")))
\r
101 > - (button-type (intern-soft (concat "notmuch-wash-button-"
\r
102 > - type "-toggle-type"))))
\r
103 > - (add-to-invisibility-spec invis-spec)
\r
104 > - (overlay-put overlay 'invisible (list invis-spec message-invis-spec))
\r
105 > - (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)
\r
106 > - (overlay-put overlay 'priority 10)
\r
107 > - (overlay-put overlay 'type type)
\r
108 > - (goto-char (1+ end))
\r
109 > - (save-excursion
\r
110 > - (goto-char (1- beg))
\r
111 > - (insert prefix)
\r
112 > - (insert-button (notmuch-wash-button-label overlay)
\r
113 > - 'invisibility-spec invis-spec
\r
114 > - 'overlay overlay
\r
115 > - :type button-type))))
\r
116 > + (save-excursion
\r
117 > + ;; If the beginning of the region to be converted to a button is the
\r
118 > + ;; beginning of the buffer we must move forward a little to avoid
\r
119 > + ;; creating an overlay that will hide the button intended to be used
\r
120 > + ;; to reveal the hidden region.
\r
121 > + (let (scene-of-crime)
\r
122 > + (when (eq beg (point-min))
\r
123 > + (goto-char (point-min))
\r
125 > + (setq scene-of-crime (point-min)
\r
128 > + ;; This uses some slightly tricky conversions between strings and
\r
129 > + ;; symbols because of the way the button code works. Note that
\r
130 > + ;; replacing intern-soft with make-symbol will cause this to fail,
\r
131 > + ;; since the newly created symbol has no plist.
\r
133 > + (let ((overlay (make-overlay beg end))
\r
134 > + (message-invis-spec (plist-get msg :message-invis-spec))
\r
135 > + (invis-spec (make-symbol (concat "notmuch-" type "-region")))
\r
136 > + (button-type (intern-soft (concat "notmuch-wash-button-"
\r
137 > + type "-toggle-type"))))
\r
138 > + (add-to-invisibility-spec invis-spec)
\r
139 > + (overlay-put overlay 'invisible (list invis-spec message-invis-spec))
\r
140 > + (overlay-put overlay 'isearch-open-invisible #'notmuch-wash-region-isearch-show)
\r
141 > + (overlay-put overlay 'priority 10)
\r
142 > + (overlay-put overlay 'type type)
\r
144 > + (goto-char (1- beg))
\r
145 > + (insert prefix)
\r
146 > + (insert-button (notmuch-wash-button-label overlay)
\r
147 > + 'invisibility-spec invis-spec
\r
148 > + 'overlay overlay
\r
149 > + :type button-type))
\r
151 > + (when scene-of-crime
\r
152 > + (goto-char scene-of-crime)
\r
153 > + (delete-char 1)))))
\r
155 > (defun notmuch-wash-excerpt-citations (msg depth)
\r
156 > "Excerpt citations and up to one signature."
\r
160 > _______________________________________________
\r
161 > notmuch mailing list
\r
162 > notmuch@notmuchmail.org
\r
163 > http://notmuchmail.org/mailman/listinfo/notmuch
\r