emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
@ 2009-04-24 13:28 Bernt Hansen
  2009-04-24 13:43 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Bernt Hansen @ 2009-04-24 13:28 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Bernt Hansen

Copying subtrees with checked off lists to create a new task would
normally require the boxes to be unchecked.  This function lets
you easily clear all checkboxes in an entry without requiring
the RESET_CHECK_BOXES property.
---
This patch is available at git://git.norang.ca/org-mode.git for-carsten

 contrib/lisp/org-checklist.el |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org-checklist.el
index 9661b53..c3348bc 100644
--- a/contrib/lisp/org-checklist.el
+++ b/contrib/lisp/org-checklist.el
@@ -52,17 +52,22 @@
   "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
   (interactive "*")
   (if (org-entry-get (point) "RESET_CHECK_BOXES")
-      (save-restriction
-	(save-excursion
-	  (org-narrow-to-subtree)
-	  (org-show-subtree)
-	  (goto-char (point-min))
-	  (let ((end (point-max)))
-	    (while (< (point) end)
-	      (when (org-at-item-checkbox-p)
-		(replace-match "[ ]" t t))
-	      (beginning-of-line 2))))
-	(org-update-checkbox-count-maybe))))
+      (org-reset-checkbox-state)))
+
+(defun org-reset-checkbox-state ()
+  "Reset all checkboxes in an entry"
+  (interactive "*")
+  (save-restriction
+    (save-excursion
+      (org-narrow-to-subtree)
+      (org-show-subtree)
+      (goto-char (point-min))
+      (let ((end (point-max)))
+	(while (< (point) end)
+	  (when (org-at-item-checkbox-p)
+	    (replace-match "[ ]" t t))
+	  (beginning-of-line 2))))
+    (org-update-checkbox-count-maybe)))
 
 (defun org-make-checklist-export ()
   "Produce a checklist containing all unchecked items from a list
-- 
1.6.3.rc1.34.g0be9b

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

* Re: [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
  2009-04-24 13:28 [PATCH] New function org-reset-checkbox-state which always clears the checkboxes Bernt Hansen
@ 2009-04-24 13:43 ` Carsten Dominik
  2009-04-24 15:48   ` Bernt Hansen
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2009-04-24 13:43 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

Applied, thanks.

Maybe we should move this function into org-list.el.

- Carsten

On Apr 24, 2009, at 3:28 PM, Bernt Hansen wrote:

> Copying subtrees with checked off lists to create a new task would
> normally require the boxes to be unchecked.  This function lets
> you easily clear all checkboxes in an entry without requiring
> the RESET_CHECK_BOXES property.
> ---
> This patch is available at git://git.norang.ca/org-mode.git for- 
> carsten
>
> contrib/lisp/org-checklist.el |   27 ++++++++++++++++-----------
> 1 files changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/contrib/lisp/org-checklist.el b/contrib/lisp/org- 
> checklist.el
> index 9661b53..c3348bc 100644
> --- a/contrib/lisp/org-checklist.el
> +++ b/contrib/lisp/org-checklist.el
> @@ -52,17 +52,22 @@
>   "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES'  
> property is set"
>   (interactive "*")
>   (if (org-entry-get (point) "RESET_CHECK_BOXES")
> -      (save-restriction
> -	(save-excursion
> -	  (org-narrow-to-subtree)
> -	  (org-show-subtree)
> -	  (goto-char (point-min))
> -	  (let ((end (point-max)))
> -	    (while (< (point) end)
> -	      (when (org-at-item-checkbox-p)
> -		(replace-match "[ ]" t t))
> -	      (beginning-of-line 2))))
> -	(org-update-checkbox-count-maybe))))
> +      (org-reset-checkbox-state)))
> +
> +(defun org-reset-checkbox-state ()
> +  "Reset all checkboxes in an entry"
> +  (interactive "*")
> +  (save-restriction
> +    (save-excursion
> +      (org-narrow-to-subtree)
> +      (org-show-subtree)
> +      (goto-char (point-min))
> +      (let ((end (point-max)))
> +	(while (< (point) end)
> +	  (when (org-at-item-checkbox-p)
> +	    (replace-match "[ ]" t t))
> +	  (beginning-of-line 2))))
> +    (org-update-checkbox-count-maybe)))
>
> (defun org-make-checklist-export ()
>   "Produce a checklist containing all unchecked items from a list
> -- 
> 1.6.3.rc1.34.g0be9b
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
  2009-04-24 13:43 ` Carsten Dominik
@ 2009-04-24 15:48   ` Bernt Hansen
  2009-05-04 14:58     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Bernt Hansen @ 2009-04-24 15:48 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> Applied, thanks.
>
> Maybe we should move this function into org-list.el.

Sure if that makes sense.  I just refactored it in place without
thinking about where it should really live.

-Bernt

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

* Re: [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
  2009-04-24 15:48   ` Bernt Hansen
@ 2009-05-04 14:58     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-05-04 14:58 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode


On Apr 24, 2009, at 5:48 PM, Bernt Hansen wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> Applied, thanks.
>>
>> Maybe we should move this function into org-list.el.
>
> Sure if that makes sense.  I just refactored it in place without
> thinking about where it should really live.


I have renamed the function to `org-reset-checkbox-state-subtree'
and moved it to org-list.el.  You may need to update your key
bindings as the name has changed.

- Carsten

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

end of thread, other threads:[~2009-05-04 14:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-24 13:28 [PATCH] New function org-reset-checkbox-state which always clears the checkboxes Bernt Hansen
2009-04-24 13:43 ` Carsten Dominik
2009-04-24 15:48   ` Bernt Hansen
2009-05-04 14:58     ` Carsten Dominik

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