jschlatow / taskopen

Tool for taking notes and open urls with taskwarrior
GNU General Public License v2.0
364 stars 31 forks source link

include in-line annotations #24

Closed linuxcaffe closed 8 years ago

linuxcaffe commented 11 years ago

Annotations that do not link to external files are still annotations, there is no restrictions on the length of an in-line annotation, they can have labels and they should be treated as first-class citizens. In opening such an annotations, your $EDITOR is the only logical choice, but they should be listed with the others, and after

$ task 1 annotate www.taskwarrior.org $ task 1 annotate I want to consider this $ task 1 annotate ~/tasknotes/1.txt $ taskopen 1

the answer should be

3 annotation(s) found.

Please select an annotation: 1) www.taskwarrior.org 2) I want to consider this 3) ~/tasknotes/1.txt Type number:

jschlatow commented 11 years ago

The point of taskopen is to OPEN things thus I don't think there is a point in listing stuff that doesn't seem to be openable at all. I'd rather expose the corresponding regex to taskopenrc.

linuxcaffe commented 11 years ago

If I've created a long in-line annotation, it would be preferable to open it in my $EDITOR, that's "opening", no? and every other sort of annotation gets listed, where the contents of an in-line annotation may be of even higher value, it seems conspicuously absent. This is like a "task ID edit" that specifically opens annotations.

jschlatow commented 11 years ago

That's a totally different kind of black magic. What taskwarrior does on "task ID edit" is dumping all the data into a temporary file and parsing the file afterwards to see if something changed. Moreover, I think taskwarrior doesn't even support editing annotations. Therefore this would require removing the annotation and adding a new one (which messes up the timestamp). Quite dirty hacks needed to make this work.

I don't think that I'm going to implement that in taskopen. However this could possibly be done by providing an external script once the filtering regex can be set in taskopenrc.

linuxcaffe commented 11 years ago

cool, I see the black magic, the dirty-hacks required, and am satisfied to have put it out there. When and if the magic looks less black, the hack less dirty, let's put it in there ;-)

jschlatow commented 11 years ago

On second thought, it may not be as black as I assumed at first glance.

Editing annotations can be achieved by something like this:

task ID mod /old annotation text/new annotation text/

And perl can easily write the annotation into a tempfile(), open the editor, read back the (modified) file, unlink the file and tell taskwarrior to modify the annotation.

However, I would like to suppress those annotations by default. Maybe a '-r' as in raw should be used to enable this behaviour (which can then be used to edit file paths or URIs as well).

linuxcaffe commented 11 years ago

cool!

jschlatow commented 11 years ago

Related to #31

seschwar commented 11 years ago

Actually you can edit annotations with task edit. Changes in date and content are detected an applied afterwards. You can also add and delete whole annotations. At least with taskwarrior 2.2.0.

jschlatow commented 8 years ago

This is now configurable by setting TEXT_REGEX in taskopenrc.