kota's memex

https://aerc-mail.org/

working with patches

  1. Open up the patch email
  2. cd ~/g/projectname
  3. :pipe git am
  4. control-t to open a new terminal
  5. git status ... etc

mbsync

Aerc was originally designed to connect directly to your mail server. This is kinda terrible because not only does it mean you can't use your email offline, but also switching folders is actually laggy since it makes a blocking network request each time. Sure, it could be designed to be non blocking, but it's actually much better to use a separate program to sync/download your mail and then use aerc to actually view your locally downloaded emails.

In your ~/.config/aerc/accounts.conf you can set your source to a local directly like this:

source   = maildir://~/mail

I leave my outgoing set to the normal smtps+plain, but you could setup a local postfix server if you want to be able to "send" emails offline, have them queue up and then send out when you get internet again.

Next, you'll want to install a package called isync which includes an mbsync program. The config is in ~/.mbsyncrc:

IMAPAccount migadu
Host imap.migadu.com
User kota@nilsu.org
Pass *************
SSLType IMAPS

MaildirStore local
Path ~/mail/
INBOX ~/mail/INBOX
SubFolders Verbatim

IMAPStore migadu
Account migadu

Channel primary
Far :migadu:
Near :local:
Patterns INBOX Archive Sent Junk
Create Near
Expunge Both

One option is to just run mbsync primary every 5-10 minutes with cron. This works reasonably well, but it wasteful AND you usually have to wait 5-10 minutes when you get a quick "confirmation" email, or run mbsync manually.

goimapnotify

Fortunately, there's an IMAP extension called "IDLE" which supports push notifications when you get new mail! This isn't supported by all mail providers yet, but migadu supports it.

Install goimapnotify and then create a config file somewhere. The location technically doesn't matter, but I like to place mine in ~/.config/goimapnotify/primary.conf:

{
	"host": "imap.migadu.com",
	"port": 993,
	"tls": true,
	"username": "kota@nilsu.org",
  "password": "********************",
	"onNewMail": "mbsync primary",
	"boxes": [ "INBOX" ]
}

Then you'll want to create a user service to run:
exec goimapnotify -conf $HOME/.config/goimapnotify/primary.conf