Updated mail-setup.

This commit is contained in:
Lars Tveito 2015-04-07 19:15:19 +02:00
parent 0f3ce6d6fd
commit 4a15c8a534
2 changed files with 106 additions and 59 deletions

45
init.el
View File

@ -438,24 +438,32 @@ PACKAGE is installed and the current version is deleted."
calendar-longitude 10.7 calendar-longitude 10.7
calendar-location-name "Oslo, Norway") calendar-location-name "Oslo, Norway")
;; Mail ;; mu4e and offlineimap
;; I use [[http://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]] (which is a part of [[http://www.djcbsoftware.nl/code/mu/][mu]]) along with [[http://docs.offlineimap.org/en/latest/][offlineimap]] on one of my ;; I might not be at a computer using my very specific mail-setup, but if my
;; computers. Because the mail-setup wont work without these programs ;; mail-folder exists, then it's probably safe to load.
;; installed we bind =load-mail-setup= to =nil=. If the value is changed to
;; a =non-nil= value mail is setup.
(defvar load-mail-setup nil) (defvar load-mail-setup (file-exists-p "~/.ifimail"))
;; mu4e
;; mu4e must be informed where it can find your mail and where the
;; different folders of interest are located. Some additional mu4e-tweaks
;; are supplied here as well.
;; ~message-insert-signature~ is an existing Emacs function, that adds your
;; signature prefixed by a ~"-- "~ at the end of the email, which is a
;; convention I don't really follow. I redefine it as a function that adds
;; some newlines and my signature at the top of the email.
(when load-mail-setup (when load-mail-setup
(eval-after-load 'mu4e (eval-after-load 'mu4e
'(progn '(progn
;; Some basic mu4e settings. ;; Some basic mu4e settings.
(setq mu4e-maildir "~/.ifimail" ; top-level Maildir (setq mu4e-maildir "~/.ifimail" ; top-level Maildir
mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages mu4e-sent-folder "/Sent Items" ; folder for sent messages
mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages
mu4e-trash-folder "/INBOX.Trash" ; trashed messages mu4e-trash-folder "/INBOX.Trash" ; trashed messages
mu4e-refile-folder "/INBOX.Archive" ; saved messages
mu4e-get-mail-command "offlineimap" ; offlineimap to fetch mail mu4e-get-mail-command "offlineimap" ; offlineimap to fetch mail
mu4e-compose-signature "- Lars" ; Sign my name mu4e-compose-signature "- Lars" ; Sign my name
mu4e-update-interval (* 5 60) ; update every 5 min mu4e-update-interval (* 5 60) ; update every 5 min
@ -474,13 +482,26 @@ PACKAGE is installed and the current version is deleted."
smtpmail-smtp-service 465 ; Port to mail-server smtpmail-smtp-service 465 ; Port to mail-server
smtpmail-stream-type 'ssl ; Protocol used for sending smtpmail-stream-type 'ssl ; Protocol used for sending
send-mail-function 'smtpmail-send-it ; Use smpt to send send-mail-function 'smtpmail-send-it ; Use smpt to send
mail-user-agent 'mu4e-user-agent) ; Use mu4e! mail-user-agent 'mu4e-user-agent) ; Use mu4e
;; Register file types that can be handled by ImageMagick. ;; Register file types that can be handled by ImageMagick.
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)))) (imagemagick-register-types))
(autoload 'mu4e "mu4e" nil t)
(global-set-key (kbd "C-x m") 'mu4e)) (add-hook 'mu4e-compose-mode-hook
(lambda ()
(auto-fill-mode 0)
(visual-line-mode 1)
(ispell-change-dictionary "norsk")))
(add-hook 'mu4e-view-mode-hook (lambda () (visual-line-mode 1)))
(defun message-insert-signature ()
(goto-char (point-min))
(search-forward-regexp "^$")
(insert "\n\n\n" mu4e-compose-signature))))
(autoload 'mu4e "mu4e" nil t))
;; Flyspell ;; Flyspell

View File

@ -587,25 +587,38 @@
calendar-location-name "Oslo, Norway") calendar-location-name "Oslo, Norway")
#+END_SRC #+END_SRC
** Mail ** mu4e and offlineimap
I use [[http://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]] (which is a part of [[http://www.djcbsoftware.nl/code/mu/][mu]]) along with [[http://docs.offlineimap.org/en/latest/][offlineimap]] on one of my I might not be at a computer using my very specific mail-setup, but if my
computers. Because the mail-setup wont work without these programs mail-folder exists, then it's probably safe to load.
installed we bind =load-mail-setup= to =nil=. If the value is changed to
a =non-nil= value mail is setup.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defvar load-mail-setup nil) (defvar load-mail-setup (file-exists-p "~/.ifimail"))
#+END_SRC
I use [[http://www.djcbsoftware.nl/code/mu/mu4e.html][mu4e]] (which is a part of [[http://www.djcbsoftware.nl/code/mu/][mu]]) along with [[http://docs.offlineimap.org/en/latest/][offlineimap]] on one of my
computers.
*** mu4e
mu4e must be informed where it can find your mail and where the
different folders of interest are located. Some additional mu4e-tweaks
are supplied here as well.
~message-insert-signature~ is an existing Emacs function, that adds your
signature prefixed by a ~"-- "~ at the end of the email, which is a
convention I don't really follow. I redefine it as a function that adds
some newlines and my signature at the top of the email.
#+BEGIN_SRC emacs-lisp
(when load-mail-setup (when load-mail-setup
(eval-after-load 'mu4e (eval-after-load 'mu4e
'(progn '(progn
;; Some basic mu4e settings. ;; Some basic mu4e settings.
(setq mu4e-maildir "~/.ifimail" ; top-level Maildir (setq mu4e-maildir "~/.ifimail" ; top-level Maildir
mu4e-sent-folder "/INBOX.Sent" ; folder for sent messages mu4e-sent-folder "/Sent Items" ; folder for sent messages
mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages mu4e-drafts-folder "/INBOX.Drafts" ; unfinished messages
mu4e-trash-folder "/INBOX.Trash" ; trashed messages mu4e-trash-folder "/INBOX.Trash" ; trashed messages
mu4e-refile-folder "/INBOX.Archive" ; saved messages
mu4e-get-mail-command "offlineimap" ; offlineimap to fetch mail mu4e-get-mail-command "offlineimap" ; offlineimap to fetch mail
mu4e-compose-signature "- Lars" ; Sign my name mu4e-compose-signature "- Lars" ; Sign my name
mu4e-update-interval (* 5 60) ; update every 5 min mu4e-update-interval (* 5 60) ; update every 5 min
@ -624,13 +637,26 @@
smtpmail-smtp-service 465 ; Port to mail-server smtpmail-smtp-service 465 ; Port to mail-server
smtpmail-stream-type 'ssl ; Protocol used for sending smtpmail-stream-type 'ssl ; Protocol used for sending
send-mail-function 'smtpmail-send-it ; Use smpt to send send-mail-function 'smtpmail-send-it ; Use smpt to send
mail-user-agent 'mu4e-user-agent) ; Use mu4e! mail-user-agent 'mu4e-user-agent) ; Use mu4e
;; Register file types that can be handled by ImageMagick. ;; Register file types that can be handled by ImageMagick.
(when (fboundp 'imagemagick-register-types) (when (fboundp 'imagemagick-register-types)
(imagemagick-register-types)))) (imagemagick-register-types))
(autoload 'mu4e "mu4e" nil t)
(global-set-key (kbd "C-x m") 'mu4e)) (add-hook 'mu4e-compose-mode-hook
(lambda ()
(auto-fill-mode 0)
(visual-line-mode 1)
(ispell-change-dictionary "norsk")))
(add-hook 'mu4e-view-mode-hook (lambda () (visual-line-mode 1)))
(defun message-insert-signature ()
(goto-char (point-min))
(search-forward-regexp "^$")
(insert "\n\n\n" mu4e-compose-signature))))
(autoload 'mu4e "mu4e" nil t))
#+END_SRC #+END_SRC
** Flyspell ** Flyspell