emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bob Wilson <millstadtf@gmail.com>
To: Kyle Meyer <kyle@kyleam.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Missing argument in org-reset-checkbox-state-subtree?
Date: Thu, 12 Nov 2020 15:38:25 -0800	[thread overview]
Message-ID: <63F5E930-CA35-4697-BAC6-DF4B2373ACBC@gmail.com> (raw)
In-Reply-To: <87lff76yz5.fsf@kyleam.com>

Thanks again Kyle,
   Per your suggestion I have reverted my change to org-reset-checkbox-state-subtree, and instead updated org-reset-checkbox-state-maybe in org-checklist.el (I’m much happier editing org add-ons than editing org!).

Specifically, I follow up org-reset-checkbox-state-subtree with a call to:
(org-map-entries ‘org-update-parent-todo-statistics)

and this seems to address my problem as well, but definitely more elegantly!

Kind regards,
Bob

> On Nov 11, 2020, at 7:22 PM, Kyle Meyer <kyle@kyleam.com> wrote:
> 
> Bob Wilson writes:
> 
>> I’m writing about a possible bug in
>> org-reset-checkbox-state-subtree. This function calls
>> org-update-checkbox-count-maybe with argument 'all, but this value is
>> not defined in the function (or anywhere else that I can see).
> 
> [ I'm looking at the copy on master (e9c3993ee), though org-list.el
>  hasn't changed since that last release. ]
> 
> org-reset-checkbox-state-subtree calls
> 
>    (org-update-checkbox-count-maybe 'all)
> 
> and org-update-checkbox-count-maybe calls
> 
>    (org-update-checkbox-count all)
> 
> And org-update-checkbox-count considers ALL, so I'm not spotting
> anything that's undefined.
> 
>> I’d like this value to be nil because I don’t want to update the
>> statistics cookies in the entire buffer, but I don’t see a way to do
>> this (pardon my limited elisp). My workaround is to add an optional
>> all argument to org-reset-checkbox-state-subtree and pass it to
>> org-update-checkbox-count-maybe.
> 
> Why does refreshing the stats for the entire buffer cause a problem for
> you?
> 
>> This seems like the desired functionality unless I’m missing
>> something. Is the current implementation intentional?
> 
> Yes, the change was made with a0bc3bdeb (org-list: fix update of
> check-boxes cookies in whole trees, 2011-06-20).  The example that
> prompted that change was reported at
> <https://orgmode.org/list/87fwn4bhcy.fsf@gmail.com/>.
> 
> Here's a reduced example:
> 
>  * a
>  ** aa [1/1]
>  - [X] l
>  ** ab [1/1]
>  - [X] m
> 
> Calling org-reset-checkbox-state-subtree with point at the top-level "a"
> should uncheck l and m and the stats of both subheadings should go to
> [0/1]:
> 
>  * a
>  ** aa [0/1]
>  - [ ] l
>  ** ab [0/1]
>  - [ ] m
> 
> If you were to drop `all' from -reset-checkbox-state-subtree's the call
> to -update-checkbox-count-maybe, the result would instead be
> 
>  * a
>  ** aa [1/1]
>  - [ ] l
>  ** ab [0/1]
>  - [ ] m



      parent reply	other threads:[~2020-11-12 23:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 17:37 Missing argument in org-reset-checkbox-state-subtree? Bob Wilson
2020-11-12  3:22 ` Kyle Meyer
2020-11-12 16:59   ` Bob Wilson
2020-11-12 23:10     ` Kyle Meyer
2020-11-12 23:38   ` Bob Wilson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63F5E930-CA35-4697-BAC6-DF4B2373ACBC@gmail.com \
    --to=millstadtf@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).