Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2ADBB429E2B for ; Thu, 26 May 2011 14:47:51 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dk2bHh1ClFR9 for ; Thu, 26 May 2011 14:47:49 -0700 (PDT) Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A9227429E25 for ; Thu, 26 May 2011 14:47:48 -0700 (PDT) Received: by fxm8 with SMTP id 8so1056981fxm.26 for ; Thu, 26 May 2011 14:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=2pJyaY87yIB022fcExYvVldz4ul0TK1DjwR18/UKm4w=; b=LW1NSDwk3XmA4FL1fAABBH13+4YcPRAfg5b/GdD/+EZyo/CSz51wsDtAopOT2eBFHj aNhP2IXfQa5WTGUU8tgBpCeyx63sBx5T1J6d6c7JwOdiTPKwyiJjTd+URMYcpF+FWk0X d47fpfGtqulti7AfMfWM5lPjK8DGqhfxme0YI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; b=KvhpaagFQ9pDgHi4lQ6EmMqT2b2+vZzc47u6rgj0TByvUkEfaRJXUBvG9uKwH9PC3R x4PDlV7v1S/pZEAHnaaA/PLg38mQ234h0XnmAgJw6TOVlMAXv5baA+eKpI0qylM2eU4u /q5bsx2G42PRoVtle2PWZh4Y87ZY4mCcW5YJk= Received: by 10.223.23.143 with SMTP id r15mr1509370fab.29.1306446467393; Thu, 26 May 2011 14:47:47 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id m26sm448753fab.34.2011.05.26.14.47.46 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 14:47:46 -0700 (PDT) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: Re: [PATCH 2/2] Workaround for Emacs bug #8721. In-Reply-To: <1306445915-9474-2-git-send-email-dmitry.kurochkin@gmail.com> References: <1306361416-5019-1-git-send-email-dmitry.kurochkin@gmail.com> <1306445915-9474-1-git-send-email-dmitry.kurochkin@gmail.com> <1306445915-9474-2-git-send-email-dmitry.kurochkin@gmail.com> User-Agent: Notmuch/0.5-216-g0104e23 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 27 May 2011 01:48:10 +0400 Message-ID: <874o4hp205.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2011 21:47:51 -0000 --=-=-= On Fri, 27 May 2011 01:38:35 +0400, Dmitry Kurochkin wrote: > The patch adds `notmuch-isearch-range-invisible' function which > is the same as `isearch-range-invisible' but with fixed Emacs bug > `notmuch-isearch-range-invisible' instead of the original > `isearch-range-invisible' when in `notmuch-show-mode'. I've screwed up the commit message because of a line starting with '#'. Attach is an amended patch. Regards, Dmitry --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Workaround-for-Emacs-bug-8721.patch >From ead308fb53725d593562d7d4e3cd4aa82412aa70 Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Fri, 27 May 2011 01:35:09 +0400 Subject: [PATCH] Workaround for Emacs bug #8721. The patch adds `notmuch-isearch-range-invisible' function which is the same as `isearch-range-invisible' but with fixed Emacs bug #8721. Advice added for `isearch-range-invisible' which calls `notmuch-isearch-range-invisible' instead of the original `isearch-range-invisible' when in `notmuch-show-mode'. --- emacs/notmuch-wash.el | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 992fa8f..f37fd95 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -298,4 +298,71 @@ for error." ;; +;; Temporary workaround for Emacs bug #8721 +;; http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8721 + +(defun notmuch-isearch-range-invisible (beg end) + "Same as `isearch-range-invisible' but with fixed Emacs bug #8721." + (when (/= beg end) + ;; Check that invisibility runs up to END. + (save-excursion + (goto-char beg) + (let (;; can-be-opened keeps track if we can open some overlays. + (can-be-opened (eq search-invisible 'open)) + ;; the list of overlays that could be opened + (crt-overlays nil)) + (when (and can-be-opened isearch-hide-immediately) + (isearch-close-unnecessary-overlays beg end)) + ;; If the following character is currently invisible, + ;; skip all characters with that same `invisible' property value. + ;; Do that over and over. + (while (and (< (point) end) (invisible-p (point))) + (if (get-text-property (point) 'invisible) + (progn + (goto-char (next-single-property-change (point) 'invisible + nil end)) + ;; if text is hidden by an `invisible' text property + ;; we cannot open it at all. + (setq can-be-opened nil)) + (when can-be-opened + (let ((overlays (overlays-at (point))) + ov-list + o + invis-prop) + (while overlays + (setq o (car overlays) + invis-prop (overlay-get o 'invisible)) + (if (invisible-p invis-prop) + (if (overlay-get o 'isearch-open-invisible) + (setq ov-list (cons o ov-list)) + ;; We found one overlay that cannot be + ;; opened, that means the whole chunk + ;; cannot be opened. + (setq can-be-opened nil))) + (setq overlays (cdr overlays))) + (if can-be-opened + ;; It makes sense to append to the open + ;; overlays list only if we know that this is + ;; t. + (setq crt-overlays (append ov-list crt-overlays))))) + (goto-char (next-overlay-change (point))))) + ;; See if invisibility reaches up thru END. + (if (>= (point) end) + (if (and can-be-opened (consp crt-overlays)) + (progn + (setq isearch-opened-overlays + (append isearch-opened-overlays crt-overlays)) + (mapc 'isearch-open-overlay-temporary crt-overlays) + nil) + (setq isearch-hidden t))))))) + +(defadvice isearch-range-invisible (around notmuch-isearch-range-invisible-advice activate) + "Call `notmuch-isearch-range-invisible' instead of the original +`isearch-range-invisible' when in `notmuch-show-mode' mode." + (if (eq major-mode 'notmuch-show-mode) + (setq ad-return-value (notmuch-isearch-range-invisible beg end)) + ad-do-it)) + +;; + (provide 'notmuch-wash) -- 1.7.5.1 --=-=-=--