You may have to complete additional steps if you are not using
doom emacs or if your set-up differs from mine in other ways.
Please be sure you’ve completed these steps before continuing:
git clone https://github.com/gauteh/lieer.git cd lieer pip3 install -r requirements.txt
sudo apt install notmuch
Create an OAuth2 Client ID
- Please refer to: Create an OAuth2 Client ID
- Ensure GMail APIs are enabled for this Client ID.
- Download the JSON format of this key.
This is written for those using
doom emacs. Those using other flavors of
emacs will need to enable
notmuch on their own.
doom syncin your shell.
doom emacsby either killing
emacsand restarting, or by running
SPC : doom/reloador
SPC h r r).
These steps are pulled from
notmuch’s own documentation.
notmuchin your shell to create
Perform initial indexing:
# Create a directory to house your mail if you don't already have one. mkdir -p /path/to/your/mail/directory cd /path/to/your/mail/directory notmuch new
You should see something like:
Found 0 total files (that's not much mail) No new mail.
These steps are pulled from
lieer’s own documentation.
Make a directory for the lieer storage and state files (local repository).
cd /path/to/your/mail/directory mkdir <you>.gmail cd you.gmail
bakfiles by updating the
[new]section to read:
[new] tags=new ignore=/.*[.](json|lock|bak)$/
Initialize your mail storage.
This command will open a new tab in your browser. We need to run this command once before we can specify our own credentials. Feel free to close the tab as soon as it opens as we’ll be swapping the default client id with our own in the next steps.
# From within /path/to/your/mail/directory/<you>.gmail /path/to/lieer/gmi init <you>@gmail.com
Cancel out (
You should see a message similar to:
init: repository is set up, but authorization failed. re-run 'gmi auth' with proper parameters to complete authorization
Set your credentials.
# From within /path/to/your/mail/directory/<you>.gmail /path/to/lieer/gmi auth \ --credentials=/path/to/your/OAuth2/client/id.json # Or, if you're working remotely (SSHing into your workstation, etc) /path/to/lieer/gmi \ --noauth_local_webserver \ auth \ --credentials=/path/to/your/OAuth2/client/id.json
Open the link and authenticate using your
@gmail.comaccount. Copy the code and paste it back into the running
gmicommand. You should see a message like:
Authentication successful. credentials stored in /path/to/your/mail/directory/you.gmail/.credentials.gmailieer.json
Sync your email.
This step may take a long time. My initial sync of 90k emails took 56 real-time minutes.
# From within /path/to/your/mail/directory/<you>.gmail /path/to/lieer/gmi sync
Set up Cronjob to Sync Email
You could also use a
systemd timer for this.
Create a new shell script to sync your email. Remember to
#!/bin/bash cd /path/to/your/mail/directory/you.gmail /path/to/lieer/gmi sync
Configure the cronjob with
# Sync email with lieer every three minutes. */3 * * * * bash /path/to/your/script/sync_email.sh
Set up saved searches.
Prevent wrapping text at 70 characters while composing an email:
;; This is valid in doom emacs. You may need to customize for other distributions. ;; Prevent wrapping at 70 characters in email composition. (add-hook! 'message-mode-hook 'turn-off-auto-fill) (add-hook! 'message-mode-hook 'visual-line-mode)
For those of you using
doom emacs, you can open notmuch from anywhere with
SPC o m.