Emacs personal configuration
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

104 linhas
4.2KB

  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. (make-mu4e-bookmark
  21. :name "Gmail unread"
  22. :query "maildir:/Gmail AND flag:unread AND NOT flag:trashed"
  23. :key ?g))
  24. ;; This allows me to use 'helm' to select mailboxes
  25. (setq mu4e-completing-read-function 'completing-read)
  26. ;; Why would I want to leave my message open after I've sent it?
  27. (setq message-kill-buffer-on-exit t)
  28. ;; Don't ask for a 'context' upon opening mu4e
  29. (setq mu4e-context-policy 'pick-first)
  30. ;; Don't ask to quit... why is this the default?
  31. (setq mu4e-confirm-quit nil)
  32. (setq mu4e-contexts
  33. `( ,(make-mu4e-context
  34. :name "Private"
  35. :enter-func (lambda () (mu4e-message "Entering Private context"))
  36. :leave-func (lambda () (mu4e-message "Leaving Private context"))
  37. ;; we match based on the contact-fields of the message
  38. :match-func (lambda (msg)
  39. (when msg
  40. (mu4e-message-contact-field-matches msg
  41. :to "aliced@home.example.com")))
  42. :vars '( ( user-mail-address . "aliced@home.example.com" )
  43. ( user-full-name . "Alice Derleth" )
  44. ( mu4e-compose-signature .
  45. (concat
  46. "Alice Derleth\n"
  47. "Lauttasaari, Finland\n"))))
  48. ,(make-mu4e-context
  49. :name "Work"
  50. :enter-func (lambda () (mu4e-message "Switch to the Work context"))
  51. ;; no leave-func
  52. ;; we match based on the maildir of the message
  53. ;; this matches maildir /Arkham and its sub-directories
  54. :match-func (lambda (msg)
  55. (when msg
  56. (string-match-p "^/Arkham" (mu4e-message-field msg :maildir))))
  57. :vars '( ( user-mail-address . "aderleth@miskatonic.example.com" )
  58. ( user-full-name . "Alice Derleth" )
  59. ( mu4e-compose-signature .
  60. (concat
  61. "Prof. Alice Derleth\n"
  62. "Miskatonic University, Dept. of Occult Sciences\n"))))
  63. ,(make-mu4e-context
  64. :name "Cycling"
  65. :enter-func (lambda () (mu4e-message "Switch to the Cycling context"))
  66. ;; no leave-func
  67. ;; we match based on the maildir of the message; assume all
  68. ;; cycling-related messages go into the /cycling maildir
  69. :match-func (lambda (msg)
  70. (when msg
  71. (string= (mu4e-message-field msg :maildir) "/cycling")))
  72. :vars '( ( user-mail-address . "aderleth@example.com" )
  73. ( user-full-name . "AliceD" )
  74. ( mu4e-compose-signature . nil)))))
  75. ;; set `mu4e-context-policy` and `mu4e-compose-policy` to tweak when mu4e should
  76. ;; guess or ask the correct context, e.g.
  77. ;; start with the first (default) context;
  78. ;; default is to ask-if-none (ask when there's no context yet, and none match)
  79. ;; (setq mu4e-context-policy 'pick-first)
  80. ;; compose with the current context is no context matches;
  81. ;; default is to ask
  82. ;; (setq mu4e-compose-context-policy nil)
  83. ;; http://pragmaticemacs.com/emacs/master-your-inbox-with-mu4e-and-org-mode/
  84. ;;store org-mode links to messages
  85. (require 'org-mu4e)
  86. ;;store link to message if in header view, not to header query
  87. (setq org-mu4e-link-query-in-headers-mode nil)
  88. (provide 'init-mu4e)
  89. ;;; init-mu4e.el ends here