emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Bernt Hansen <bernt@norang.ca>
To: emacs-orgmode@gnu.org
Cc: Bernt Hansen <bernt@norang.ca>
Subject: [PATCH] New function org-reset-checkbox-state which always clears the checkboxes
Date: Fri, 24 Apr 2009 09:28:53 -0400	[thread overview]
Message-ID: <1240579733-7219-1-git-send-email-bernt@norang.ca> (raw)

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	other threads:[~2009-04-24 13:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 13:28 Bernt Hansen [this message]
2009-04-24 13:43 ` [PATCH] New function org-reset-checkbox-state which always clears the checkboxes Carsten Dominik
2009-04-24 15:48   ` Bernt Hansen
2009-05-04 14:58     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1240579733-7219-1-git-send-email-bernt@norang.ca \
    --to=bernt@norang.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).