Emacs personal configuration
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

126 líneas
5.5KB

  1. ;;; package --- mu4e
  2. ;;; Commentary:
  3. ;;; Code:
  4. (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
  5. (require 'mu4e)
  6. (autoload 'mu4e "mu4e" "Mail client based on mu (maildir-utils)." t)
  7. (setq
  8. mu4e-maildir (expand-file-name "~/.Maildir")
  9. mu4e-drafts-folder "/Drafts"
  10. mu4e-sent-folder "/Sent"
  11. mu4e-trash-folder "/Trash")
  12. ;;(setq mu4e-get-mail-command "offlineimap")
  13. ;; http://cachestocaches.com/2017/3/complete-guide-email-emacs-using-mu-and-/
  14. ;; Include a bookmark to open all of my inboxes
  15. (add-to-list 'mu4e-bookmarks
  16. (make-mu4e-bookmark
  17. :name "All Inboxes"
  18. :query "maildir:/INBOX"
  19. :key ?i))
  20. (add-to-list 'mu4e-bookmarks
  21. (make-mu4e-bookmark
  22. :name "Gmail unread"
  23. :query "maildir:/Gmail AND flag:unread AND NOT flag:trashed"
  24. :key ?g))
  25. ;; This allows me to use 'helm' to select mailboxes
  26. (setq mu4e-completing-read-function 'completing-read)
  27. ;; Why would I want to leave my message open after I've sent it?
  28. (setq message-kill-buffer-on-exit t)
  29. ;; Don't ask for a 'context' upon opening mu4e
  30. (setq mu4e-context-policy 'pick-first)
  31. ;; Don't ask to quit... why is this the default?
  32. (setq mu4e-confirm-quit nil)
  33. (setq mu4e-contexts
  34. `( ,(make-mu4e-context
  35. :name "Private"
  36. :enter-func (lambda () (mu4e-message "Entering Private context"))
  37. :leave-func (lambda () (mu4e-message "Leaving Private context"))
  38. ;; we match based on the contact-fields of the message
  39. :match-func (lambda (msg)
  40. (when msg
  41. (mu4e-message-contact-field-matches msg
  42. '(:to :from :cc :bcc)
  43. ".*@home.example.com")))
  44. :vars '( ( user-mail-address . "aliced@home.example.com" )
  45. ( user-full-name . "ßingen" )
  46. ( mu4e-compose-signature . nil)
  47. ( mu4e-sent-folder . "/Sent")
  48. ( user-mail-address . "aliced@home.example.com")
  49. ( smtpmail-smtp-user . "aliced@home.example.com")
  50. ( smtpmail-local-domain . "example.com")
  51. ( smtpmail-default-smtp-server . "smtp.example.com")
  52. ( smtpmail-smtp-server . "smtp.example.com")
  53. ( smtpmail-smtp-service . 587)
  54. ( smtpmail-stream-type . starttls)
  55. ( smtpmail-use-gnutls . t)))
  56. ,(make-mu4e-context
  57. :name "Work"
  58. :enter-func (lambda () (mu4e-message "Switch to the Work context"))
  59. ;; no leave-func
  60. ;; we match based on the maildir of the message
  61. ;; this matches maildir /Arkham and its sub-directories
  62. :match-func (lambda (msg)
  63. (when msg
  64. (string-match-p "^/Arkham" (mu4e-message-field msg :maildir))))
  65. :vars '( ( user-mail-address . "aderleth@miskatonic.example.com" )
  66. ( user-full-name . "ßingen" )
  67. ( mu4e-compose-signature . nil) (mu4e-sent-folder . "/Sent")
  68. ( user-mail-address . "aliced@home.example.com")
  69. ( smtpmail-smtp-user . "aliced@home.example.com")
  70. ( smtpmail-local-domain . "example.com")
  71. ( smtpmail-default-smtp-server . "smtp.example.com")
  72. ( smtpmail-smtp-server . "smtp.example.com")
  73. ( smtpmail-smtp-service . 587)
  74. ( smtpmail-stream-type . starttls)
  75. ( smtpmail-use-gnutls . t)))
  76. ,(make-mu4e-context
  77. :name "Cycling"
  78. :enter-func (lambda () (mu4e-message "Switch to the Cycling context"))
  79. ;; no leave-func
  80. ;; we match based on the maildir of the message; assume all
  81. ;; cycling-related messages go into the /cycling maildir
  82. :match-func (lambda (msg)
  83. (when msg
  84. (string= (mu4e-message-field msg :maildir) "/cycling")))
  85. :vars '( ( user-mail-address . "aderleth@example.com" )
  86. ( user-full-name . "ßingen" )
  87. ( mu4e-compose-signature . nil)
  88. ( mu4e-sent-folder . "/Sent")
  89. ( user-mail-address . "aliced@home.example.com")
  90. ( smtpmail-smtp-user . "aliced@home.example.com")
  91. ( smtpmail-local-domain . "example.com")
  92. ( smtpmail-default-smtp-server . "smtp.example.com")
  93. ( smtpmail-smtp-server . "smtp.example.com")
  94. ( smtpmail-smtp-service . 587)
  95. ( smtpmail-stream-type . starttls)
  96. ( smtpmail-use-gnutls . t)))))
  97. ;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should
  98. ;; guess or ask the correct context, e.g.
  99. ;; start with the first (default) context;
  100. ;; default is to ask-if-none (ask when there's no context yet, and none match)
  101. ;; (setq mu4e-context-policy 'pick-first)
  102. ;; compose with the current context is no context matches;
  103. ;; default is to ask
  104. ;; (setq mu4e-compose-context-policy nil)
  105. ;; http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/
  106. ;;store org-mode links to messages
  107. (require 'org-mu4e)
  108. ;;store link to message if in header view, not to header query
  109. (setq org-mu4e-link-query-in-headers-mode nil)
  110. (provide 'init-mu4e)
  111. ;;; init-mu4e.el ends here