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 2ADBB429E2B
\r
6 for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:47:51 -0700 (PDT)
\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 dk2bHh1ClFR9 for <notmuch@notmuchmail.org>;
\r
17 Thu, 26 May 2011 14:47:49 -0700 (PDT)
\r
18 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
19 [209.85.161.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 A9227429E25
\r
22 for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:47:48 -0700 (PDT)
\r
23 Received: by fxm8 with SMTP id 8so1056981fxm.26
\r
24 for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:47:47 -0700 (PDT)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=domainkey-signature:from:to:subject:in-reply-to:references
\r
27 :user-agent:date:message-id:mime-version:content-type;
\r
28 bh=2pJyaY87yIB022fcExYvVldz4ul0TK1DjwR18/UKm4w=;
\r
29 b=LW1NSDwk3XmA4FL1fAABBH13+4YcPRAfg5b/GdD/+EZyo/CSz51wsDtAopOT2eBFHj
\r
30 aNhP2IXfQa5WTGUU8tgBpCeyx63sBx5T1J6d6c7JwOdiTPKwyiJjTd+URMYcpF+FWk0X
\r
31 d47fpfGtqulti7AfMfWM5lPjK8DGqhfxme0YI=
\r
32 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
\r
33 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
34 :mime-version:content-type;
\r
35 b=KvhpaagFQ9pDgHi4lQ6EmMqT2b2+vZzc47u6rgj0TByvUkEfaRJXUBvG9uKwH9PC3R
\r
36 x4PDlV7v1S/pZEAHnaaA/PLg38mQ234h0XnmAgJw6TOVlMAXv5baA+eKpI0qylM2eU4u
\r
37 /q5bsx2G42PRoVtle2PWZh4Y87ZY4mCcW5YJk=
\r
38 Received: by 10.223.23.143 with SMTP id r15mr1509370fab.29.1306446467393;
\r
39 Thu, 26 May 2011 14:47:47 -0700 (PDT)
\r
40 Received: from localhost ([91.144.186.21])
\r
41 by mx.google.com with ESMTPS id m26sm448753fab.34.2011.05.26.14.47.46
\r
42 (version=TLSv1/SSLv3 cipher=OTHER);
\r
43 Thu, 26 May 2011 14:47:46 -0700 (PDT)
\r
44 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
45 To: notmuch@notmuchmail.org
\r
46 Subject: Re: [PATCH 2/2] Workaround for Emacs bug #8721.
\r
47 In-Reply-To: <1306445915-9474-2-git-send-email-dmitry.kurochkin@gmail.com>
\r
48 References: <1306361416-5019-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
49 <1306445915-9474-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
50 <1306445915-9474-2-git-send-email-dmitry.kurochkin@gmail.com>
\r
51 User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1
\r
52 (x86_64-pc-linux-gnu)
\r
53 Date: Fri, 27 May 2011 01:48:10 +0400
\r
54 Message-ID: <874o4hp205.fsf@gmail.com>
\r
56 Content-Type: multipart/mixed; boundary="=-=-="
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Thu, 26 May 2011 21:47:51 -0000
\r
73 On Fri, 27 May 2011 01:38:35 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
74 > The patch adds `notmuch-isearch-range-invisible' function which
\r
75 > is the same as `isearch-range-invisible' but with fixed Emacs bug
\r
76 > `notmuch-isearch-range-invisible' instead of the original
\r
77 > `isearch-range-invisible' when in `notmuch-show-mode'.
\r
79 I've screwed up the commit message because of a line starting with '#'.
\r
81 Attach is an amended patch.
\r
87 Content-Type: text/x-diff
\r
88 Content-Disposition: inline;
\r
89 filename=0001-Workaround-for-Emacs-bug-8721.patch
\r
91 >From ead308fb53725d593562d7d4e3cd4aa82412aa70 Mon Sep 17 00:00:00 2001
\r
92 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
93 Date: Fri, 27 May 2011 01:35:09 +0400
\r
94 Subject: [PATCH] Workaround for Emacs bug #8721.
\r
96 The patch adds `notmuch-isearch-range-invisible' function which
\r
97 is the same as `isearch-range-invisible' but with fixed Emacs bug
\r
98 #8721. Advice added for `isearch-range-invisible' which calls
\r
99 `notmuch-isearch-range-invisible' instead of the original
\r
100 `isearch-range-invisible' when in `notmuch-show-mode'.
\r
102 emacs/notmuch-wash.el | 67 +++++++++++++++++++++++++++++++++++++++++++++++++
\r
103 1 files changed, 67 insertions(+), 0 deletions(-)
\r
105 diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el
\r
106 index 992fa8f..f37fd95 100644
\r
107 --- a/emacs/notmuch-wash.el
\r
108 +++ b/emacs/notmuch-wash.el
\r
109 @@ -298,4 +298,71 @@ for error."
\r
113 +;; Temporary workaround for Emacs bug #8721
\r
114 +;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8721
\r
116 +(defun notmuch-isearch-range-invisible (beg end)
\r
117 + "Same as `isearch-range-invisible' but with fixed Emacs bug #8721."
\r
118 + (when (/= beg end)
\r
119 + ;; Check that invisibility runs up to END.
\r
122 + (let (;; can-be-opened keeps track if we can open some overlays.
\r
123 + (can-be-opened (eq search-invisible 'open))
\r
124 + ;; the list of overlays that could be opened
\r
125 + (crt-overlays nil))
\r
126 + (when (and can-be-opened isearch-hide-immediately)
\r
127 + (isearch-close-unnecessary-overlays beg end))
\r
128 + ;; If the following character is currently invisible,
\r
129 + ;; skip all characters with that same `invisible' property value.
\r
130 + ;; Do that over and over.
\r
131 + (while (and (< (point) end) (invisible-p (point)))
\r
132 + (if (get-text-property (point) 'invisible)
\r
134 + (goto-char (next-single-property-change (point) 'invisible
\r
136 + ;; if text is hidden by an `invisible' text property
\r
137 + ;; we cannot open it at all.
\r
138 + (setq can-be-opened nil))
\r
139 + (when can-be-opened
\r
140 + (let ((overlays (overlays-at (point)))
\r
145 + (setq o (car overlays)
\r
146 + invis-prop (overlay-get o 'invisible))
\r
147 + (if (invisible-p invis-prop)
\r
148 + (if (overlay-get o 'isearch-open-invisible)
\r
149 + (setq ov-list (cons o ov-list))
\r
150 + ;; We found one overlay that cannot be
\r
151 + ;; opened, that means the whole chunk
\r
152 + ;; cannot be opened.
\r
153 + (setq can-be-opened nil)))
\r
154 + (setq overlays (cdr overlays)))
\r
155 + (if can-be-opened
\r
156 + ;; It makes sense to append to the open
\r
157 + ;; overlays list only if we know that this is
\r
159 + (setq crt-overlays (append ov-list crt-overlays)))))
\r
160 + (goto-char (next-overlay-change (point)))))
\r
161 + ;; See if invisibility reaches up thru END.
\r
162 + (if (>= (point) end)
\r
163 + (if (and can-be-opened (consp crt-overlays))
\r
165 + (setq isearch-opened-overlays
\r
166 + (append isearch-opened-overlays crt-overlays))
\r
167 + (mapc 'isearch-open-overlay-temporary crt-overlays)
\r
169 + (setq isearch-hidden t)))))))
\r
171 +(defadvice isearch-range-invisible (around notmuch-isearch-range-invisible-advice activate)
\r
172 + "Call `notmuch-isearch-range-invisible' instead of the original
\r
173 +`isearch-range-invisible' when in `notmuch-show-mode' mode."
\r
174 + (if (eq major-mode 'notmuch-show-mode)
\r
175 + (setq ad-return-value (notmuch-isearch-range-invisible beg end))
\r
180 (provide 'notmuch-wash)
\r