add a first draft for offlineimap and mu4e

This commit is contained in:
Andreas Zweili 2022-04-16 15:41:56 +02:00
parent e1be43cb4d
commit 780d5051f3
5 changed files with 148 additions and 1 deletions

View File

@ -7,6 +7,7 @@
./software/czkawka
./software/dunst
./software/emacs
./software/email
./software/evince
./software/git
./software/grobi

View File

@ -4,6 +4,7 @@
enable = true;
extraPackages = epkgs: with pkgs;[
pandoc
mu
epkgs.ace-window
epkgs.auctex
epkgs.avy

View File

@ -118,6 +118,9 @@ Evil-mode is a package which emulates Vim in Emacs.
(add-to-list 'evil-emacs-state-modes 'helpful-mode)
(setq global-evil-search-highlight-persist t)
;; Start these modes in insert mode
(evil-set-initial-state 'mu4e-compose-mode 'insert)
;; Add vim keybindings to the bookmark menu
(evil-add-hjkl-bindings bookmark-bmenu-mode-map 'emacs
;; (kbd "/") 'evil-search-forward
@ -153,6 +156,20 @@ Evil-mode is a package which emulates Vim in Emacs.
(kbd "C-u") 'evil-scroll-up
(kbd "C-w C-w") 'other-window)
;; vim keybindings for mu4e
(evil-add-hjkl-bindings mu4e-headers-mode-map 'emacs
(kbd "/") 'evil-search-forward
(kbd "n") 'evil-search-next
(kbd "N") 'evil-search-previous
(kbd "C-d") 'evil-scroll-down
(kbd "C-u") 'evil-scroll-up
(kbd "C-w C-w") 'other-window)
(evil-add-hjkl-bindings mu4e-view-mode-map 'emacs
(kbd "C-d") 'evil-scroll-down
(kbd "C-u") 'evil-scroll-up
(kbd "C-w C-w") 'other-window)
;; evilificate calendar in org-mode
(define-key org-read-date-minibuffer-local-map (kbd "M-h")
(lambda ()
@ -1247,6 +1264,99 @@ Enable direnv support.
(global-set-key (kbd "C-c C-f") #'nebucatnetzer/format-code)
(setq format-all-show-errors 'errors))
#+end_src
* Email
Requires the following packages to be installed:
#+BEGIN_EXAMPLE
offlineimap mu4e w3m
#+END_EXAMPLE
After a fresh installation you have to first sync your emails with ~offlineimap
-o~. Afterwards run ~mu index --maildir=~/Maildir~.
#+BEGIN_SRC emacs-lisp
(when (boundp 'enable-email)
(use-package mu4e
:if (is-linux-p)
:config
(require 'smtpmail)
; smtp
(setq message-send-mail-function 'smtpmail-send-it
smtpmail-starttls-credentials
'(("mail.zweili.org" 587 nil nil))
smtpmail-default-smtp-server "mail.zweili.org"
smtpmail-smtp-server "mail.zweili.org"
smtpmail-smtp-service 587
smtpmail-debug-info t)
(setq send-mail-function (quote smtpmail-send-it))
(require 'mu4e)
(require 'org-mu4e)
(setq mu4e-completing-read-function (quote ivy-completing-read))
(setq mail-user-agent 'mu4e-user-agent)
(setq mu4e-drafts-folder "/personal/Drafts")
(setq mu4e-sent-folder "/personal/Sent")
(setq mu4e-trash-folder "/personal/Trash")
(setq mu4e-refile-folder "/personal/Archive")
(setq browse-url-browser-function 'browse-url-generic
browse-url-generic-program "firefox")
(require 'mu4e-contrib)
(setq mu4e-html2text-command 'mu4e-shr2text)
(add-to-list 'mu4e-view-actions
'("ViewInBrowser" . mu4e-action-view-in-browser) t)
(setq mu4e-headers-fields
'((:date . 10) ;; alternatively, use :human-date
(:flags . 5)
(:from . 22)
(:subject . nil))) ;; alternatively, use :thread-subject
(setq mu4e-get-mail-command "offlineimap -qo"
mu4e-headers-auto-update t
mu4e-compose-format-flowed t
mu4e-index-update-in-background t
mu4e-compose-dont-reply-to-self t
mu4e-attachment-dir "~/nextcloud/10_documents/01_inbox"
mu4e-compose-signature-auto-include nil)
(add-hook 'mu4e-view-mode-hook 'visual-line-mode)
(setq mu4e-maildir-shortcuts
'(("/personal/INBOX" . ?i)
("/personal/Sent" . ?s)
("/personal/Trash" . ?t)
("/personal/Archive" . ?a)
("/personal/Drafts" . ?d)))
;; show images
(setq mu4e-show-images t)
;; general emacs mail settings; used when composing e-mail
;; the non-mu4e-* stuff is inherited from emacs/message-mode
(setq mu4e-reply-to-address "andreas@zweili.ch")
(setq message-kill-buffer-on-exit t)
;; Don't ask for a 'context' upon opening mu4e
(setq mu4e-context-policy 'pick-first)
;; Don't ask to quit
(setq mu4e-confirm-quit nil)
;; spell check
(add-hook 'mu4e-compose-mode-hook
(defun my-do-compose-stuff ()
"My settings for message composition."
(setq mu4e-compose-format-flowed t)
(use-hard-newlines -1)
(turn-off-auto-fill)
(flyspell-mode)))))
#+END_SRC
* UI Changes
@ -2427,7 +2537,7 @@ I defined ~C-c p~ to quickly jump to my personal org file.
;; My details
(setq user-full-name "Andreas Zweili")
(setq user-mail-address "andreas@2li.ch")
(setq user-mail-address "andreas@zweili.ch")
#+end_src
** Toggle window splits

View File

@ -7,3 +7,4 @@
(setq enable-ox-pandoc t)
(setq enable-emojis t)
(setq disable-fringe t)
(setq enable-email t)

View File

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
accounts.email.accounts."personal" = {
address = "andreas@zweili.ch";
realName = "Andreas Zweili";
userName = "andreas@zweili.ch";
primary = true;
passwordCommand = "cat /home/andreas/.imappass";
aliases = [
"andreas.zweili@gmail.com"
"andreas@2li.ch"
];
mu.enable = true;
offlineimap = {
enable = true;
extraConfig = {
account = { autorefresh = 15; };
local = { sync_deletes = true; };
};
};
imap = {
host = "mail.zweili.org";
port = 993;
tls.enable = true;
};
smtp = {
host = "mail.zweil.org";
port = 465;
tls.enable = true;
};
};
programs.mu.enable = true;
programs.offlineimap.enable = true;
}