emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [PATCH] New function org-reset-checkbox-state which always cle


From: Bernt Hansen
Subject: [Orgmode] [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
Date: Fri, 24 Apr 2009 09:28:53 -0400

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]