mirror of https://github.com/djcb/mu.git
* mu4e/mu4e-main.el (mu4e-interrupt-update-mail): New function to stop update process.(SIGINT) (mu4e~main-view): Use it and bind it to S.
* mu4e/mu4e-utils.el (mu4e-update-mail-and-index): Fix Window and buffer process.
This commit is contained in:
parent
7472a3bb07
commit
8da15dc8f2
|
@ -47,6 +47,7 @@
|
|||
|
||||
;;
|
||||
(define-key map "U" 'mu4e-update-mail-and-index)
|
||||
(define-key map "S" 'mu4e-interrupt-update-mail)
|
||||
(define-key map (kbd "C-S-u") 'mu4e-update-mail-and-index)
|
||||
|
||||
|
||||
|
@ -134,7 +135,8 @@ clicked."
|
|||
|
||||
(mu4e~main-action-str "\t* [U]pdate email & database\n"
|
||||
'mu4e-update-mail-show-window)
|
||||
|
||||
(mu4e~main-action-str "\t* [S]top update email\n"
|
||||
'mu4e-interrupt-update-mail)
|
||||
;; show the queue functions if `smtpmail-queue-dir' is defined
|
||||
(if (file-directory-p smtpmail-queue-dir)
|
||||
(concat
|
||||
|
@ -152,6 +154,11 @@ clicked."
|
|||
(mu4e-main-mode)
|
||||
(switch-to-buffer buf))))
|
||||
|
||||
(defun mu4e-interrupt-update-mail ()
|
||||
(interactive)
|
||||
(interrupt-process (get-buffer-process
|
||||
(get-buffer mu4e--update-buffer-name)) t))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Interactive functions
|
||||
(defun mu4e~main-toggle-mail-sending-mode ()
|
||||
|
|
|
@ -797,6 +797,7 @@ The messages are inserted into the process buffer."
|
|||
;; - needs to check for errors
|
||||
;; - (optionally) pop-up a window
|
||||
;; - (optionally) check password requests
|
||||
(defvar mu4e--update-buffer-name nil)
|
||||
(defun mu4e-update-mail-and-index (run-in-background)
|
||||
"Get a new mail by running `mu4e-get-mail-command'. If
|
||||
run-in-background is non-nil (or called with prefix-argument), run
|
||||
|
@ -804,20 +805,17 @@ in the background; otherwise, pop up a window."
|
|||
(interactive "P")
|
||||
(unless mu4e-get-mail-command
|
||||
(mu4e-error "`mu4e-get-mail-command' is not defined"))
|
||||
(let* ((buf (unless run-in-background
|
||||
(get-buffer-create mu4e~update-name)))
|
||||
(win (and buf (split-window (selected-window)
|
||||
(- (window-height (selected-window)) 8))))
|
||||
(process-connection-type t)
|
||||
(proc (start-process-shell-command
|
||||
mu4e~update-name buf mu4e-get-mail-command)))
|
||||
(let* ((process-connection-type t)
|
||||
(proc (start-process-shell-command
|
||||
"mu4e-update" mu4e~update-name
|
||||
mu4e-get-mail-command))
|
||||
(buf (process-buffer proc)))
|
||||
(setq mu4e--update-buffer-name (buffer-name buf))
|
||||
(when (not run-in-background)
|
||||
(pop-to-buffer buf)
|
||||
(special-mode)
|
||||
(set-window-dedicated-p (selected-window) t))
|
||||
(mu4e-index-message "Retrieving mail...")
|
||||
(when (window-live-p win)
|
||||
(with-selected-window win
|
||||
(switch-to-buffer buf)
|
||||
(set-window-dedicated-p win t)
|
||||
(erase-buffer)
|
||||
(insert "\n"))) ;; FIXME -- needed so output starts
|
||||
(set-process-sentinel proc
|
||||
(lambda (proc msg)
|
||||
(let* ((status (process-status proc))
|
||||
|
@ -831,7 +829,8 @@ in the background; otherwise, pop up a window."
|
|||
;; there may be an error, give the user up to 5 seconds to check
|
||||
(when maybe-error (sit-for 5))
|
||||
(mu4e-update-index)
|
||||
(when (buffer-live-p buf) (kill-buffer buf)))))
|
||||
(when (buffer-live-p buf)
|
||||
(with-selected-window (get-buffer-window buf) (quit-window t))))))
|
||||
;; if we're running in the foreground, handle password requests
|
||||
(unless run-in-background
|
||||
(process-put proc 'x-interactive (not run-in-background))
|
||||
|
|
Loading…
Reference in New Issue