email/notmuch: remove mbsync & mbsync-xdg backends
Also merges the +notmuch-sync-command variable into +notmuch-sync-backend, which now accepts a string. Mentioned in #4838
This commit is contained in:
parent
33af1f98b4
commit
19d41262e4
2 changed files with 37 additions and 16 deletions
|
@ -24,23 +24,33 @@
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun +notmuch/quit ()
|
(defun +notmuch/quit ()
|
||||||
|
"TODO"
|
||||||
(interactive)
|
(interactive)
|
||||||
;; (+popup/close (get-buffer-window "*notmuch-hello*"))
|
;; (+popup/close (get-buffer-window "*notmuch-hello*"))
|
||||||
(doom-kill-matching-buffers "^\\*notmuch")
|
(doom-kill-matching-buffers "^\\*notmuch")
|
||||||
(+workspace/delete "*MAIL*"))
|
(+workspace/delete "*MAIL*"))
|
||||||
|
|
||||||
(defun notmuch-get-sync-command ()
|
(defun +notmuch-get-sync-command ()
|
||||||
(let ((afew-cmd "afew -a -t")
|
"Return a shell command string to synchronize your notmuch mmail with."
|
||||||
(sync-cmd (pcase +notmuch-sync-backend
|
(let* ((afew-cmd "afew -a -t")
|
||||||
|
(sync-cmd
|
||||||
|
(pcase +notmuch-sync-backend
|
||||||
(`gmi
|
(`gmi
|
||||||
(concat "cd " +notmuch-mail-folder " && gmi sync && notmuch new"))
|
(concat "cd " +notmuch-mail-folder " && gmi sync && notmuch new"))
|
||||||
(`mbsync
|
((or `mbsync
|
||||||
"mbsync -a && notmuch new")
|
`mbsync-xdg) ; DEPRECATED `mbsync-xdg' is now just `mbsync'
|
||||||
(`mbsync-xdg
|
(format "mbsync %s -a && notmuch new"
|
||||||
"mbsync -c \"$XDG_CONFIG_HOME\"/isync/mbsyncrc -a && notmuch new")
|
(if-let (config-file
|
||||||
|
(doom-glob (or (getenv "XDG_CONFIG_HOME")
|
||||||
|
"~/.config")
|
||||||
|
"isync/mbsyncrc"))
|
||||||
|
(format "-c %S" config-file)
|
||||||
|
"")))
|
||||||
(`offlineimap
|
(`offlineimap
|
||||||
"offlineimap && notmuch new")
|
"offlineimap && notmuch new")
|
||||||
(`custom +notmuch-sync-command))))
|
((and (pred stringp) it) it)
|
||||||
|
(_ (user-error "Invalid notmuch backend specified: %S"
|
||||||
|
+notmuch-sync-backend)))))
|
||||||
(if (featurep! +afew)
|
(if (featurep! +afew)
|
||||||
(format "%s && %s" sync-cmd afew-cmd)
|
(format "%s && %s" sync-cmd afew-cmd)
|
||||||
sync-cmd)))
|
sync-cmd)))
|
||||||
|
@ -49,7 +59,7 @@
|
||||||
(defun +notmuch/update ()
|
(defun +notmuch/update ()
|
||||||
"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))))
|
(let ((w (get-buffer-window (current-buffer))))
|
||||||
(select-window w)
|
(select-window w)
|
||||||
(add-hook
|
(add-hook
|
||||||
|
|
|
@ -6,10 +6,21 @@
|
||||||
"Function for customizing the landing page for doom-emacs =notmuch.")
|
"Function for customizing the landing page for doom-emacs =notmuch.")
|
||||||
|
|
||||||
(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 to synchrone email.
|
||||||
|
Accepts a symbol or a shell command string.
|
||||||
|
|
||||||
(defvar +notmuch-sync-command nil
|
More specifically, this accepts one of the following symbols (see
|
||||||
"Command for custom notmuch sync")
|
`+notmuch-get-sync-command' definition for details):
|
||||||
|
|
||||||
|
`gmi' Use gmailieer (https://github.com/gauteh/lieer)
|
||||||
|
`mbsync' Use isync (https://isync.sourceforge.io)
|
||||||
|
`offlineimap' Use offlineimap (https://www.offlineimap.org)
|
||||||
|
|
||||||
|
OR a shell command string such as
|
||||||
|
|
||||||
|
\"path/to/some/shell-script.sh\"
|
||||||
|
\"offlineimap && notmuch new && afew -a -t\"
|
||||||
|
\"mbsync %s -a && notmuch new && afew -a -t\"")
|
||||||
|
|
||||||
(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).")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue