From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] New function org-reset-checkbox-state which always clears the checkboxes Date: Fri, 24 Apr 2009 09:28:53 -0400 Message-ID: <1240579733-7219-1-git-send-email-bernt@norang.ca> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LxLSh-0000fF-Fr for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:29:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LxLSe-0000ez-41 for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:29:03 -0400 Received: from [199.232.76.173] (port=56732 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LxLSd-0000ew-VS for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:29:00 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:56050) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LxLSd-0001PJ-M1 for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 09:28:59 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-01-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1LxLSc-0009h4-U0 for emacs-orgmode@gnu.org; Fri, 24 Apr 2009 13:28:59 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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