reddit / emacs

org-custom-cookies: create custom statistics cookies in org-mode

gsingh93 · 2022-09-27 22:29
gsingh93 · 2022-09-27 22:29
[org-custom-cookies](https://github.com/gsingh93/org-custom-cookies) is an Emacs package that allows you to create custom statistics cookies. If you don't know what statistics cookies are, create an org file like this: * My TODO List [/] ** TODO Task 1 ** TODO Task 2 Then run `M-x org-update-statistics-cookies` on the heading, and you'll see the heading update to "My TODO List [0/2]". Closing or adding new tasks will update the count in the heading. I found this feature useful, but was surprised to there were no ways to create your own customized version of this. I figured being able to create arbitrary cookies in headings that could display any information I could calculate with elisp would be a very powerful feature. So I created org-custom-cookies to allow you to do that. You can see the README for the installation and usage instructions, but in short, the package comes with three custom cookies to display the total clocked time, total scheduled time, and total effort in the heading, as well as some variables you can modify to add in your own functions to compute cookies. I've been using this for planning my day for the last year or so (it took me about a year to stop procratinating on tests and documentation), and I've found it useful. Let me know if you have any feedback or suggestions.
EFLS_ · 2022-09-28 12:30
> the package comes with three custom cookies to display the total clocked time, total scheduled time, and total effort in the heading That looks very useful! Esp. the total scheduled time seems interesting (as AFAIK these aren't easily calculated in org-columns).
gsingh93 · 2022-09-28 19:06
Yea, I first tried to figure out if I could get my workflow to work with `org-columns`, and after realizing I couldn't I decided to make this. I had a big problem with overestimating how much work I could get done in a day, leading to working late hours and getting stressed. The workflow I've switched to with this package has been: * Make a list of TODO items for the day * Schedule all my meetings * For each TODO item, add my estimated effort * If the total of the scheduled time and effort (shown in the custom cookie) is greater than 8 hours, move some tasks to the next day * Clock the time for the tasks I work on, at the end of the day compare the clocked time to the estimated effort. This has helped me plan a day better with a more reasonable number of tasks, and at the end of the day, if I feel like I didn't get much work done, I can see that I actually did accomplish a lot of work by looking at the clocked time. But since the package allows you to develop your own custom cookies, I'm interested to see what use cases others come up with as well.
yantar92 · 2022-09-29 13:01
Please be aware that cookies are a part of Org syntax and custom cookies may not be recognized by the parser leading to various subtle bugs. Also, extending cookie syntax has been proposed in the past (althoug from a different perspective) in https://orgmode.org/list/87zh6eymxs.fsf@localhost It might be interesting to discuss a possiblity to extend statistics cookies in the Org ML. https://orgmode.org/worg/org-mailing-list.html
gsingh93 · 2022-09-29 15:50
Thanks for the info! I haven't ran into any parser issues yet, but it makes sense that there could be some issues here in the future. When I get some time, I'll post to the mailing list around the possibility of built-in support for this feature, to avoid any parser issues.