mu4e-update: save last update results in *mu4e-last-update*
This can be useful for diagnosis. Fixes #2455
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
;;; mu4e-update.el -- part of mu4e, -*- lexical-binding: t -*-
|
;;; mu4e-update.el -- part of mu4e, -*- lexical-binding: t -*-
|
||||||
|
|
||||||
;; Copyright (C) 2011-2022 Dirk-Jan C. Binnema
|
;; Copyright (C) 2011-2023 Dirk-Jan C. Binnema
|
||||||
|
|
||||||
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
;; Author: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
;; Maintainer: Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||||
@ -131,15 +131,18 @@ If non-nil, this is a plist of the form:
|
|||||||
:cleaned-up <number of stale messages removed from store
|
:cleaned-up <number of stale messages removed from store
|
||||||
:stamp <emacs (current-time) timestamp for the status)")
|
:stamp <emacs (current-time) timestamp for the status)")
|
||||||
|
|
||||||
|
(defconst mu4e-last-update-buffer "*mu4e-last-update*"
|
||||||
|
"Name of buffer with cloned from the last update buffer.
|
||||||
|
Useful for diagnosing update problems.")
|
||||||
|
|
||||||
|
|
||||||
;;; Internal variables
|
;;; Internal variables / const
|
||||||
|
(defconst mu4e--update-name " *mu4e-update*"
|
||||||
|
"Name of the process and buffer to update mail.")
|
||||||
(defvar mu4e--progress-reporter nil
|
(defvar mu4e--progress-reporter nil
|
||||||
"Internal, the progress reporter object.")
|
"Internal, the progress reporter object.")
|
||||||
(defvar mu4e--update-timer nil
|
(defvar mu4e--update-timer nil
|
||||||
"The mu4e update timer.")
|
"The mu4e update timer.")
|
||||||
(defconst mu4e--update-name " *mu4e-update*"
|
|
||||||
"Name of the process and buffer to update mail.")
|
|
||||||
(defconst mu4e--update-buffer-height 8
|
(defconst mu4e--update-buffer-height 8
|
||||||
"Height of the mu4e message retrieval/update buffer.")
|
"Height of the mu4e message retrieval/update buffer.")
|
||||||
(defvar mu4e--get-mail-ask-password "mu4e get-mail: Enter password: "
|
(defvar mu4e--get-mail-ask-password "mu4e get-mail: Enter password: "
|
||||||
@ -225,6 +228,7 @@ To override this behavior, customize `display-buffer-alist'."
|
|||||||
(display-buffer buf `(display-buffer-at-bottom
|
(display-buffer buf `(display-buffer-at-bottom
|
||||||
(preserve-size . (nil . t))
|
(preserve-size . (nil . t))
|
||||||
(height . ,height)
|
(height . ,height)
|
||||||
|
(inhibit-same-window . t)
|
||||||
(window-height . fit-window-to-buffer)))
|
(window-height . fit-window-to-buffer)))
|
||||||
(set-window-buffer (get-buffer-window buf) buf))
|
(set-window-buffer (get-buffer-window buf) buf))
|
||||||
|
|
||||||
@ -245,7 +249,14 @@ To override this behavior, customize `display-buffer-alist'."
|
|||||||
(mu4e-update-index)))
|
(mu4e-update-index)))
|
||||||
(mu4e-update-index))
|
(mu4e-update-index))
|
||||||
(when (buffer-live-p mu4e--update-buffer)
|
(when (buffer-live-p mu4e--update-buffer)
|
||||||
(delete-windows-on mu4e--update-buffer t)
|
(delete-windows-on mu4e--update-buffer)
|
||||||
|
;; clone the update buffer for diagnosis
|
||||||
|
(when (get-buffer mu4e-last-update-buffer)
|
||||||
|
(kill-buffer mu4e-last-update-buffer))
|
||||||
|
(with-current-buffer mu4e--update-buffer
|
||||||
|
(clone-buffer mu4e-last-update-buffer))
|
||||||
|
;; and kill the buffer itself; the cloning is needed
|
||||||
|
;; so the temp window handling works as expected.
|
||||||
(kill-buffer mu4e--update-buffer)))
|
(kill-buffer mu4e--update-buffer)))
|
||||||
|
|
||||||
;; complicated function, as it:
|
;; complicated function, as it:
|
||||||
@ -259,7 +270,7 @@ RUN-IN-BACKGROUND is non-nil (or called with prefix-argument),
|
|||||||
run in the background; otherwise, pop up a window."
|
run in the background; otherwise, pop up a window."
|
||||||
(let* ((process-connection-type t)
|
(let* ((process-connection-type t)
|
||||||
(proc (start-process-shell-command
|
(proc (start-process-shell-command
|
||||||
"mu4e-update" mu4e--update-name
|
mu4e--update-name mu4e--update-name
|
||||||
mu4e-get-mail-command))
|
mu4e-get-mail-command))
|
||||||
(buf (process-buffer proc))
|
(buf (process-buffer proc))
|
||||||
(win (or run-in-background
|
(win (or run-in-background
|
||||||
|
|||||||
@ -507,6 +507,9 @@ before the changes take effect. By default, this will run in
|
|||||||
background and to change it to run in foreground, set
|
background and to change it to run in foreground, set
|
||||||
@code{mu4e-index-update-in-background} to @code{nil}.
|
@code{mu4e-index-update-in-background} to @code{nil}.
|
||||||
|
|
||||||
|
After updating has completed, @t{mu4e} keeps the output in a buffer
|
||||||
|
@t{*mu4e-last-update*}, which you can use for diagnosis if needed.
|
||||||
|
|
||||||
@subsection Handling errors during mail retrieval
|
@subsection Handling errors during mail retrieval
|
||||||
|
|
||||||
If the mail-retrieval process returns with a non-zero exit code,
|
If the mail-retrieval process returns with a non-zero exit code,
|
||||||
|
|||||||
Reference in New Issue
Block a user