unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 4/6] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive
Date: Wed, 29 Jun 2011 23:42:36 +0400	[thread overview]
Message-ID: <1309376558-26284-4-git-send-email-dmitry.kurochkin@gmail.com> (raw)
In-Reply-To: <1309376558-26284-1-git-send-email-dmitry.kurochkin@gmail.com>

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

  parent reply	other threads:[~2011-06-29 19:42 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 19:42 [PATCH 1/6] test: run emacs inside screen Dmitry Kurochkin
2011-06-29 19:42 ` [PATCH 2/6] test: do not set frame width in emacs Dmitry Kurochkin
2011-06-29 19:42 ` [PATCH 3/6] test: `notmuch-show-advance-and-archive' with invisible signature Dmitry Kurochkin
2011-06-29 19:42 ` Dmitry Kurochkin [this message]
2011-06-29 19:42 ` [PATCH 5/6] emacs: remove no longer used functions from notmuch-show.el Dmitry Kurochkin
2011-06-29 19:42 ` [PATCH 6/6] emacs: remove unused `point-invisible-p' function Dmitry Kurochkin
2011-06-29 20:16 ` [PATCH 1/6] test: run emacs inside screen Jim Paris
2011-06-29 21:27   ` Dmitry Kurochkin
2011-06-29 21:26 ` [PATCH] test: avoid using screen(1) configuration files Dmitry Kurochkin
2011-07-01  4:55 ` [PATCH v2 0/7] advance-and-archive bugfix, run emacs inside screen Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 1/7] test: " Dmitry Kurochkin
2011-07-20 12:36     ` [PATCH] test: run emacs inside tmux if screen is not available Thomas Jost
2011-07-20 13:37       ` Dmitry Kurochkin
2011-07-20 17:28         ` Jameson Graef Rollins
2011-07-20 18:12           ` Thomas Jost
2011-07-20 18:25             ` Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 2/7] test: avoid using screen(1) configuration files Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 3/7] test: do not set frame width in emacs Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 4/7] test: `notmuch-show-advance-and-archive' with invisible signature Dmitry Kurochkin
2011-11-06  1:06     ` David Bremner
2011-11-06  9:02       ` Dmitry Kurochkin
2011-11-06  9:03         ` [PATCH v3 1/4] " Dmitry Kurochkin
2011-11-06  9:03           ` [PATCH v3 2/4] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive Dmitry Kurochkin
2011-11-06  9:04           ` [PATCH v3 3/4] emacs: remove no longer used functions from notmuch-show.el Dmitry Kurochkin
2011-11-06  9:04           ` [PATCH v3 4/4] emacs: remove unused `point-invisible-p' function Dmitry Kurochkin
2011-11-08  0:50         ` [PATCH v2 4/7] test: `notmuch-show-advance-and-archive' with invisible signature David Bremner
2011-07-01  4:55   ` [PATCH v2 5/7] emacs: improve hidden signatures handling in notmuch-show-advance-and-archive Dmitry Kurochkin
2011-09-07  9:13     ` Jani Nikula
2011-09-07 11:09       ` Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 6/7] emacs: remove no longer used functions from notmuch-show.el Dmitry Kurochkin
2011-07-01  4:55   ` [PATCH v2 7/7] emacs: remove unused `point-invisible-p' function Dmitry Kurochkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1309376558-26284-4-git-send-email-dmitry.kurochkin@gmail.com \
    --to=dmitry.kurochkin@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).