From 1525d350a8c4a89463887c056a6c5a7b76a143d7 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 6 Apr 2026 11:26:27 +0300 Subject: [PATCH] mu4e-headers: fix mu4e--in-headers-context Two problems: 1) In mu4e--in-headers-context we went through the whole dance of finding the headers buffer even if we were already there. That's unnecessary and incidentally makes it impossible to go back from the "Found ..." line in the headers-buf to the previous one. Fixes #2913 2) We didn't handle the case where there _is_ no headers window, such as when in single-window mode. --- mu4e/mu4e-headers.el | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 898d87bc..a3834018 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -900,15 +900,17 @@ COUNT is the number of messages found." If we're already in the headers buffer/window, do nothing. If we're in the message view, temporarily switch." - `(progn + `(if (eq major-mode 'mu4e-headers-mode) + (progn ,@body) (let* ((msg (mu4e-message-at-point)) (buffer (mu4e-get-headers-buffer)) (docid (mu4e-message-field msg :docid))) (unless (and buffer msg docid) (mu4e-error "Action is not possible")) - ;; make sure to select the window if possible, or jumping won't be - ;; reflected. - (with-selected-window (get-buffer-window buffer) + ;; Select the window if possible, or jumping won't be reflected. + ;; Note: in single-window mode the headers buffer is probably not + ;; visible; in that case, fall back to the selected window. + (with-selected-window (or (get-buffer-window buffer) (selected-window)) (with-current-buffer buffer (mu4e-thread-unfold-all) (if (or (mu4e~headers-goto-docid docid)