all messages for Emacs-related lists mirrored at yhetil.org
 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

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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.