mu4e-view: use with-selected-window in mv--in-headers-context

Fixed #1394
This commit is contained in:
Dirk-Jan C. Binnema 2023-01-18 20:32:34 +02:00
parent ae10d3a3f8
commit c23dad7058
1 changed files with 16 additions and 16 deletions

View File

@ -158,22 +158,22 @@ Then, display the results."
(with-current-buffer buffer (with-current-buffer buffer
;; make sure to select the window, or jumping won't ;; make sure to select the window, or jumping won't
;; be reflected. ;; be reflected.
(select-window (get-buffer-window)) (with-selected-window (get-buffer-window)
(if (or (mu4e~headers-goto-docid docid) (if (or (mu4e~headers-goto-docid docid)
;; TODO: Is this the best way to find another ;; TODO: Is this the best way to find another
;; relevant docid for a view buffer? ;; relevant docid for a view buffer?
;; ;;
;; If you attach a view buffer to another headers ;; If you attach a view buffer to another headers
;; buffer that does not contain the current docid ;; buffer that does not contain the current docid
;; then `mu4e~headers-goto-docid' returns nil and we ;; then `mu4e~headers-goto-docid' returns nil and we
;; get an error. This "hack" instead gets its ;; get an error. This "hack" instead gets its
;; now-changed headers buffer's current message as a ;; now-changed headers buffer's current message as a
;; docid ;; docid
(mu4e~headers-goto-docid (mu4e~headers-goto-docid
(with-current-buffer buffer (with-current-buffer buffer
(mu4e-message-field (mu4e-message-at-point) :docid)))) (mu4e-message-field (mu4e-message-at-point) :docid))))
,@body ,@body
(mu4e-error "Cannot find message in headers buffer")))))) (mu4e-error "Cannot find message in headers buffer")))))))
(defun mu4e-view-headers-next (&optional n) (defun mu4e-view-headers-next (&optional n)
"Move point to the next message header. "Move point to the next message header.