mu4e-headers: clear view message when clearing headers

This avoids showing an old message when clicking an empty headers
buffer.

Fixes #2299.
This commit is contained in:
Dirk-Jan C. Binnema 2022-07-16 16:56:55 +03:00
parent b64e0b3194
commit d62fc66104
1 changed files with 7 additions and 5 deletions

View File

@ -348,17 +348,19 @@ This is mostly useful for profiling.")
;;; Clear ;;; Clear
(defun mu4e~headers-clear (&optional msg) (defun mu4e~headers-clear (&optional text)
"Clear the header buffer and related data structures." "Clear the headers buffer and related data structures.
Optionally, show TEXT."
(when (buffer-live-p (mu4e-get-headers-buffer)) (when (buffer-live-p (mu4e-get-headers-buffer))
(setq mu4e~headers-render-start (float-time)) (setq mu4e~headers-render-start (float-time)
mu4e~view-message nil)
(let ((inhibit-read-only t)) (let ((inhibit-read-only t))
(with-current-buffer (mu4e-get-headers-buffer) (with-current-buffer (mu4e-get-headers-buffer)
(mu4e--mark-clear) (mu4e--mark-clear)
(erase-buffer) (erase-buffer)
(when msg (when text
(goto-char (point-min)) (goto-char (point-min))
(insert (propertize msg 'face 'mu4e-system-face 'intangible t))))))) (insert (propertize text 'face 'mu4e-system-face 'intangible t)))))))
;;; Misc ;;; Misc