From dd9c73bb8ac9d7aa8002c45681d105f630cb6530 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 17 Apr 2026 23:35:40 +0300 Subject: [PATCH] mu4e-headers: restore view-win in search exec We must restore the view-win from the correct context (i.e.: the headers-buffer/window) Fixes #2920. --- mu4e/mu4e-headers.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index ba27c9ce..f629cc67 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -802,17 +802,16 @@ to t before \"automatic\" searches.") Switch to the output buffer for the results." (let* ((buf (mu4e-get-headers-buffer nil t)) - (view-window mu4e~headers-view-win) (inhibit-read-only t) (maxnum (unless mu4e-search-full mu4e-search-results-limit))) (with-current-buffer buf - ;; NOTE: this resets all buffer-local variables, including - ;; `mu4e~headers-view-win', which may have a live window if the - ;; headers buffer already exists when `mu4e-get-headers-buffer' - ;; is called. - (mu4e-headers-mode) - (setq mu4e~headers-view-win view-window - list-buffers-directory expr) + ;; NOTE: `mu4e-headers-mode' resets all buffer-local variables, including + ;; `mu4e~headers-view-win', which may have a live window if the headers + ;; buffer already existed. Save & restore after the mode reset. + (let ((view-window mu4e~headers-view-win)) + (mu4e-headers-mode) + (setq mu4e~headers-view-win view-window + list-buffers-directory expr)) (mu4e--modeline-update)) ;; For interactive searches, display the buffer if not already visible; for