From 18efe9a955a53ebe617a5f8a6fb5530db3efc926 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Thu, 30 Nov 2023 21:33:02 +0200 Subject: [PATCH] mu4e-compose: improve mu4e-message-kill-buffer Try to go back to the buffer we were in before. HT: @thierryvolpiatto Fixes #2600. --- mu4e/mu4e-compose.el | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-compose.el b/mu4e/mu4e-compose.el index ca2e67dd..cd3e3a7c 100644 --- a/mu4e/mu4e-compose.el +++ b/mu4e/mu4e-compose.el @@ -458,15 +458,13 @@ appropriate flag at the message forwarded or replied-to." It attempts to restore some mu4e window layout after killing the compose-buffer." (interactive) - (let ((win (selected-window)) - (view (mu4e-get-view-buffer)) + (let ((view (save-selected-window (mu4e-get-view-buffer))) (hdrs (mu4e-get-headers-buffer))) (message-kill-buffer) - (when (window-live-p win) (delete-window win)) - ;; try to go back to some mu window if its live; otherwise do nothing. - (if (and (buffer-live-p view) (window-live-p (get-buffer-window view))) + ;; try to go back to some mu window if it is live; otherwise do nothing. + (if (buffer-live-p view) (switch-to-buffer view) - (when (and (buffer-live-p hdrs) (window-live-p (get-buffer-window hdrs))) + (when (and (buffer-live-p hdrs)) (switch-to-buffer hdrs))))) ;;; Crypto