fix(notmuch): window is not a valid window error on sync end
Notmuch sync process is done asynchronously, but if the user switch to other buffer before update process, it complains like ``` error in process sentinel: #<window 98> is not a valid window ``` This commit simplifies cleanup process after mail syncing, and still maintain its functionality.
This commit is contained in:
parent
c3d237c3f5
commit
7274f73500
1 changed files with 11 additions and 14 deletions
|
@ -60,20 +60,17 @@
|
||||||
"Sync notmuch emails with server."
|
"Sync notmuch emails with server."
|
||||||
(interactive)
|
(interactive)
|
||||||
(with-current-buffer (compile (+notmuch-get-sync-command))
|
(with-current-buffer (compile (+notmuch-get-sync-command))
|
||||||
(let ((w (get-buffer-window (current-buffer))))
|
|
||||||
(select-window w)
|
|
||||||
(add-hook
|
(add-hook
|
||||||
'compilation-finish-functions
|
'compilation-finish-functions
|
||||||
(lambda (buf status)
|
(lambda (buf status)
|
||||||
(if (equal status "finished\n")
|
(if (equal status "finished\n")
|
||||||
(progn
|
(progn
|
||||||
(delete-window w)
|
|
||||||
(kill-buffer buf)
|
(kill-buffer buf)
|
||||||
(notmuch-refresh-all-buffers)
|
(notmuch-refresh-all-buffers)
|
||||||
(message "Notmuch sync successful"))
|
(message "Notmuch sync successful"))
|
||||||
(user-error "Failed to sync notmuch data")))
|
(user-error "Failed to sync notmuch data")))
|
||||||
nil
|
nil
|
||||||
'local))))
|
'local)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +notmuch/search-delete ()
|
(defun +notmuch/search-delete ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue