Earl Chase <[email protected]> writes: > This is a complete refactor of `org-habit-parse-todo'. I have also added > tests in order to make sure the behavior of `org-habit-parse-todo' did > not change. Going forward, the key HABIT-TYPE can optionally be used > to set the type of a habit. I have assigned the symbol `log-done' to > the current and only habit-type supported by org-habit. > `org-habit--get-rx-for-state-change-notes', > `org-habit--get-done-dates-for-repeater', > `org-habit--parse-todo-with-repeater' and `org-habit-parse-todo' take > a habit-type as one of their arguments. They will only receive > `log-done' for that value until other habit-types are implemented. The > plan is to use those functions for numeric habits. This refactor will > also simplify the process of adding time based habits.
Thank you so much for doing this! This is amazing! I have been meaning to do something similar for a while. I wrote the current org-habit tests and I've attempted what you've done a few times so I'm probably a pretty good person to review this patch. I will do my best to review it tomorrow but today I think I have just enough time to dwell on your approach. The idea of setting the habit type manually for each headline in a property seems like a rational one. 1. A person will likely only use one method of marking a particular habit (ex: log-done, a clock entry, a table entry). 2. It means we can add an arbitrary number of habit types and it won't slow down parsing. 3. It would allow sharing habit files between different emacs configs. I doubt anyone would do this but I suppose it's still a point in favor of this approach. However, it was not the approach I was going to do once I got around to it. I was simply going to make `org-habit-parse-todo' a defcustom so people could bring their own functions as I doubt upstream org-mode will ever be capable of containing the amount of ways people want to mark stuff done (although I do belive it should contain a few more ways). I was also planning on doing this so I could simply add my habit customizations in my config file and not have to adjust my habit files whatsoever (I wouldn't need to add a "HABIT_STYLE" property). I do believe that we can combine the benefits of my approach and your approach together with a minimal addition of complexity. 1. Perhaps the default habit-type should be a defcustom instead of hard-coding it to `log-done'. 2. We need a way to allow users to bring their own org-habit parsing functions. Maybe a defcustom that is an alist of (HABIT_STYLE . parse-func). 3. It would be nice to be able to run multiple habit parsing functions on a single headline and combine the results. Again thank you so much for putting in the effort! I'll start reviewing the patch tomorrow. My suggestions can easily be added on at a later date (well the third one might be tricky). I just wanted to get your opinion on it. Also just a quick question about copyright: Do you have your FSF copyright assignment done? I don't see your name on this list: https://orgmode.org/worg/contributors.html Morgan
