Add basic Emacs email setup

Using msmtp and notmuch.
parent 3c5602b3
......@@ -10,6 +10,7 @@ in
{
imports = [
nurNoPkgs.repos.rycee.hmModules.emacs-init
nurNoPkgs.repos.rycee.hmModules.emacs-notmuch
];
nixpkgs.overlays = [ (import sources.emacs-overlay) ];
......@@ -387,6 +388,48 @@ in
command = [ "notifications-notify" ];
};
notmuch = {
command = [ "notmuch" "notmuch-show-tag" "notmuch-search-tag" ];
hook = [
''(notmuch-show . rah-disable-trailing-whitespace-mode)''
];
bindLocal = {
notmuch-show-mode-map = {
"S" = "rah-notmuch-show-tag-spam";
"d" = "rah-notmuch-show-tag-deleted";
};
notmuch-search-mode-map = {
"S" = "rah-notmuch-search-tag-spam";
"d" = "rah-notmuch-search-tag-deleted";
};
};
config =
let
listTags = ts: "(list ${toString (map (t: ''"${t}"'') ts)})";
spamTags = listTags ["+spam" "-inbox"];
deletedTags = listTags ["+deleted" "-inbox"];
in
''
(defun rah-notmuch-show-tag-spam ()
(interactive)
(notmuch-show-tag ${spamTags}))
(defun rah-notmuch-show-tag-deleted ()
(interactive)
(notmuch-show-tag ${deletedTags}))
(defun rah-notmuch-search-tag-spam (&optional beg end)
(interactive)
(notmuch-search-tag ${spamTags} beg end))
(defun rah-notmuch-search-tag-deleted (&optional beg end)
(interactive)
(notmuch-search-tag ${deletedTags} beg end))
(setq notmuch-show-logo nil)
'';
};
flyspell = {
enable = true;
diminish = [ "flyspell-mode" ];
......@@ -1404,20 +1447,41 @@ in
rust-mode.enable = true;
sendmail = {
enable = false;
command = [ "mail-mode" "mail-text" ];
mode = [
''("mutt-" . mail-mode)''
''("\\.article" . mail-mode))''
];
hook = [
''
(lambda ()
(auto-fill-mode) ; Avoid having to M-q all the time.
(rah-mail-flyspell) ; I spel funily soemtijms.
(rah-mail-reftex) ; Make it easy to include references.
(mail-text)) ; Jump to the actual text.
''
''("^mutt-" . mail-mode)''
''("\\.article" . mail-mode)''
];
bindLocal = {
mail-mode-map = {
# Make it easy to include references.
"C-c [" = "rah-mail-reftex-citation";
};
};
hook = [ "rah-mail-mode-hook" ];
config = ''
(defun rah-mail-reftex-citation ()
(let ((reftex-cite-format 'locally))
(reftex-citation)))
(defun rah-mail-flyspell ()
"Enable flyspell and set dictionary based on To: field."
(save-excursion
(goto-char (point-min))
(when (re-search-forward "^To: .*\\.se\\($\\|,\\|>\\)" nil t)
(ispell-change-dictionary "swedish"))))
(defun rah-mail-mode-hook ()
(auto-fill-mode) ; Avoid having to M-q all the time.
(rah-mail-flyspell) ; I spel funily soemtijms.
(mail-text)) ; Jump to the actual text.
(setq sendmail-program "${pkgs.msmtp}/bin/msmtp"
send-mail-function 'sendmail-send-it
mail-specify-envelope-from t
message-sendmail-envelope-from 'header
mail-envelope-from 'header)
'';
};
sv-kalender = {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment