Rely on systemd timers for syncing mail, and re-index every 5 minutes
[~bandali/configs] / spacemacs / .emacs.d / private / aminb / packages.el
index 36c9400..997de0b 100644 (file)
 ;;; Code:
 
 (defconst aminb-packages
-  '(crux writeroom-mode znc
-         ;; mu4e has to be installed manually,
-         ;; and make sure it's in load-path
-         (mu4e :location site)
-         (mu4e-contrib :location site)
-         smtpmail
-         )
+  '(creamsody-theme
+    crux
+    ;; mu4e has to be installed manually,
+    ;; and make sure it's in load-path
+    (mu4e :location site)
+    (mu4e-contrib :location site)
+    smtpmail
+    writeroom-mode
+    znc)
   "The list of Lisp packages required by the aminb layer.")
 
+(defun aminb/init-creamsody-theme ())
+
 (defun aminb/init-crux ()
     (use-package crux
       :defer t
@@ -136,13 +140,14 @@ erc-modified-channels-alist. Should be executed on window change."
       )))
 
 (defun aminb/post-init-mu4e ()
+  (setq maildir "~/mail")
   (use-package mu4e
     :defer t
     :config
     (progn
-      (setq mu4e-maildir "~/mail"
-            mu4e-get-mail-command "mbsync -aq"   ;; or fetchmail, or ...
-            mu4e-update-interval 300             ;; update every 5 minutes
+      (setq mu4e-maildir maildir
+            mu4e-get-mail-command "true"
+            mu4e-update-interval 300
             mu4e-view-show-addresses t
             mu4e-headers-include-related t
             mu4e-enable-notifications t
@@ -152,17 +157,18 @@ erc-modified-channels-alist. Should be executed on window change."
             (concat
              "Amin Bandali\n"
              "<aminb.org>\n")
-            ;; don't keep message buffers around
-            message-kill-buffer-on-exit t
+            message-kill-buffer-on-exit t ; don't keep message buffers around
             mu4e-attachment-dir "~/dls"
             mu4e-sent-folder "/amin/Sent"
             mu4e-drafts-folder "/amin/Drafts"
             mu4e-trash-folder "/amin/Trash"
+            user-full-name "Amin Bandali"
             user-mail-address "amin@aminb.org"
+            mu4e-context-policy 'pick-first
             mu4e-contexts
               (list (make-mu4e-context
-                     :name "amin"
-                     :enter-func (lambda () (mu4e-message "Switch to the amin context"))
+                     :name "Personal"
+                     :enter-func (lambda () (mu4e-message "Switch to the Personal context"))
                      :match-func (lambda (msg)
                                    (when msg
                                      (s-prefix? "/amin/" (mu4e-message-field msg :maildir))))
@@ -176,8 +182,8 @@ erc-modified-channels-alist. Should be executed on window change."
                              (smtpmail-stream-type . starttls)
                              (smtpmail-smtp-service . 587)))
                     (make-mu4e-context
-                     :name "gmail"
-                     :enter-func (lambda () (mu4e-message "Switch to the gmail context"))
+                     :name "BB"
+                     :enter-func (lambda () (mu4e-message "Switch to the BB context"))
                      :match-func (lambda (msg)
                                    (when msg
                                      (s-prefix? "/gmail/" (mu4e-message-field msg :maildir))))
@@ -186,10 +192,26 @@ erc-modified-channels-alist. Should be executed on window change."
                              (mu4e-drafts-folder . "/gmail/Drafts")
                              (mu4e-trash-folder . "/gmail/Trash")
                              (mu4e-sent-messages-behavior . delete)
+                             (mu4e-compose-signature . nil)
                              (smtpmail-default-smtp-server . "smtp.gmail.com")
                              (smtpmail-smtp-server . "smtp.gmail.com")
                              (smtpmail-stream-type . starttls)
-                             (smtpmail-smtp-service . 587)))))
+                             (smtpmail-smtp-service . 587)))
+                     (make-mu4e-context
+                      :name "GNU"
+                      :enter-func (lambda () (mu4e-message "Switch to the GNU context"))
+                      :match-func (lambda (msg)
+                                    (when msg
+                                      (s-prefix? "/gnu/" (mu4e-message-field msg :maildir))))
+                      :vars '((user-mail-address . "aminb@gnu.org")
+                              (mu4e-sent-folder . "/gnu/Sent")
+                              (mu4e-drafts-folder . "/gnu/Drafts")
+                              (mu4e-trash-folder . "/gnu/Trash")
+                              (mu4e-sent-messages-behavior . sent)
+                              (smtpmail-default-smtp-server . "fencepost.gnu.org")
+                              (smtpmail-smtp-server . "fencepost.gnu.org")
+                              (smtpmail-stream-type . starttls)
+                              (smtpmail-smtp-service . 587)))))
       (with-eval-after-load 'mu4e-alert
         ;; Enable Desktop notifications
         (mu4e-alert-set-default-style 'notifications))))
@@ -216,6 +238,12 @@ erc-modified-channels-alist. Should be executed on window change."
       (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode))
     )
 
+  ;; Exclude the files in maildir from recents
+  (use-package recentf
+    :defer t
+    :config
+    (add-to-list 'recentf-exclude (expand-file-name maildir)))
+
   (spacemacs/set-leader-keys
     "am" 'mu4e)
   )
@@ -236,6 +264,7 @@ erc-modified-channels-alist. Should be executed on window change."
           smtpmail-local-domain "aminb.org"
           smtpmail-smtp-server "nix.aminb.org"
           smtpmail-stream-type 'starttls
-          smtpmail-smtp-service 587)))
+          smtpmail-smtp-service 587
+          send-mail-function 'smtpmail-send-it)))
 
 ;;; packages.el ends here