From 15f857afccde2aefc1313d40d74a2c84dd6302bb Mon Sep 17 00:00:00 2001 From: djcb Date: Wed, 16 Mar 2016 01:11:11 +0200 Subject: [PATCH] mu4e: try to jump to same message after re-search After a re-search, perhaps after toggling threading etc., try to move point to the same message it was before --- mu4e/mu4e-headers.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index f29585b5..067ba533 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -1494,7 +1494,10 @@ window. " (defun mu4e-headers-rerun-search () "Rerun the search for the last search expression." (interactive) - (mu4e-headers-search mu4e~headers-last-query)) + ;; if possible, try to return to the same message + (let* ((msg (mu4e-message-at-point)) + (msgid (and msg (mu4e-message-field msg :message-id)))) + (mu4e-headers-search mu4e~headers-last-query nil nil t msgid))) (defun mu4e~headers-query-navigate (whence) "Execute the previous query from the query stacks.