summaryrefslogtreecommitdiffstats
path: root/spacemacs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--spacemacs/.emacs.d/private/aminb/layers.el2
-rw-r--r--spacemacs/.emacs.d/private/aminb/packages.el121
-rw-r--r--spacemacs/.spacemacs2
3 files changed, 122 insertions, 3 deletions
diff --git a/spacemacs/.emacs.d/private/aminb/layers.el b/spacemacs/.emacs.d/private/aminb/layers.el
index a7cbc32..04bde71 100644
--- a/spacemacs/.emacs.d/private/aminb/layers.el
+++ b/spacemacs/.emacs.d/private/aminb/layers.el
@@ -11,4 +11,4 @@
;; Prerequisites
-(configuration-layer/declare-layer 'erc)
+(configuration-layer/declare-layers '(erc mu4e))
diff --git a/spacemacs/.emacs.d/private/aminb/packages.el b/spacemacs/.emacs.d/private/aminb/packages.el
index 99dd649..7bb09f6 100644
--- a/spacemacs/.emacs.d/private/aminb/packages.el
+++ b/spacemacs/.emacs.d/private/aminb/packages.el
@@ -17,7 +17,13 @@
;;; Code:
(defconst aminb-packages
- '(crux writeroom-mode znc)
+ '(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
+ )
"The list of Lisp packages required by the aminb layer.")
(defun aminb/init-crux ()
@@ -129,4 +135,117 @@ erc-modified-channels-alist. Should be executed on window change."
)))
+(defun aminb/post-init-mu4e ()
+ (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
+ mu4e-view-show-addresses t
+ mu4e-headers-include-related t
+ mu4e-compose-signature-auto-include t
+ mu4e-compose-signature
+ (concat
+ "Amin Bandali\n"
+ "<aminb.org>\n")
+ ;; don't keep message buffers around
+ message-kill-buffer-on-exit t
+ mu4e-attachment-dir "~/dls"
+ mu4e-sent-folder "/amin/Sent"
+ mu4e-drafts-folder "/amin/Drafts"
+ mu4e-trash-folder "/amin/Trash"
+ user-mail-address "amin@aminb.org")
+
+ (defvar my-mu4e-account-alist
+ '(("amin"
+ (mu4e-sent-folder "/amin/Sent")
+ (mu4e-drafts-folder "/amin/Drafts")
+ (mu4e-trash-folder "/amin/Trash")
+ (user-mail-address "amin@aminb.org")
+ (user-full-name "Amin Bandali")
+ (smtpmail-default-smtp-server "nix.aminb.org")
+ (smtpmail-local-domain "aminb.org")
+ (smtpmail-smtp-user "amin@aminb.org")
+ (smtpmail-smtp-server "nix.aminb.org")
+ (smtpmail-stream-type 'starttls)
+ (smtpmail-smtp-service 587))
+ ("gmail"
+ (mu4e-sent-folder "/gmail/[Gmail].Sent Mail")
+ (mu4e-drafts-folder "/gmail/[Gmail].Drafts")
+ (mu4e-trash-folder "/gmail/[Gmail].Trash")
+ (user-mail-address "amin.bandali@gmail.com")
+ (user-full-name "Amin Bandali")
+ (smtpmail-default-smtp-server "smtp.gmail.com")
+ (smtpmail-local-domain "gmail.com")
+ (smtpmail-smtp-user "amin.bandali@gmail.com")
+ (smtpmail-smtp-server "smtp.gmail.com")
+ (smtpmail-stream-type ssl)
+ (smtpmail-smtp-service 465))))
+
+ (defun my-mu4e-set-account ()
+ "Set the account for composing a message."
+ (let* ((account
+ (if mu4e-compose-parent-message
+ (let ((maildir (mu4e-message-field mu4e-compose-parent-message :maildir)))
+ (string-match "/\\(.*?\\)/" maildir)
+ (match-string 1 maildir))
+ (completing-read (format "Compose with account: (%s) "
+ (mapconcat #'(lambda (var) (car var))
+ my-mu4e-account-alist "/"))
+ (mapcar #'(lambda (var) (car var)) my-mu4e-account-alist)
+ nil t nil nil (caar my-mu4e-account-alist))))
+ (account-vars (cdr (assoc account my-mu4e-account-alist))))
+ (if account-vars
+ (mapc #'(lambda (var)
+ (set (car var) (cadr var)))
+ account-vars)
+ (error "No email account found"))))
+ (add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)))
+
+ (use-package gnus-dired
+ ;; A special version of the gnus-dired-mail-buffers function
+ ;; that understands mu4e buffers as well
+ :defer t
+ :config
+ (progn
+ ;; make the `gnus-dired-mail-buffers' function also work on
+ ;; message-mode derived modes, such as mu4e-compose-mode
+ (defun gnus-dired-mail-buffers ()
+ "Return a list of active message buffers."
+ (let (buffers)
+ (save-current-buffer
+ (dolist (buffer (buffer-list t))
+ (set-buffer buffer)
+ (when (and (derived-mode-p 'message-mode)
+ (null message-sent-message-via))
+ (push (buffer-name buffer) buffers))))
+ (nreverse buffers)))
+ (setq gnus-dired-mail-mode 'mu4e-user-agent)
+ (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode))
+ )
+
+ (spacemacs/set-leader-keys
+ "am" 'mu4e)
+ )
+
+(defun aminb/init-mu4e-contrib ()
+ (use-package mu4e-contrib
+ :defer t
+ :config
+ (setq mu4e-html2text-command 'mu4e-shr2text
+ mu4e-view-html-plaintext-ratio-heuristic 10
+ mu4e-view-prefer-html t)))
+
+(defun aminb/init-smtpmail ()
+ (use-package smtpmail
+ :defer t
+ :config
+ (setq smtpmail-default-smtp-server "nix.aminb.org"
+ smtpmail-local-domain "aminb.org"
+ smtpmail-smtp-server "nix.aminb.org"
+ smtpmail-stream-type 'starttls
+ smtpmail-smtp-service 587)))
+
;;; packages.el ends here
diff --git a/spacemacs/.spacemacs b/spacemacs/.spacemacs
index fe3574f..a1c1c9b 100644
--- a/spacemacs/.spacemacs
+++ b/spacemacs/.spacemacs
@@ -367,7 +367,7 @@ This function is called at the very end of Spacemacs initialization."
;; If there is more than one, they won't work right.
'(package-selected-packages
(quote
- (znc erc-yt erc-view-log erc-social-graph erc-image erc-hl-nicks xterm-color ws-butler writeroom-mode window-numbering which-key wgrep web-mode volatile-highlights vi-tilde-fringe uuidgen use-package toc-org tagedit spacemacs-theme spaceline smex smeargle slim-mode shell-pop scss-mode sass-mode restart-emacs request rainbow-delimiters quelpa pug-mode popwin persp-mode pcre2el paradox orgit org-ref org-projectile org-present org-pomodoro org-plus-contrib org-download org-bullets open-junk-file neotree mwim multi-term move-text mmm-mode markdown-toc magit-gitflow macrostep lorem-ipsum linum-relative link-hint less-css-mode ivy-purpose ivy-hydra intero insert-shebang info+ indent-guide ido-vertical-mode hungry-delete htmlize hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation hide-comnt help-fns+ helm-make haskell-snippets google-translate golden-ratio gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link gh-md flyspell-correct-ivy flycheck-pos-tip flycheck-haskell flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-ediff evil-args evil-anzu eval-sexp-fu eshell-z eshell-prompt-extras esh-help emmet-mode elisp-slime-nav dumb-jump disaster define-word crux counsel-projectile company-web company-statistics company-shell company-ghci company-ghc company-cabal company-c-headers company-auctex column-enforce-mode cmm-mode cmake-mode clean-aindent-mode clang-format auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk aggressive-indent adaptive-wrap ace-window ace-link ac-ispell))))
+ (mu4e-maildirs-extension mu4e-alert ht znc xterm-color ws-butler writeroom-mode window-numbering which-key wgrep web-mode volatile-highlights vi-tilde-fringe uuidgen use-package toc-org tagedit spacemacs-theme spaceline smex smeargle slim-mode shell-pop scss-mode sass-mode restart-emacs request rainbow-delimiters quelpa pug-mode popwin persp-mode pcre2el paradox orgit org-ref org-projectile org-present org-pomodoro org-plus-contrib org-download org-bullets open-junk-file neotree mwim multi-term move-text mmm-mode markdown-toc magit-gitflow macrostep lorem-ipsum linum-relative link-hint less-css-mode ivy-purpose ivy-hydra intero insert-shebang info+ indent-guide ido-vertical-mode hungry-delete htmlize hlint-refactor hl-todo hindent highlight-parentheses highlight-numbers highlight-indentation hide-comnt help-fns+ helm-make haskell-snippets google-translate golden-ratio gnuplot gitignore-mode gitconfig-mode gitattributes-mode git-timemachine git-messenger git-link gh-md flyspell-correct-ivy flycheck-pos-tip flycheck-haskell flx-ido fish-mode fill-column-indicator fancy-battery eyebrowse expand-region exec-path-from-shell evil-visualstar evil-visual-mark-mode evil-unimpaired evil-tutor evil-surround evil-search-highlight-persist evil-numbers evil-nerd-commenter evil-mc evil-matchit evil-magit evil-lisp-state evil-indent-plus evil-iedit-state evil-exchange evil-escape evil-ediff evil-args evil-anzu eval-sexp-fu eshell-z eshell-prompt-extras esh-help erc-yt erc-view-log erc-social-graph erc-image erc-hl-nicks emmet-mode elisp-slime-nav dumb-jump disaster define-word crux counsel-projectile company-web company-statistics company-shell company-ghci company-ghc company-cabal company-c-headers company-auctex column-enforce-mode cmm-mode cmake-mode clean-aindent-mode clang-format auto-yasnippet auto-highlight-symbol auto-dictionary auto-compile auctex-latexmk aggressive-indent adaptive-wrap ace-window ace-link ac-ispell))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.