Skip to main content

Sync mails in notmuch with taskwarrior

Project description

https://travis-ci.org/neuhalje/notmuch-task.svg?branch=master

Linking mails (mutt, neomutt) to taskwarrior tasks and the other way around by utilising notmuch.

  • Create tasks from (neo)mutt with one command

  • Find tasks already assigned to e-mails

Installing

pip install notmuchtask

Usage

notmuchtask links e-mails to tasks in taskwarrior. This is done by assigning notmuch tags to the e-mails.

cli

Finding tasks

The find-task command will find the task(s) assigned to a message

# reading the message from stdin
cat test.eml|notmuchtask  find-task
99c0768c-2dbd-4c8b-9b74-afe610653dd1

# or reading the message by path
notmuchtask  find-task test.eml

Exit codes

0

Command ran successfully. The task-id has been written to stdout

90

An unexpected error has occured

91

File not found. The file passed could not be opened

92

The message(-id) could not be found in notmuch

93

The task could not be found

Creating tasks

The find-or-create-task command will find the task(s) assigned to a

message and will create a new task if needed.

# reading the message from stdin
cat test.eml|notmuchtask  find-or-create-task
# the first time a new task is created with the subject as title
99c0768c-2dbd-4c8b-9b74-afe610653dd1

cat test.eml|notmuchtask  find-or-create-task
# the second time no new task is created
99c0768c-2dbd-4c8b-9b74-afe610653dd1

# or reading the message by path
notmuchtask  find-or-create-task test.eml
99c0768c-2dbd-4c8b-9b74-afe610653dd1

Exit codes

0

Command ran successfully. The task-id has been written to stdout

90

An unexpected error has occurred

91

File not found. The file passed could not be opened

92

The message(-id) could not be found in notmuch

(neo)mutt

Add this to your .muttrc:

# Make sure that there are no spaces at the beginning of the line
macro index,pager <F8> \
"<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter>\
<pipe-message>notmuchtask --debug find-or-create-task<enter>\
<enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
"notmuchtask: assign mail to a task"

configuring

notmuchtask can be configured by a config file:

[tags]
# notmuchtask uses notmuch tags to link messages to tasks
# `prefix` is used as a prefix to the taskid. E.g.
# if prefix is set to 'taskid:', and the task
# e1544da8-8b9b-4bda-b4bc-8642c5627b59 is linked to the message
# the tag 'taskid:e1544da8-8b9b-4bda-b4bc-8642c5627b59' is set on the
# message.
# default: taskid:
prefix = taskid:

[taskwarrior]
# Executable
#
executable = task

The following config files are evaluated, the first found configfile is used:

  1. The file passed with --configfile

  2. The file pointed to by the environment variable NOTMUCHTASKRC

  3. ~/.notmuchtask.conf

Develop

Tidbits about development.

Run DEV version

For testing purposes you can run the code directly from the repository:

# Setup the virtual environment
# Install site package with python3 bindings for notmuch
apt install python3-notmuch
pipenv --rm  # just in case
pipenv --python 3.6 --site-packages
pipenv install --dev
# run the code
pipenv shell
pip install --editable .

notmuchtask --help

TODOs

Known Bugs

  • Mails with non-utf-8 charset fail to parse

  • Messages without subject fail to parse

Ideas

Prio A (must), B (should), C (maybe never .. )

    1. Passthrough commands: enter the command for the task for a mail

    1. Edit task description on creation

    1. Use taskwarriors UDAs to store the message ID

    1. Transaction with task and notmuch incl. locking

    1. Virtual folder to include tasks in mutt (??) (FUSE?)

Changelog

Version 0.0.3 (2019-05-22)

  • Release for internal testing

  • Improved handling of non-standard e-mails

Version 0.0.2 (2019-05-20)

  • Release for internal testing

Version 0.0.1 (2019-05-19)

  • Initial test release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

notmuchtask-0.0.3.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

notmuchtask-0.0.3-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file notmuchtask-0.0.3.tar.gz.

File metadata

  • Download URL: notmuchtask-0.0.3.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for notmuchtask-0.0.3.tar.gz
Algorithm Hash digest
SHA256 efd86bd8a1290c6452edc4f6687ef8731ac7ccfc9e15605127d87d399351849b
MD5 ff80f7dd7925b4f249efad9639a321ed
BLAKE2b-256 8abe84ef680831b12a76d91df5e77ef18967db76eac139ed50a92ae07e3d5861

See more details on using hashes here.

File details

Details for the file notmuchtask-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: notmuchtask-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for notmuchtask-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 44ad3ae9ee08edaa0f655c18cc7efdf51bf978181626af8514332e12cfbc04c8
MD5 448a28def7fae9fa155fcbce06ba7323
BLAKE2b-256 585dfa79fae1ebc741e7aa5729654645b6a502f7655b51345753ecb9127b003a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page