calcurse icon indicating copy to clipboard operation
calcurse copied to clipboard

[FEATURE REQUEST] Completion status for whole-day appointments

Open machinedgod opened this issue 5 years ago • 10 comments

Hello, the way I usually manage my daily tasks is not via task list, but via daily appointments that have no set time: 2020-11-11-093926_968x544_scrot

I manually type in the [ ] <task name> as description, then edit the task to add an x as a checkmark. If I don't manage to complete the task(s), I copy/paste them to another day and then delete them.

I only use tasklist for long-term tasks that I, at some point in time, have to remember to do. At that point, I schedule them into my day and remove them from the task list.

I am not sure if this is even acceptable feature, depending on the calcurse philosophy, but it'd be super useful for me (and I hope anyone else) if these three features would get in:

  • daily tasks (appointments without specific time, with a finished/unfinished state)
  • promotion of tasks from task list, to the daily task (selected day in calendar)
  • moving the task +-1day, +-1w, +-1m and +-1y (I couldn't figure out how to do this without copy pasting)

I'm fairly capable C coder, and I need this feature enough that I'd be willing to put it in myself, but I do need some guidance as to what is the best way to do this. Specifically: a) which datatype to look at as an example b) which datatype to extend with new functionality, or where to introduce a new one c) what would be acceptable key shortcuts for task promotion and task movement

IF this feature is unacceptable to calcurse, I am still hoping to get some help since in that case, I'd be maintaining a fork (which, if really necessary, could be private as well).

Sincerely

machinedgod avatar Nov 11 '20 14:11 machinedgod

Just a note - started working on it on my fork, have promotion part done, will add the rest shortly. I used 'P' key when TODO window is in focus, it seems not to be used anywhere.

Code is so easy to navigate through and change, I'm very impressed!

machinedgod avatar Nov 12 '20 14:11 machinedgod

Thank you for the interesting idea. Just to avoid any mistake, your "tasklist" is what in calcurse is called the to-do list, and your "daily task" is an event (as opposed to an appointment). Right?

You propose

  • daily tasks (appointments without specific time, with a finished/unfinished state)
  • promotion of tasks from task list, to the daily task (selected day in calendar)
  • moving the task +-1day, +-1w, +-1m and +-1y (I couldn't figure out how to do this without copy pasting)

The last bullet is possible for appointments, but at present not for events, the only reason being that nobody implemented it. I have done it in my private version of calcurse, and it would be a minor effort to carry it over. It's useful in its own right. Tip: you can "move" with delete-paste.

The second bullet is similar to #228, and seems to have been implemented by @igordsm in a calcurse clone.

The first bullet requires a change to the data format for events both on- and offline. It is a major task.

lhca avatar Nov 12 '20 14:11 lhca

Hi! Sorry for the terminology confusion, you're correct an all corrections :-)

So, I've implemented the second bullet (just checked #228, it is pretty much the same thing), the third I haven't looked at yet, and for the second - I decided to just automate what I currently am doing (for starters) which means, rather than modifying the internal checked state (and -I assume- update the aptev_ptr union with a new event type), I would:

  1. Verify that the item is of EVNT type
  2. Check whether it contains [ ] as first three characters 3a. If no, prepend [ ] 3b. If yes, replace with [x]

I am currently looking at getstring.c to understand how are you handling dynamic strings.

machinedgod avatar Nov 12 '20 15:11 machinedgod

OK, here are two first bullets, I recorded the functionality in action with asciinema: https://asciinema.org/a/DOny7NkbO75gm7tbO2XZC2soS

I am assuming you might merge over the bullet 3 from your private branch?

I'll create a PR, and whenever you have extra time, please feel free to provide any remarks you have, from code style, across uxp over to implementation details. I'll address them, perhaps not immediately, but I will for sure.

Edit: just realized I made a boo-boo while rebasing the commits :-D I'll create PR nevertheless, then address it.

machinedgod avatar Nov 12 '20 16:11 machinedgod

Interesting proposal. I envision an implementation that is slightly more generic and further blurs the line between calendar/todo items:

  • There are three types of items: items with a specific start time ("appointments"), items with a date but no specific start time ("events"), items without any specific start time/data at all ("todo items").
  • Items can be promoted from either type to another (e.g. by adding or removing a start time/date).
  • All items can be marked as done and can be assigned a priority. Items are ordered by date/time first (if exists), then by priority, then alphabetically.

What do you think?

lfos avatar Nov 14 '20 16:11 lfos

Sounds like an ideal approach; I am just wary of the large data refactoring. I am by no means experienced enough with calcurse codebase to pull that off easily, myself, and I don't have infinite amount of to tinker with it :-\

Would you consider accepting PR to get the functionality in - and then we can make a plan of attack on redoing the internals to fit the vision? The reason I propose this is, is because the code in question is short enough that it won't severely impact the future inner rework.

I imagine that hardest part must be painless migration, ie. taking all existing user's data and migrating it to the new data format. Not all users keep their data dirs in git, and might be pretty upset if somehow, the migration corrupts it. Other than that, from what I recall, modifying the core structures should be mostly just codemonkey job. As I said, code is so readable, I can't remember the last time I worked with codebase this clean.

P.S. Sorry for the delay in reply, for one reason or another, github didn't notify me.

machinedgod avatar Nov 17 '20 21:11 machinedgod

@lfos above:

  • Items can be promoted from either type to another (e.g. by adding or removing a start time/date).

"Promoted" or, more generally, "moved".

At present (recurrent) appointments can be moved, i.e. the start date-time value can be edited by selecting the subcommand "Move" of the "Edit" command. As mentioned above, this is not - for no particular reason - implemented for events. I am about to do that.

But at the same time I would like to propose that "Move" is made a separate command on level with "Add", "Del" and "Edit", and removed from the "Edit" command. At first, "Move" only involves editing the date (of events) or date-time (of appointments). Later, "Move" can be enhanced to moving between item types.

Calcurse command keys are in short supply, and there is no really good choice left for a default move key. I propose Ctrl+O (control+upper case o).

lhca avatar Nov 29 '20 15:11 lhca

@lfos above: At present (recurrent) appointments can be moved, i.e. the start date-time value can be edited by selecting the subcommand "Move" of the "Edit" command. As mentioned above, this is not - for no particular reason - implemented for events. I am about to do that.

But at the same time I would like to propose that "Move" is made a separate command on level with "Add", "Del" and "Edit", and removed from the "Edit" command. At first, "Move" only involves editing the date (of events) or date-time (of appointments). Later, "Move" can be enhanced to moving between item types.

If possible, could this be done in a more interactive way as well? For example, the way there are buttons now to move +- one day, +- one week, month, year... could we append a behaviour that when a modifier key is held down, it moves currently selected event/appointment to the same place?

If yes, I'm wondering if some command keys would need reassigning (I haven't verified this), but I could do this.

Calcurse command keys are in short supply, and there is no really good choice left for a default move key. I propose Ctrl+O (control+upper case o).

One thing to consider could be modal input (ie. using 'arpeggios' rather than key chords). This way commands could be organized in a rose tree (rather than being a set).

machinedgod avatar Nov 29 '20 19:11 machinedgod

If possible, could this be done in a more interactive way as well? For example, the way there are buttons now to move +- one day, +- one week, month, year... could we append a behaviour that when a modifier key is held down, it moves currently selected event/appointment to the same place?

Interesting idea. There is an undocumented feature that does something similar: the move commands may be prepended a "repeat" factor. Assuming the default key mappings, if you type 5t, the selected day is moved five days ahead, 5T will move back again. Similarly for the other move commands. There are also vi-style cut/delete/paste buffers: c/p (or d/p) use an anonymous buffer, while "ac/"ap use buffer a. There are 36 buffers (a - z, 0-9). Presumably this could be extended to cover your proposal.

lhca avatar Nov 30 '20 16:11 lhca

I like the proposal. We should also think of moving less common key bindings to a prefixed command (similarly to the g and z keys in vim). Moving here probably primarily applies to new bindings and doesn't necessarily apply to existing bindings, unless we suspect that those new bindings will be more useful (or used more frequently) than existing ones.

lfos avatar Dec 19 '20 14:12 lfos