diff options
-rw-r--r-- | gnus-conf.el | 6 | ||||
-rw-r--r-- | init.el | 6 | ||||
-rw-r--r-- | mail.el | 163 |
3 files changed, 52 insertions, 123 deletions
diff --git a/gnus-conf.el b/gnus-conf.el index f409b41..150b4e9 100644 --- a/gnus-conf.el +++ b/gnus-conf.el @@ -136,13 +136,17 @@ (setq mm-verify-option 'known) -;;; Update by mu4e +;;; Update mails ;; (autoload 'mu4e-update-mail-and-index "mu4e-utils") (autoload 'load-config "init") ;; (defalias 'durand-update-mail #'mu4e-update-mail-and-index) +;; Load mail configurations + +(load-config "mail.el") + ;; Let notmuch know about the changes automatically. (load-config "notmuch-conf.el") @@ -134,12 +134,6 @@ no effect." (define-key global-map (vector 3 99) #'prepare-org) (define-key global-map (vector 3 ?l) #'prepare-org) -;;; Prepare for mu4e - -(load-after-function durand-mu4e "mail.el" "Open mu4e." t (mu4e)) - -(define-key global-map (vector 3 109) #'durand-mu4e) - ;;; Prepare for PDF (add-to-list 'auto-mode-alist (cons "pdf$" #'pdf-view-mode)) @@ -1,119 +1,46 @@ +;;; mail.el --- My general mail configurations -*- lexical-binding: t; -*- -(use-package "/usr/local/share/emacs/site-lisp/mu/mu4e" 'mu4e - (setq mu4e-maildir-list (list "/Users/durand/mbsync")) - (setq user-mail-address "durand@jsdurand.xyz") - (setq mu4e-completing-read-function #'completing-read) - (setq message-confirm-send t) - (setq mu4e~update-buffer-height 5) - - (setq mu4e-context-policy 'pick-first) - (setq mu4e-attachment-dir "~/Downloads") - (setq mu4e-mu-binary "/usr/local/bin/mu") - - (setq mu4e-view-use-gnus t) - (setq mu4e-confirm-quit nil) - ;; mbsync works a lot better! - (setq mu4e-get-mail-command - "mbsync mymail-inbox mymail-sent") - (setq mu4e-change-filenames-when-moving t) - (setq mu4e-view-show-addresses t) ; show full addresses! - (setq mu4e-view-show-images t) - (setq mu4e-sent-messages-behavior 'delete) - (setq mu4e-use-fancy-chars t) - (setq message-send-mail-function 'smtpmail-send-it - smtpmail-stream-type 'starttls - smtpmail-default-smtp-server "smtp.gmail.com" - smtpmail-smtp-server "smtp.gmail.com" - smtpmail-smtp-service 587) - - (define-key mu4e-main-mode-map (vector ?q) #'bury-buffer) - (define-key mu4e-main-mode-map (vector ?u) #'mu4e-update-mail-and-index) - - (add-to-list - 'mu4e-bookmarks - (make-mu4e-bookmark - :name "week no trash no archive" - :query "date:7d..now AND NOT maildir:/trash AND NOT maildir:/archive" - :key ?d)) - - (add-to-list - 'mu4e-bookmarks - (make-mu4e-bookmark - :name "week starred" - :query "date:7d..now AND maildir:/suivis" - :key ?s)) - - ;; (setq mu4e-maildir-shortcuts - ;; '(("/INBOX" . ?i) - ;; ("/archive" . ?a) - ;; ("/suivis" . ?s) - ;; ("/drafts" . ?d))) - - (setq mu4e-sent-folder "/mymail/Sent") - - ;; (setq mu4e-contexts - ;; (list - ;; (make-mu4e-context - ;; :name "Student" - ;; :enter-func (lambda () (mu4e-message "Entering Student context")) - ;; :leave-func (lambda () (mu4e-message "Leaving Student context")) - ;; ;; we match based on the contact-fields of the message - ;; :match-func - ;; (lambda (msg) - ;; (when msg - ;; (or - ;; (mu4e-message-contact-field-matches msg :from "tan\\|mlh\\|hsialc\\|tingyu.lee\\|tingyulee") - ;; (mu4e-message-contact-field-matches msg :to "tan\\|mlh\\|hsialc\\|tingyu.lee\\|tingyulee")))) - ;; :vars '((user-mail-address . "mmemmew@gmail.com") - ;; (user-full-name . "李俊緯") - ;; (mu4e-compose-signature . "生 俊緯") - ;; (mu4e-sent-folder . "/gmail/sent") - ;; (smtpmail-smtp-user . "mmemmew@gmail.com") - ;; (smtpmail-local-domain . "gmail.com") - ;; (smtpmail-default-smtp-server . "smtp.gmail.com") - ;; (smtpmail-smtp-server . "smtp.gmail.com") - ;; (smtpmail-smtp-service . 587))) - ;; (make-mu4e-context - ;; :name "NCTS" - ;; :enter-func (lambda () (mu4e-message "Switch to the NCTS context")) - ;; :leave-func (lambda () (mu4e-message "Leave NCTS context")) - ;; ;; no leave-func - ;; ;; we match based on the maildir of the message - ;; ;; this matches maildir /Arkham and its sub-directories - ;; :match-func (lambda (msg) - ;; (when msg - ;; (or - ;; (mu4e-message-contact-field-matches msg :to "chunweilee@ncts.ntu.edu.tw") - ;; (mu4e-message-contact-field-matches msg :from "chunweilee@ncts.ntu.edu.tw")))) - ;; :vars '((user-mail-address . "chunweilee@ncts.ntu.edu.tw") - ;; (user-full-name . "李俊緯") - ;; (mu4e-compose-signature . - ;; (concat - ;; "Sincerely Yours,\n" - ;; "俊緯")))) - ;; (make-mu4e-context - ;; :name "Durand" - ;; :enter-func (lambda () (mu4e-message "Entering Durand context")) - ;; :leave-func (lambda () (mu4e-message "Leaving Durand context")) - ;; ;; we match based on the contact-fields of the message - ;; :match-func (lambda (msg) - ;; (when msg - ;; (or - ;; (mu4e-message-contact-field-matches msg :to "mmemmew@gmail.com") - ;; (mu4e-message-contact-field-matches msg :from "mmemmew@gmail.com")))) - ;; :vars '((user-mail-address . "durand@jsdurand.xyz") - ;; (user-full-name . "Durand") - ;; (mu4e-compose-signature . "Sévère Durand") - ;; (mu4e-sent-folder . "/gmail/sent") - ;; (smtpmail-smtp-user . "mmemmew@gmail.com") - ;; (smtpmail-local-domain . "gmail.com") - ;; (smtpmail-default-smtp-server . "smtp.gmail.com") - ;; (smtpmail-smtp-server . "smtp.gmail.com") - ;; (smtpmail-smtp-service . 587))))) - ) - -;; (setq smtpmail-debug-info t) -;; (setq smtpmail-debug-verb t) +;; Copyright (C) 2022 Sévère Durand + +;; Author: Sévère Durand <mmemmew@gmail.com> +;; Keywords: convenience, mail + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This file contains my general configurations related to mails. + +;;; Code: + +;;; Some settings + +;;;; Setting my mail address + +(setq user-mail-address "durand@jsdurand.xyz") + +;;;; Confirm to send + +(setq message-confirm-send t) + +;;;; Sending settings + +(setq message-send-mail-function 'smtpmail-send-it) +(setq smtpmail-stream-type 'starttls) +(setq smtpmail-default-smtp-server "smtp.gmail.com") +(setq smtpmail-smtp-server "smtp.gmail.com") +(setq smtpmail-smtp-service 587) ;;; message mode @@ -311,7 +238,7 @@ person." ;;; update mails without mu4e (defun durand-mail-process-output (output) - "Normalize the OUTPUT emitted by mu4e." + "Normalize the OUTPUT emitted by mbsync." (let ((splitted (split-string output (rx-to-string (list 'any ?
?\n ?\r) t) t))) (or (car (last splitted)) ""))) @@ -383,3 +310,7 @@ separate buffer." ((setq durand-mail-update-timer (run-with-timer 0 (* 60 30) #'durand-mail-update)))) + + +(provide 'mail) +;;; mail.el ends here |