[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] Update statistic cookies when archiving
From: |
Jay Kamat |
Subject: |
[O] [PATCH] Update statistic cookies when archiving |
Date: |
Sat, 02 Sep 2017 16:09:28 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hi,
Currently, statistic cookies do not update when archiving headings. For
example, when archiving the 'Two' header in the below example:
* Top [50%]
** TODO One
** DONE Two
The status cookie on 'Top' does not get set to [100%].
I have attached a draft patch to add support for this. However, I think
it needs a little bit more work.
There are 3 archive methods, org-archive-subtree,
org-archive-to-archive-sibling, and org-archive-set-tag.
For org-archive-set-tag, setting the :ARCHIVE: tag does not seem to
affect the status cookie, so I did not touch that.
For org-archive-to-archive-sibling, I used the
(org-update-parent-todo-statistics) function, which seems to work as
expected.
For org-archive-subtree, the solution I came up with is a little more
complicated, to handle the edge case of archiving the last child
header. In this case, 'parent' refers to the wrong (or non-existent)
header, so I use a small function to call (org-up-heading-safe) on one
header above point, which seems to work even for this edge case. I'm not
entirely sure if it's the proper solution though.
Let me know if you have any feedback!
-Jay
- [O] [PATCH] Update statistic cookies when archiving,
Jay Kamat <=