emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] org-list.el: Reduce scope to subtree
       [not found] <861235485.1488189.1695598530412.ref@mail.yahoo.com>
@ 2023-09-24 23:35 ` J. G.
  2023-09-26  9:34   ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: J. G. @ 2023-09-24 23:35 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 134 bytes --]

Hi, this patch reduces the scope of the function org-reset-checkbox-state-subtree to just the subtree per its name and documentation.

[-- Attachment #1.2: Type: text/html, Size: 348 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-This-is-change-1.patch --]
[-- Type: text/x-patch, Size: 926 bytes --]

From f7b0e67935f7677fe2c238a17bf4f70ac962ab08 Mon Sep 17 00:00:00 2001
From: JG <jerzor@pacbell.net>
Date: Sun, 24 Sep 2023 16:17:45 -0700
Subject: [PATCH] org-list.el: Reduce scope to subtree

* lisp/org-list.el (org-reset-checkbox-state-subtree): Fix
scope of function call to update checkboxes to just subtree.
TINYCHANGE
---
 lisp/org-list.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-list.el b/lisp/org-list.el
index 7da10649d..023cfc0f8 100644
--- a/lisp/org-list.el
+++ b/lisp/org-list.el
@@ -2523,7 +2523,7 @@ subtree, ignoring planning line and any drawer following it."
 	    (when (org-at-item-checkbox-p)
 	      (replace-match "[ ]" t t nil 1))
 	    (forward-line 1)))
-	(org-update-checkbox-count-maybe 'all)))))
+	(org-update-checkbox-count-maybe)))))
 
 (defun org-update-checkbox-count (&optional all)
   "Update the checkbox statistics in the current section.
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] org-list.el: Reduce scope to subtree
  2023-09-24 23:35 ` [PATCH] org-list.el: Reduce scope to subtree J. G.
@ 2023-09-26  9:34   ` Ihor Radchenko
  2023-09-26 14:44     ` J. G.
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-09-26  9:34 UTC (permalink / raw)
  To: J. G.; +Cc: emacs-orgmode@gnu.org

"J. G." <jerzor@pacbell.net> writes:

> Hi, this patch reduces the scope of the function org-reset-checkbox-state-subtree to just the subtree per its name and documentation.
> ...
> -	(org-update-checkbox-count-maybe 'all)))))
> +	(org-update-checkbox-count-maybe)))))

Thanks for the patch, but without 'all argument,
`org-update-checkbox-count-may' will limit the scope to current
_heading_, not subtree.

May you please describe in more details the problem you experience?
Ideally with a reproducer. See https://orgmode.org/manual/Feedback.html#Feedback

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] org-list.el: Reduce scope to subtree
  2023-09-26  9:34   ` Ihor Radchenko
@ 2023-09-26 14:44     ` J. G.
  2023-10-05  9:40       ` Ihor Radchenko
  0 siblings, 1 reply; 5+ messages in thread
From: J. G. @ 2023-09-26 14:44 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 1857 bytes --]

 Good catch, thanks for the feedback.
The original problem I was attempting to correct was when making use of org-contrib's org-checklist.el feature to reset checkboxes with the RESET_CHECK_BOXES property. The earliest report of this bug I'm aware of is here: https://github.com/doomemacs/doomemacs/issues/1503
When the relevant headline has that property set, is recurring, and is marked as done, the headline and its subtrees (without my patch as I've now learned) have their checkboxes and counter cookies correctly reset. However, top level headlines elsewhere have their counter cookies incorrectly reset to [0/0].
I have attached an example org file which contains a subheading "The heading to mark done to reproduce the problem" that when set to done will demonstrate this problem. I see the top level headings "Test heading 2" and "Test heading 3" have their counter cookies set to [0/0] which is not the desired behavior.    On Tuesday, September 26, 2023 at 02:33:52 AM PDT, Ihor Radchenko <yantar92@posteo.net> wrote:  
 
 "J. G." <jerzor@pacbell.net> writes:

> Hi, this patch reduces the scope of the function org-reset-checkbox-state-subtree to just the subtree per its name and documentation.
> ...
> -    (org-update-checkbox-count-maybe 'all)))))
> +    (org-update-checkbox-count-maybe)))))

Thanks for the patch, but without 'all argument,
`org-update-checkbox-count-may' will limit the scope to current
_heading_, not subtree.

May you please describe in more details the problem you experience?
Ideally with a reproducer. See https://orgmode.org/manual/Feedback.html#Feedback

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
  

[-- Attachment #1.2: Type: text/html, Size: 4114 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/org, Size: 1736 bytes --]

* My top level heading to hold [1/3]
** TODO Another test heading
** DONE Yet another test heading
CLOSED: [2023-09-26 Tue 07:30]
** TODO The heading to mark done to reproduce the problem [3/3]
SCHEDULED: <2023-09-24 Sun ++1w>
:PROPERTIES:
:RESET_CHECK_BOXES: t
:END:
- [X] An extra box
- [X] Another extra box
- [X] Final extra box
*** DONE My first set [5/5]
CLOSED: [2023-09-26 Tue 07:06]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
*** DONE My second set [5/5]
CLOSED: [2023-09-26 Tue 07:06]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
*** DONE My third set [5/5]
CLOSED: [2023-09-26 Tue 06:49]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
* Test heading 2 [1/3]
:PROPERTIES:
:RESET_CHECK_BOXES: t
:END:
** TODO My first set 2 [3/5]
- [ ] My stuff
- [X] More stuff
- [ ] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
** TODO My second set 2 [3/5]
- [X] My stuff
- [X] More stuff
- [ ] Even more stuff
- [X] Lots of stuff
- [ ] Final stuff
** DONE My third set 2 [5/5]
CLOSED: [2023-09-26 Tue 06:49]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
* Test heading 3 [2/3]
:PROPERTIES:
:RESET_CHECK_BOXES: t
:END:
** TODO My first set 2 [4/5]
- [X] My stuff
- [X] More stuff
- [ ] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
** DONE My second set 2 [5/5]
CLOSED: [2023-09-26 Tue 07:10]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff
** DONE My third set 2 [5/5]
CLOSED: [2023-09-26 Tue 06:49]
- [X] My stuff
- [X] More stuff
- [X] Even more stuff
- [X] Lots of stuff
- [X] Final stuff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] org-list.el: Reduce scope to subtree
  2023-09-26 14:44     ` J. G.
@ 2023-10-05  9:40       ` Ihor Radchenko
  2023-10-05 13:04         ` Jeremias Gonzalez
  0 siblings, 1 reply; 5+ messages in thread
From: Ihor Radchenko @ 2023-10-05  9:40 UTC (permalink / raw)
  To: J. G.; +Cc: emacs-orgmode@gnu.org

"J. G." <jerzor@pacbell.net> writes:

> When the relevant headline has that property set, is recurring, and is marked as done, the headline and its subtrees (without my patch as I've now learned) have their checkboxes and counter cookies correctly reset. However, top level headlines elsewhere have their counter cookies incorrectly reset to [0/0].
> I have attached an example org file which contains a subheading "The
> heading to mark done to reproduce the problem" that when set to done
> will demonstrate this problem. I see the top level headings "Test
> heading 2" and "Test heading 3" have their counter cookies set to
> [0/0] which is not the desired behavior.

Thanks for providing the reproducer!
Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=88ff6c2fb

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] org-list.el: Reduce scope to subtree
  2023-10-05  9:40       ` Ihor Radchenko
@ 2023-10-05 13:04         ` Jeremias Gonzalez
  0 siblings, 0 replies; 5+ messages in thread
From: Jeremias Gonzalez @ 2023-10-05 13:04 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

On Thu, Oct 5, 2023 at 2:39 AM Ihor Radchenko <yantar92@posteo.net> wrote:

> Thanks for providing the reproducer!
> Fixed, on main.
> https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=88ff6c2fb


Wonderful, thank you! Looking at your patch it is definitely much more
involved than I was anticipating. Thank you very much for your hard work.

[-- Attachment #2: Type: text/html, Size: 767 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-05 13:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <861235485.1488189.1695598530412.ref@mail.yahoo.com>
2023-09-24 23:35 ` [PATCH] org-list.el: Reduce scope to subtree J. G.
2023-09-26  9:34   ` Ihor Radchenko
2023-09-26 14:44     ` J. G.
2023-10-05  9:40       ` Ihor Radchenko
2023-10-05 13:04         ` Jeremias Gonzalez

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).