From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jay Kamat Subject: [PATCH] Update statistic cookies when archiving Date: Sat, 02 Sep 2017 16:09:28 -0400 Message-ID: <87r2voyi9z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doEjY-0002KR-Tw for emacs-orgmode@gnu.org; Sat, 02 Sep 2017 16:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doEjU-0004SV-Az for emacs-orgmode@gnu.org; Sat, 02 Sep 2017 16:09:36 -0400 Received: from mail-yw0-x235.google.com ([2607:f8b0:4002:c05::235]:36827) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1doEjU-0004RK-5o for emacs-orgmode@gnu.org; Sat, 02 Sep 2017 16:09:32 -0400 Received: by mail-yw0-x235.google.com with SMTP id h127so12749216ywf.3 for ; Sat, 02 Sep 2017 13:09:30 -0700 (PDT) Received: from laythe (res380d-128-61-81-32.res.gatech.edu. [128.61.81.32]) by smtp.gmail.com with ESMTPSA id c186sm1197412ywe.0.2017.09.02.13.09.29 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 02 Sep 2017 13:09:29 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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