emacs: Fix notmuch-show-next-open-message.

This function was still implemented in terms of the old, global toggle
for visibility of unread messages, (which no longer exists). Fix it to
use the local 'invisibility-spec property on the button controlling
message visibility.
This commit is contained in:
Carl Worth 2009-12-03 07:37:40 -08:00
parent 48a1b8b006
commit e1f05f1c20

View file

@ -411,19 +411,32 @@ by searching backward)."
"Predicate testing whether current message is unread." "Predicate testing whether current message is unread."
(member "unread" (notmuch-show-get-tags))) (member "unread" (notmuch-show-get-tags)))
(defun notmuch-show-message-open-p ()
"Predicate testing whether current message is open (body is visible)."
(let ((btn (previous-button (point) t)))
(while (not (button-has-type-p btn 'notmuch-button-body-toggle-type))
(setq btn (previous-button (button-start btn))))
(not (invisible-p (button-get btn 'invisibility-spec)))))
(defun notmuch-show-next-message () (defun notmuch-show-next-message ()
"Advance to the beginning of the next message in the buffer. "Advance to the beginning of the next message in the buffer.
Moves to the last visible character of the current message if Moves to the last visible character of the current message if
already on the last message in the buffer." already on the last message in the buffer.
Returns nil if already on the last message in the buffer."
(interactive) (interactive)
(notmuch-show-move-to-current-message-summary-line) (notmuch-show-move-to-current-message-summary-line)
(if (re-search-forward notmuch-show-message-begin-regexp nil t) (if (re-search-forward notmuch-show-message-begin-regexp nil t)
(notmuch-show-move-to-current-message-summary-line) (progn
(notmuch-show-move-to-current-message-summary-line)
(recenter 0)
t)
(goto-char (- (point-max) 1)) (goto-char (- (point-max) 1))
(while (point-invisible-p) (while (point-invisible-p)
(backward-char))) (backward-char))
(recenter 0)) (recenter 0)
nil))
(defun notmuch-show-find-next-message () (defun notmuch-show-find-next-message ()
"Returns the position of the next message in the buffer. "Returns the position of the next message in the buffer.
@ -451,14 +464,9 @@ there are no more unread messages past the current point."
(notmuch-show-next-message))) (notmuch-show-next-message)))
(defun notmuch-show-next-open-message () (defun notmuch-show-next-open-message ()
"Advance to the next message which is not hidden. "Advance to the next open message (that is, body is not invisible)."
(while (and (notmuch-show-next-message)
If read messages are currently hidden, advance to the next unread (not (notmuch-show-message-open-p)))))
message. Otherwise, advance to the next message."
(if (or (memq 'notmuch-show-body-read buffer-invisibility-spec)
(assq 'notmuch-show-body-read buffer-invisibility-spec))
(notmuch-show-next-unread-message)
(notmuch-show-next-message)))
(defun notmuch-show-previous-message () (defun notmuch-show-previous-message ()
"Backup to the beginning of the previous message in the buffer. "Backup to the beginning of the previous message in the buffer.