emacs: improve hidden signatures handling in notmuch-show-advance-and-archive

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.
This commit is contained in:
Dmitry Kurochkin 2011-11-06 13:03:59 +04:00 committed by David Bremner
parent 9689656351
commit 6e6cb68b80
2 changed files with 9 additions and 9 deletions

View file

@ -1152,17 +1152,18 @@ thread, (remove the \"inbox\" tag from each message). Also kill
this buffer, and display the next thread from the search from this buffer, and display the next thread from the search from
which this thread was originally shown." which this thread was originally shown."
(interactive) (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 (cond
;; Ideally we would test `end-of-this-message' against the result ;; Ideally we would test `end-of-this-message' against the result
;; of `window-end', but that doesn't account for the fact that ;; 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 ;; the end of the message might be hidden.
;; go to the end, walk back over invisible text and then see if ((and visible-end-of-this-message
;; point is visible. (> visible-end-of-this-message (window-end)))
((save-excursion
(goto-char (- end-of-this-message 1))
(notmuch-show-move-past-invisible-backward)
(> (point) (window-end)))
;; The bottom of this message is not visible - scroll. ;; The bottom of this message is not visible - scroll.
(scroll-up nil)) (scroll-up nil))

View file

@ -369,7 +369,6 @@ test_emacs "(notmuch-show \"id:$id\") \
test_expect_equal_file OUTPUT EXPECTED test_expect_equal_file OUTPUT EXPECTED
test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature' test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
test_subtest_known_broken
message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu' message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net' message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
test_emacs "(notmuch-search \"$message1 or $message2\") test_emacs "(notmuch-search \"$message1 or $message2\")