[Users] Action to integrate Claws with Taskwarrior

Saša Janiška gour at atmarama.com
Mon Jul 12 17:31:28 CEST 2021


On Mon, 12 Jul 2021 13:10:56 +0200
Milan Obuch <claws-mail-users at dino.sk> wrote:

Hello Milan,

> I have no experience with Task Warrior, I just installed it now out of
> curiosity. So, let me reiterate what you wrote and comment...

Thank you very much for taking time to help!

> First, with selected mail, invoking action, you create a new task with
> mail's subject becoming task's description. Fine.

Correct.


> Now, what would you like to do, requires saving output of task's
> invocation to some variable - you need new task's id. This could be
> achieved easily using shells backtics operator (off my head without
> consulting man sh, something like
> 
> id=`task add $TEXT +in +email`

Have to work on that since the output of the above is e.g:

Created task 184.

> should do just this, but check syntax carefully, I may be wrong in
> some detail). I would probably recommend quoting $TEXT as "$TEXT" or
> something similar as subject in received mail can contain spaces or
> any other chars, potentially confusing shell's parser.

Yes, that's good point!

> With that id in a variable, you can then add another task's invocation
> in the same claws2tw.sh script before exit$? line, something like
> 
> task ann $id -- claws-mail --select $1
> 
> which should do just what you'd like to, assuming you modify your
> action

OK, after I resolve above parsing to extract the integer ot, it might
be good enough.

> I did not find 'taskopen' after
> installing TaskWarrion port to my FreeBSD workstation so no comment on
> that one, no idea what it does.

It's a separate project:

https://github.com/jschlatow/taskopen

> So my recommendation after writing this is try what I wrote and
> evaluate it, it could fullfill your needs according your mail. It is
> by far not perfect, I'd move grep and cur into shell script, so action
> invocation would be just
> 
> ~/bin/claws2tw.sh "%f"
> 
> and everything should be done inside the script.

Yes, will work on that!

> Some time ago I would recommend using Python plugin if you like (or at
> least are able to) write scripts in Python. It is good tool for
> creating more complicated tasks well integrated into Claws Mail's
> framework.

I thought that Python might be easier to tackle, if required, than
e.g. Perl. :-)

> As I was not able to build Python plugin for some period of time on my
> workstation and I missed its functionality, after some tests I decided
> to create another scripting plugin based on Lua.

Hmm, that's interesting...I was considering to jump into Lua
considering to use ConTeXt which is based on LuaTeX, but simply don't
have time for learning and just using Emacs' org-mode for my writings.

> It turned out to be
> surprisingly easy for me, using some concepts and functions from other
> plugins, so I stick for now with it and if I'd like to do something
> similar, I'd use Lua plugin.

Any (rough) idea how it would look like in Lua?

> It is not (yet) part of official Claws
> Mail's source tree, but I made it available via devel mailing list.

What is the chance to get into the core?

> You need to build it yourself if you'd like to try it, but it is
> easy, as I wrote in some mails to devel list.

OK. Is there public archive of devel list somewhere?



Sincerely,
Gour

-- 
He is a perfect yogī who, by comparison to his own self,
sees the true equality of all beings, in both their
happiness and their distress, O Arjuna!




More information about the Users mailing list