X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=fd1836f1a83555edaa14fb5e214df96c8c00d6e2;hb=5d0883ea1bf5419589ba27c12994c36495f89255;hp=d09252828f6b063300308adef096ff674a716e00;hpb=90e741ef81668d9b7db62b57e9a0c88877e2631e;p=obsolete%2Fnotmuch-old diff --git a/emacs/notmuch.el b/emacs/notmuch.el index d0925282..fd1836f1 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -293,18 +293,25 @@ For a mouse binding, return nil." (defun notmuch-search-next-thread () "Select the next thread in the search results." (interactive) - (forward-line 1)) + (when (notmuch-search-get-result (notmuch-search-result-end)) + (goto-char (notmuch-search-result-end)))) (defun notmuch-search-previous-thread () "Select the previous thread in the search results." (interactive) - (forward-line -1)) + (if (notmuch-search-get-result) + (unless (bobp) + (goto-char (notmuch-search-result-beginning (- (point) 1)))) + ;; We must be past the end; jump to the last result + (notmuch-search-last-thread))) (defun notmuch-search-last-thread () "Select the last thread in the search results." (interactive) (goto-char (point-max)) - (forward-line -2)) + (forward-line -2) + (let ((beg (notmuch-search-result-beginning))) + (when beg (goto-char beg)))) (defun notmuch-search-first-thread () "Select the first thread in the search results."