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:
Hyunggyu Jang 2021-09-17 19:15:57 +09:00 committed by Henrik Lissner
parent c3d237c3f5
commit 7274f73500

View file

@ -60,20 +60,17 @@
"Sync notmuch emails with server."
(interactive)
(with-current-buffer (compile (+notmuch-get-sync-command))
(let ((w (get-buffer-window (current-buffer))))
(select-window w)
(add-hook
'compilation-finish-functions
(lambda (buf status)
(if (equal status "finished\n")
(progn
(delete-window w)
(kill-buffer buf)
(notmuch-refresh-all-buffers)
(message "Notmuch sync successful"))
(user-error "Failed to sync notmuch data")))
nil
'local))))
'local)))
;;;###autoload
(defun +notmuch/search-delete ()