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 CFB05429E21 for ; Mon, 3 Oct 2011 09:48:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.1 X-Spam-Level: X-Spam-Status: No, score=-0.1 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1] 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 OEUc4UGK-ft7 for ; Mon, 3 Oct 2011 09:48:50 -0700 (PDT) Received: from ks3536.kimsufi.com (schnouki.net [87.98.217.222]) by olra.theworths.org (Postfix) with ESMTP id C3FF5429E31 for ; Mon, 3 Oct 2011 09:48:45 -0700 (PDT) Received: from localhost.localdomain (thor.loria.fr [152.81.12.250]) by ks3536.kimsufi.com (Postfix) with ESMTPSA id 04A216A06B8; Mon, 3 Oct 2011 18:48:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=schnouki.net; s=key-schnouki; t=1317660525; bh=NWktp7w6Mzv00xxJfg3hj5/SEYp8AH6BAxhGmEoQWnw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: In-Reply-To:References; b=HLwZUrJ+R+OtteepHIM9MszIv5lcLdTkFNo9Gj769xxWKcDoKMwesnhb5BKYvZk0B q/9/FDXGzgDFOXJk+sZVqDw6hMBTGDaqDUZ8dJ6Zcggl7ksVomg8iEwNXuqhyRvWGr 6VGmOxcPkG2POxwOHSzdMILj6JBPpVSaj+JbAJa0= From: Thomas Jost To: notmuch@notmuchmail.org Subject: [PATCH 10/13] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive Date: Mon, 3 Oct 2011 18:47:24 +0200 Message-Id: <1317660447-27520-11-git-send-email-schnouki@schnouki.net> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1317660447-27520-1-git-send-email-schnouki@schnouki.net> References: <1317660447-27520-1-git-send-email-schnouki@schnouki.net> In-Reply-To: <871uuuywtt.fsf@convex-new.cs.unb.ca> References: <871uuuywtt.fsf@convex-new.cs.unb.ca> 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: Mon, 03 Oct 2011 16:48:51 -0000 From: Dmitry Kurochkin Use `previous-single-char-property-change' instead of going through each character by hand and testing it's visibility. This fixes `notmuch-show-advance-and-archive' to work for the last message in thread with hidden signature. --- emacs/notmuch-show.el | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 90f9af7..bf267e8 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1106,17 +1106,18 @@ thread, (remove the \"inbox\" tag from each message). Also kill this buffer, and display the next thread from the search from which this thread was originally shown." (interactive) - (let ((end-of-this-message (notmuch-show-message-bottom))) + (let* ((end-of-this-message (notmuch-show-message-bottom)) + (visible-end-of-this-message (1- end-of-this-message))) + (while (invisible-p visible-end-of-this-message) + (setq visible-end-of-this-message + (previous-single-char-property-change visible-end-of-this-message + 'invisible))) (cond ;; Ideally we would test `end-of-this-message' against the result ;; of `window-end', but that doesn't account for the fact that - ;; the end of the message might be hidden, so we have to actually - ;; go to the end, walk back over invisible text and then see if - ;; point is visible. - ((save-excursion - (goto-char (- end-of-this-message 1)) - (notmuch-show-move-past-invisible-backward) - (> (point) (window-end))) + ;; the end of the message might be hidden. + ((and visible-end-of-this-message + (> visible-end-of-this-message (window-end))) ;; The bottom of this message is not visible - scroll. (scroll-up nil)) -- 1.7.6.4