X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-show.el;h=2c0b767f6964f39d93f04006126ba07823a16fca;hb=94250ac2c59c899812ebc64a6c437c74ff08af30;hp=30b26d1f998ed8d4b325114599b2d03b7ef39173;hpb=075d7df01ea736bfc6071a002c356a6f3119079d;p=notmuch diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 30b26d1f..2c0b767f 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1075,7 +1075,7 @@ function is used." (run-hooks 'notmuch-show-hook)) ;; Set the header line to the subject of the first message. - (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-pretty-subject))))) + (setq header-line-format (notmuch-show-strip-re (notmuch-show-get-subject))))) (defun notmuch-show-capture-state () "Capture the state of the current buffer. @@ -1375,9 +1375,6 @@ current thread." (defun notmuch-show-get-depth () (notmuch-show-get-prop :depth)) -(defun notmuch-show-get-pretty-subject () - (notmuch-prettify-subject (notmuch-show-get-subject))) - (defun notmuch-show-set-tags (tags) "Set the tags of the current message." (notmuch-show-set-prop :tags tags) @@ -1571,6 +1568,11 @@ to show, nil otherwise." (notmuch-show-message-adjust)) (goto-char (point-max))))) +(defun notmuch-show-open-if-matched () + "Open a message if it is matched (whether or not excluded)." + (let ((props (notmuch-show-get-message-properties))) + (notmuch-show-message-visible props (plist-get props :match)))) + (defun notmuch-show-goto-first-wanted-message () "Move to the first open message and mark it read" (goto-char (point-min)) @@ -1578,9 +1580,14 @@ to show, nil otherwise." (notmuch-show-mark-read) (notmuch-show-next-open-message)) (when (eobp) + ;; There are no matched non-excluded messages so open all matched + ;; (necessarily excluded) messages and go to the first. + (notmuch-show-mapc 'notmuch-show-open-if-matched) + (force-window-update) (goto-char (point-min)) - (unless (notmuch-show-get-prop :match) - (notmuch-show-next-matching-message)))) + (if (notmuch-show-message-visible-p) + (notmuch-show-mark-read) + (notmuch-show-next-open-message)))) (defun notmuch-show-previous-open-message () "Show the previous open message."