;; Mail
(use-package notmuch
  :ensure t
  :defer t
  :bind
  ;; Go to inbox by default ("m" for mail)
  ;; FIXME avoid duplicates
  (("C-c m" . (lambda () (interactive) 
                (notmuch-search  "tag:new AND not (tag:deleted OR tag:archive)")))
   :map notmuch-search-mode-map
   ("d" . (lambda () 
            (interactive)
            (notmuch-search-tag '("+deleted" "-new"))
            (notmuch-search-next-thread))))
  :custom
  (send-mail-function 'sendmail-send-it)
  (sendmail-program "/usr/bin/msmtp")
  (user-mail-address "alexis@praga.dev")
  ;; Afew should move deleted and archived tag but until the next sync, we want a clean view of inbox
  (notmuch-saved-searches '((:name "inbox" :query "tag:new AND not (tag:deleted OR tag:archive)" :key "i")
                            (:name "archive" :query "tag:archive" :key "a")))
  (notmuch-archive-tags '("+archive"))

  (notmuch-fcc-dirs nil)
  )

(provide 'init-mail)