GithubHelp home page GithubHelp logo

neuhalje / notmuch-task Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 0.0 97 KB

notmuchmail, taskwarrior and mutt are about to be your next dreamteam

License: Other

Python 88.99% Shell 9.44% Makefile 1.57%
mutt neomutt taskwarrior notmuch

notmuch-task's Introduction

mail to taskwarrior

image

image

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?)

notmuch-task's People

Contributors

neuhalje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notmuch-task's Issues

Problems with e-mail from outlook.com

Hello,

For some time I've noticed that notmuch-task has a problem with e-mail coming from outlook.com:

DEBUG:root:Parsing message from stdin
DEBUG:root:Executing query 'id: <DU2PR02MB7558E90CFA5BCE0CBD3BAE48E98B9@DU2PR02MB7558.eurprd02.prod.outlook.com>'
Messageid ' <DU2PR02MB7558E90CFA5BCE0CBD3BAE48E98B9@DU2PR02MB7558.eurprd02.prod.outlook.com>'' not found in notmuch!
Press any key to continue...

If I look for the ID: DU2PR02MB7558E90CFA5BCE0CBD3BAE48E98B9@DU2PR02MB7558.eurprd02.prod.outlook.com in the notmuch database, I can find it without problems.

Another thing, your program depends on an old version of click, even though it still seems to work with the latest (8.0.3).


With regards,

Angelo Machils

notmuch-task fails 'no attribute Query'

Hello,

Perhaps no-one is looking at this anymore, but just wanted to report that notmuch-task has now started to fail every time:

DEBUG:root:Parsing message from stdin
DEBUG:root:Executing query 'id:PatrickF1/fzf.fish/repo-discussions/257/comments/[email protected]'
Unexpected error!
ERROR:root:module 'notmuch' has no attribute 'Query'
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.9/site-packages/notmuchtask/cli/commands.py", line 142, in find_or_create_task
    for task_id in _find_or_create_task(message_source, tag_prefix):
  File "/opt/homebrew/lib/python3.9/site-packages/notmuchtask/cli/commands.py", line 103, in _find_or_create_task
    task_ids = find_task_ids(message_repo, mail_meta.nm_message_id,
  File "/opt/homebrew/lib/python3.9/site-packages/notmuchtask/sync.py", line 12, in find_task_ids
    nm_messages = list(
  File "/opt/homebrew/lib/python3.9/site-packages/notmuchtask/messages/repository.py", line 98, in get_messages
    for message in self.do_query(query).search_messages():
  File "/opt/homebrew/lib/python3.9/site-packages/notmuchtask/messages/repository.py", line 85, in do_query
    return notmuch.Query(self.open(), query)
AttributeError: module 'notmuch' has no attribute 'Query'
Press any key to continue...

With regards,

Angelo Machils

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.