From c23dad70586bbb54891c506629f2ce2ed8e463d2 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Wed, 18 Jan 2023 20:32:34 +0200 Subject: [PATCH] mu4e-view: use with-selected-window in mv--in-headers-context Fixed #1394 --- mu4e/mu4e-view.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el index 9286da9b..a3f92470 100644 --- a/mu4e/mu4e-view.el +++ b/mu4e/mu4e-view.el @@ -158,22 +158,22 @@ Then, display the results." (with-current-buffer buffer ;; make sure to select the window, or jumping won't ;; be reflected. - (select-window (get-buffer-window)) - (if (or (mu4e~headers-goto-docid docid) - ;; TODO: Is this the best way to find another - ;; relevant docid for a view buffer? - ;; - ;; If you attach a view buffer to another headers - ;; buffer that does not contain the current docid - ;; then `mu4e~headers-goto-docid' returns nil and we - ;; get an error. This "hack" instead gets its - ;; now-changed headers buffer's current message as a - ;; docid - (mu4e~headers-goto-docid - (with-current-buffer buffer - (mu4e-message-field (mu4e-message-at-point) :docid)))) - ,@body - (mu4e-error "Cannot find message in headers buffer")))))) + (with-selected-window (get-buffer-window) + (if (or (mu4e~headers-goto-docid docid) + ;; TODO: Is this the best way to find another + ;; relevant docid for a view buffer? + ;; + ;; If you attach a view buffer to another headers + ;; buffer that does not contain the current docid + ;; then `mu4e~headers-goto-docid' returns nil and we + ;; get an error. This "hack" instead gets its + ;; now-changed headers buffer's current message as a + ;; docid + (mu4e~headers-goto-docid + (with-current-buffer buffer + (mu4e-message-field (mu4e-message-at-point) :docid)))) + ,@body + (mu4e-error "Cannot find message in headers buffer"))))))) (defun mu4e-view-headers-next (&optional n) "Move point to the next message header.