From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id ECE29421192 for ; Thu, 30 Jun 2011 21:55:47 -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 khfKDcoss+sj for ; Thu, 30 Jun 2011 21:55:47 -0700 (PDT) Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 4B7CE42118E for ; Thu, 30 Jun 2011 21:55:47 -0700 (PDT) Received: by mail-bw0-f53.google.com with SMTP id 12so2682445bwg.26 for ; Thu, 30 Jun 2011 21:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=zrHA+ifthfgHP+Ej3ABOoqO+3pgC7SAtL5YSWWNUxmo=; b=A+dL8kwcqm0XvqEgM73jnGTOTLE8T3Aq/ZbMr6HzWP2w5fEd0gv4I3A63ku9JkAK5n 1VrgIxhcZOrEVCNCVA1JRoI3GFjxEzinvBaRxChgVUgih3ZhjVFHZHyVXG/v+d+qlSwO 1RWDQDDd3K6BZqnLxadcD0N0qDZZi/XqZSYtw= Received: by 10.204.144.194 with SMTP id a2mr2531882bkv.93.1309496146950; Thu, 30 Jun 2011 21:55:46 -0700 (PDT) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id o3sm2651725bka.12.2011.06.30.21.55.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Jun 2011 21:55:46 -0700 (PDT) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH v2 5/7] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive Date: Fri, 1 Jul 2011 08:55:20 +0400 Message-Id: <1309496122-4965-6-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1309496122-4965-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1309376558-26284-1-git-send-email-dmitry.kurochkin@gmail.com> <1309496122-4965-1-git-send-email-dmitry.kurochkin@gmail.com> 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: Fri, 01 Jul 2011 04:55:48 -0000 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 6685717..ad3cc7b 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1113,17 +1113,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.5.4