(defun notmuch-show-next-message ()
"Advance to the beginning of the next message in the buffer.
-Moves to the beginning of the current message if already on the
-last message in the buffer."
+Moves to the end of the buffer if already on the last message in
+the buffer."
(interactive)
(notmuch-show-move-to-current-message-summary-line)
- (re-search-forward notmuch-show-message-begin-regexp nil t)
- (notmuch-show-move-to-current-message-summary-line)
+ (if (re-search-forward notmuch-show-message-begin-regexp nil t)
+ (notmuch-show-move-to-current-message-summary-line)
+ (goto-char (point-max)))
(recenter 0))
(defun notmuch-show-find-next-message ()
(if (and (not unread)
(equal next (point)))
(notmuch-show-archive-thread)
- (if (< (notmuch-show-find-next-message) (window-end))
- (notmuch-show-mark-read-then-next-message)
- (scroll-up nil)))))
+ (if (and (> next (window-end))
+ (< next (point-max)))
+ (scroll-up nil)
+ (notmuch-show-mark-read-then-next-message)))))
(defun notmuch-show-markup-citations-region (beg end)
(goto-char beg)
"Move point to the last thread in the buffer."
(interactive "^P")
(end-of-buffer arg)
- (beginning-of-line))
+ (forward-line -1))
;;;###autoload
(defun notmuch-search-mode ()
(interactive)
(let ((thread-id (notmuch-search-find-thread-id)))
(forward-line)
- (notmuch-show thread-id (current-buffer))))
+ (if (> (length thread-id) 0)
+ (notmuch-show thread-id (current-buffer))
+ (error "End of search results"))))
(defun notmuch-call-notmuch-process (&rest args)
(let ((error-buffer (get-buffer-create "*Notmuch errors*")))
(save-excursion
(call-process "notmuch" nil t nil "search" query)
(notmuch-search-markup-thread-ids)
- ; A well-behaved program ends its output with a newline, but we
- ; don't actually want the blank line at the end of the file.
- (goto-char (point-max))
- (if (looking-at "^$")
- (delete-backward-char 1)
- )
))))
(defun notmuch-search-refresh-view ()