[Users] Action to integrate Claws with Taskwarrior
Milan Obuch
claws-mail-users at dino.sk
Mon Jul 12 18:06:32 CEST 2021
On Mon, 12 Jul 2021 17:31:28 +0200, Saša Janiška <gour at atmarama.com>
wrote:
> 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!
>
Hi,
you presented an interesting problem, I was just in the right mood to
try 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.
>
Yes, I forgot, but using 'cut' basically the same way you did in your
script is an option.
> > 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
>
Ah, I see...
> > 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.
>
Well, Lua is interesting language, but it is a bit different. You need
to try think a bit different to fully appreciate it. In my experience,
it has its usage and for some task it is very efficient.
> > 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?
>
Basically one simple script for extracting desired data from mail and
create a task similar to your script invoked as action. My view is
surely a bit biased, but I think it is even a bit simpler than shell
script used as action.
> > 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?
>
Ask the project team :) Also, if there is some small community of users
of this plugin, chances are bigger. For now, I don't know anybody, I
just received some help from Torsten, who made installer for Windows
(big thanks, that's really usefull as well).
> > 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?
>
Taken from arbitrary mail to devel list:
https://lists.claws-mail.org/cgi-bin/mailman/listinfo/devel
Unfortunatelly, it is locked somehow. It used to be public. Maybe you
need to subscribe to devel mailing list and then you can access
archives, I did not try. If you like to try Lua plugin, send a message
to me privately and I'll send you necessary bits.
Regards,
Milan
More information about the Users
mailing list