aboutsummaryrefslogtreecommitdiffhomepage
path: root/notmuch.el
diff options
context:
space:
mode:
authorGravatar Carl Worth <cworth@cworth.org>2009-11-03 11:54:34 -0800
committerGravatar Carl Worth <cworth@cworth.org>2009-11-03 11:54:34 -0800
commit6be03c1761b0b586f7b52bb394131e34fe7534be (patch)
tree4582cc39a03ad991f790a7fd98251e953d238c0f /notmuch.el
parent2d507c9c6db9188b3574f7d50144a918d26b3bb1 (diff)
notmuch.el: Preserve current thread when refreshing search results.
Otherwise, try to keep point in the same place, (such as when the current thread has been archived away).
Diffstat (limited to 'notmuch.el')
-rw-r--r--notmuch.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/notmuch.el b/notmuch.el
index c00d3595..a7e334e4 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -420,11 +420,20 @@ Before moving, also remove the \"unread\" tag from the current message."
"Refresh the current view.
Kills the current buffer and runs a new search with the same
-query string as the current search."
+query string as the current search. If the current thread is in
+the new search results, then point will be placed on the same
+thread. Otherwise, point will be moved to attempt to be in the
+same relative position within the new buffer."
(interactive)
- (let ((query notmuch-search-query-string))
+ (let ((here (point))
+ (thread (notmuch-search-find-thread-id))
+ (query notmuch-search-query-string))
(kill-this-buffer)
- (notmuch-search query)))
+ (notmuch-search query)
+ (goto-char (point-min))
+ (if (re-search-forward (concat "^" thread) nil t)
+ (beginning-of-line)
+ (goto-char here))))
(defun notmuch-search-filter (query)
"Run \"notmuch search\" to refine the current search results.