Skip to content

feat: Added the ability to create a closing entry when TODOS are marked done as per logdone #984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

vHugoObject
Copy link

@vHugoObject vHugoObject commented Jul 13, 2024

In reference to issue #980. There is now an option to create a closing entry when TODOS are marked done. This is disabled by default. This can be enabled in the Organice settings, for a specific file using "#+STARTUP: logdone" or for a specific header by adding ":LOGGING: logdone" as a drawer property. The default behavior when enabled is to add the closing entry to the header. However, this setting will add the closing entry to your logbook drawer if you have org-log-into-drawer enabled in the Organice settings as well. The documentation has been updated to reflect this new addition.

Fixes #980

- Added logDone to the advanceTodoState action
- Revised the integration tests I added for advanceTodoState
- Added new unit tests for advanceTodoState
- Added LogDone, which uses the newly added functions addLogNote or addLogBookEntry to add a closing entry.
to use org-log-into-drawer setting with logdone
@vHugoObject vHugoObject changed the title Added the ability to create a closing entry when TODOS are marked done as per logdone feat: Added the ability to create a closing entry when TODOS are marked done as per logdone Aug 22, 2024
@vHugoObject
Copy link
Author

vHugoObject commented Sep 12, 2024

Can someone review? @schoettl @munen

Copy link
Collaborator

@schoettl schoettl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work! Nice that you also added many tests.

Unfortunately I wasn't able yet to run and test it locally. Since I last ran yarn install/start I've switched OS and now I get a lot of errors with node dependencies.

Maybe @munen has time to run a quick test?

Also, maybe we should upgrade to a newer node version...

@vHugoObject
Copy link
Author

@schoettl Did you use nvm?

@schoettl
Copy link
Collaborator

@schoettl Did you use nvm?

I tried but couldn't even install it on NixOS :/ I'll try again later this week.

@schoettl
Copy link
Collaborator

Hi @vHugoObject, I got my testing environment right and started playing. I like this feature, good work!

For reference:

I found a few bugs that you might want to fix:

  1. The CLOSED: […] word should be in the same line as SCHEDULED: or DEADLINE:
  2. The CLOSED: should be removed when the header's TODO state is changed to something other than a DONE state.
  3. If CLOSED: exists, another CLOSED: is added when I close a header again. The timestamp should be updated instead.
  4. The CLOSED: is currently placed below a :PROPERTIES: drawer (see screenshot below). It should be above it, right below the headline.
  5. The settings either :LOGGING: in a drawer or #+STARTUP: should be case-insensitive. E.g. :logging: logdone should have the same effect.

I recommend that you look into how SCHEDULED and DEADLINE are implemented, it should be pretty similar regarding parsing, output, and storing.

grafik

@aharish
Copy link

aharish commented Mar 18, 2025

Hi @schoettl! I recently re-did my entire Org setup and have moved from Orgzly to Organice so that I can also have my team mates use Org mode to track a project we started working on.

I noticed this feature was missing and came across the original issue thread and this PR. I would dearly love for this feature to exist, so that it would match similar behaviour on my Org mode setup on Emacs.

If it's okay with @vHugoObject and they have not worked on the fixes yet, I would like to pick up the fixes you have mentioned above. I have some time towards the end of this week that I can dedicate to these fixes if so.

@schoettl
Copy link
Collaborator

Hi @aharish, that would be very nice if you could pick up and finish this!

Maybe it's a good idea to merge master into this PR before you continue.

Do you plan to use Organice on the phone or desktop? On the phone, Organice currently might feel fragile because with vertical scroll it's too easy to accidentally swipe horizontally and delete items or set them to DONE. See #995 – just as a warning.

@aharish
Copy link

aharish commented Mar 19, 2025

Hi @aharish, that would be very nice if you could pick up and finish this!

Great! Will work on this then.

Maybe it's a good idea to merge master into this PR before you continue.

Yes, will do.

Do you plan to use Organice on the phone or desktop? On the phone, Organice currently might feel fragile because with vertical scroll it's too easy to accidentally swipe horizontally and delete items or set them to DONE. See #995 – just as a warning.

Both phone and desktop. At least I will be using it on the phone, my team mates probably not as much. I did notice that issue. I have run into a few other bugs/QOL improvements that can be made for a much better UX overall. I will compile a list and post them.

@aharish
Copy link

aharish commented Mar 26, 2025

Hi @schoettl - I just wanted to drop an update here as I have been working on this, and also clarify a couple of questions I had:

  • I have reimplemented the logic for adding the CLOSED: [...] entry using the same logic that is used in SCHEDULED: [...] or in DEADLINE: [...]. This means we can reuse a lot of the same functions for the planning items instead of creating new ones for the CLOSED entry. So updating the CLOSED entry or removing it when the TODO state changes becomes very trivial to implement.

  • I tested out the functionality from this PR, and I noticed that the CLOSED: [...] entry only fires when swiping the item, or toggling it through clicking on the TODO state in the header. It doesn't fire when the one of the TODO states are clicked when editing the title. I would like to add support for this as well in order to not have a broken UX.

  • Another thing that I noticed was that the header is only created when the last DONE state is activiated. So let's say that you have setup #+TODO_SEQ: as below

    #+TODO_SEQ: TODO NEXT WAITING | DONE CANCELLED
    

    The CLOSED entry is only added when the header is marked as CANCELLED, which might not be the most ideal case scenario since both DONE and CANCELLED are valid DONE states.

    I want to implement this the right way, and wanted to get your inputs on this.

  • I also wanted your input on one other thing as well - currently with my implementation, the CLOSED header gets added to the end of the planning items line. I think on Emacs, the official implementation acutally added this at the start of the line. Should we follow the same format so as to keep consistency with the way Org mode works?

@schoettl
Copy link
Collaborator

Hi @aharish, nice to hear you had time to work on this!

Hi @schoettl - I just wanted to drop an update here as I have been working on this, and also clarify a couple of questions I had:

  • I have reimplemented the logic for adding the CLOSED: [...] entry using the same logic that is used in SCHEDULED: [...] or in DEADLINE: [...]. This means we can reuse a lot of the same functions for the planning items instead of creating new ones for the CLOSED entry. So updating the CLOSED entry or removing it when the TODO state changes becomes very trivial to implement.

Sounds great!

  • I tested out the functionality from this PR, and I noticed that the CLOSED: [...] entry only fires when swiping the item, or toggling it through clicking on the TODO state in the header. It doesn't fire when the one of the TODO states are clicked when editing the title. I would like to add support for this as well in order to not have a broken UX.

Would be cool if you could fix such UX bugs on the way!

  • Another thing that I noticed was that the header is only created when the last DONE state is activiated. So let's say that you have setup #+TODO_SEQ: as below

    #+TODO_SEQ: TODO NEXT WAITING | DONE CANCELLED
    

    The CLOSED entry is only added when the header is marked as CANCELLED, which might not be the most ideal case scenario since both DONE and CANCELLED are valid DONE states.
    I want to implement this the right way, and wanted to get your inputs on this.

I would also consider that as a bug though I don't know for 100% how it behaves in Emacs.

  • I also wanted your input on one other thing as well - currently with my implementation, the CLOSED header gets added to the end of the planning items line. I think on Emacs, the official implementation acutally added this at the start of the line. Should we follow the same format so as to keep consistency with the way Org mode works?

So that's not a big deal in my opinion but behaving just like Emacs would be best.

I just want to point to some bugs I found earlier, but maybe you already saw it: #984 (comment)

I'm happy to review your changes in this or a new PR once you're ready to push :)
Just as a note, I'm on holiday for the weekend so I can't respond before Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing TODOs does not log as per logdone
3 participants