[PATCH 2/2] Workaround for Emacs bug #8721.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Thu, 26 May 2011 21:38:35 +0000 (01:38 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:23 +0000 (09:38 -0800)
2f/68b2f535535a7b3108c9c81bf4c011c187747f [new file with mode: 0644]

diff --git a/2f/68b2f535535a7b3108c9c81bf4c011c187747f b/2f/68b2f535535a7b3108c9c81bf4c011c187747f
new file mode 100644 (file)
index 0000000..2e2c826
--- /dev/null
@@ -0,0 +1,152 @@
+Return-Path: <dmitry.kurochkin@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 89879429E2A\r
+       for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:38:19 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id HCzpEyxpKJ+N for <notmuch@notmuchmail.org>;\r
+       Thu, 26 May 2011 14:38:18 -0700 (PDT)\r
+Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com\r
+       [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D493D429E25\r
+       for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:38:17 -0700 (PDT)\r
+Received: by mail-fx0-f53.google.com with SMTP id 8so1052886fxm.26\r
+       for <notmuch@notmuchmail.org>; Thu, 26 May 2011 14:38:17 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer\r
+       :in-reply-to:references;\r
+       bh=8SnJWrkUxy03QbIlouFFns24JV2tu3uxZl1PB79vQX0=;\r
+       b=qWq09Qa1bBIGCCK2EQMsXm5bNJE072A3O7viOATSyEpt1c+uKG5CQviQ9bD+vKpuqW\r
+       s7tTeridA0/W7svAOr3uD/wm36b8U+vKUJTlc1bRdo21ty/4jTkgUWHspFk7shxE68fw\r
+       SUXZa47BNaLjWaH6N9Jzs9RsVpgXPXocp0XVU=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       b=k7IIz8uHU4v4qkwLjQMjJGqf9Zb3wwOLF6J1PQcJPa77SU8FP5Tz939MsvmiDG4Bby\r
+       KWoDwfQXbT5ByIWwvlXP1qyveDXW13ZuaiLNA9/lCr+zn2DoTE9vojVrXffCSUbvCwUj\r
+       VebBN75SrnIY4tLgDgqYZXY5HEaTUxXMk8hWk=\r
+Received: by 10.223.9.137 with SMTP id l9mr1479801fal.25.1306445897509;\r
+       Thu, 26 May 2011 14:38:17 -0700 (PDT)\r
+Received: from localhost ([91.144.186.21])\r
+       by mx.google.com with ESMTPS id l26sm446553fam.21.2011.05.26.14.38.16\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 26 May 2011 14:38:16 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/2] Workaround for Emacs bug #8721.\r
+Date: Fri, 27 May 2011 01:38:35 +0400\r
+Message-Id: <1306445915-9474-2-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-Mailer: git-send-email 1.7.5.1\r
+In-Reply-To: <1306445915-9474-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+References: <1306361416-5019-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+       <1306445915-9474-1-git-send-email-dmitry.kurochkin@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 26 May 2011 21:38:19 -0000\r
+\r
+The patch adds `notmuch-isearch-range-invisible' function which\r
+is the same as `isearch-range-invisible' but with fixed Emacs bug\r
+`notmuch-isearch-range-invisible' instead of the original\r
+`isearch-range-invisible' when in `notmuch-show-mode'.\r
+---\r
+ emacs/notmuch-wash.el |   67 +++++++++++++++++++++++++++++++++++++++++++++++++\r
+ 1 files changed, 67 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el\r
+index 992fa8f..f37fd95 100644\r
+--- a/emacs/notmuch-wash.el\r
++++ b/emacs/notmuch-wash.el\r
+@@ -298,4 +298,71 @@ for error."\r
\r
+ ;;\r
\r
++;; Temporary workaround for Emacs bug #8721\r
++;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8721\r
++\r
++(defun notmuch-isearch-range-invisible (beg end)\r
++  "Same as `isearch-range-invisible' but with fixed Emacs bug #8721."\r
++  (when (/= beg end)\r
++    ;; Check that invisibility runs up to END.\r
++    (save-excursion\r
++      (goto-char beg)\r
++      (let (;; can-be-opened keeps track if we can open some overlays.\r
++          (can-be-opened (eq search-invisible 'open))\r
++          ;; the list of overlays that could be opened\r
++          (crt-overlays nil))\r
++      (when (and can-be-opened isearch-hide-immediately)\r
++        (isearch-close-unnecessary-overlays beg end))\r
++      ;; If the following character is currently invisible,\r
++      ;; skip all characters with that same `invisible' property value.\r
++      ;; Do that over and over.\r
++      (while (and (< (point) end) (invisible-p (point)))\r
++        (if (get-text-property (point) 'invisible)\r
++            (progn\r
++              (goto-char (next-single-property-change (point) 'invisible\r
++                                                      nil end))\r
++              ;; if text is hidden by an `invisible' text property\r
++              ;; we cannot open it at all.\r
++              (setq can-be-opened nil))\r
++          (when can-be-opened\r
++            (let ((overlays (overlays-at (point)))\r
++                  ov-list\r
++                  o\r
++                  invis-prop)\r
++              (while overlays\r
++                (setq o (car overlays)\r
++                      invis-prop (overlay-get o 'invisible))\r
++                (if (invisible-p invis-prop)\r
++                    (if (overlay-get o 'isearch-open-invisible)\r
++                        (setq ov-list (cons o ov-list))\r
++                      ;; We found one overlay that cannot be\r
++                      ;; opened, that means the whole chunk\r
++                      ;; cannot be opened.\r
++                      (setq can-be-opened nil)))\r
++                (setq overlays (cdr overlays)))\r
++              (if can-be-opened\r
++                  ;; It makes sense to append to the open\r
++                  ;; overlays list only if we know that this is\r
++                  ;; t.\r
++                  (setq crt-overlays (append ov-list crt-overlays)))))\r
++          (goto-char (next-overlay-change (point)))))\r
++      ;; See if invisibility reaches up thru END.\r
++      (if (>= (point) end)\r
++          (if (and can-be-opened (consp crt-overlays))\r
++              (progn\r
++                (setq isearch-opened-overlays\r
++                      (append isearch-opened-overlays crt-overlays))\r
++                (mapc 'isearch-open-overlay-temporary crt-overlays)\r
++                nil)\r
++            (setq isearch-hidden t)))))))\r
++\r
++(defadvice isearch-range-invisible (around notmuch-isearch-range-invisible-advice activate)\r
++  "Call `notmuch-isearch-range-invisible' instead of the original\r
++`isearch-range-invisible' when in `notmuch-show-mode' mode."\r
++  (if (eq major-mode 'notmuch-show-mode)\r
++      (setq ad-return-value (notmuch-isearch-range-invisible beg end))\r
++    ad-do-it))\r
++\r
++;;\r
++\r
+ (provide 'notmuch-wash)\r
+-- \r
+1.7.5.1\r
+\r