refresh notmuch buffers after sync and add support for custom sync

This commit is contained in:
Max Nickel 2019-10-23 23:24:56 -04:00
parent 5324cb2fc8
commit d73ebf0815
2 changed files with 25 additions and 11 deletions

View file

@ -32,8 +32,14 @@
;;;###autoload ;;;###autoload
(defun +notmuch/update () (defun +notmuch/update ()
(interactive) (interactive)
;; create output buffer and jump to beginning
(let ((buf (get-buffer-create "*notmuch update*")))
(with-current-buffer buf
(erase-buffer))
(pop-to-buffer buf nil t)
(set-process-sentinel
(start-process-shell-command (start-process-shell-command
"notmuch update" nil "notmuch update" buf
(pcase +notmuch-sync-backend (pcase +notmuch-sync-backend
(`gmi (`gmi
(concat "cd " +notmuch-mail-folder " && gmi push && gmi pull && notmuch new && afew -a -t")) (concat "cd " +notmuch-mail-folder " && gmi push && gmi pull && notmuch new && afew -a -t"))
@ -42,7 +48,12 @@
(`mbsync-xdg (`mbsync-xdg
"mbsync -c \"$XDG_CONFIG_HOME\"/isync/mbsyncrc -a && notmuch new && afew -a -t") "mbsync -c \"$XDG_CONFIG_HOME\"/isync/mbsyncrc -a && notmuch new && afew -a -t")
(`offlineimap (`offlineimap
"offlineimap && notmuch new && afew -a -t")))) "offlineimap && notmuch new && afew -a -t")
(`custom +notmuch-sync-command)))
;; refresh notmuch buffers if sync was successful
(lambda (_process event)
(if (string= event "finished\n")
(notmuch-refresh-all-buffers))))))
;;;###autoload ;;;###autoload
(defun +notmuch/search-delete () (defun +notmuch/search-delete ()

View file

@ -5,6 +5,9 @@
(defvar +notmuch-sync-backend 'gmi (defvar +notmuch-sync-backend 'gmi
"Which backend to use. Can be either gmi, mbsync, offlineimap or nil (manual).") "Which backend to use. Can be either gmi, mbsync, offlineimap or nil (manual).")
(defvar +notmuch-sync-command nil
"Command for custom notmuch sync")
(defvar +notmuch-mail-folder "~/.mail/account.gmail" (defvar +notmuch-mail-folder "~/.mail/account.gmail"
"Where your email folder is located (for use with gmailieer).") "Where your email folder is located (for use with gmailieer).")