emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* automatically mark DONE when all sub checkboxes are checked
@ 2012-02-10 21:06 Peter Salazar
  2012-02-10 21:13 ` John Hendy
  2012-02-11 18:17 ` Nick Dokos
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Salazar @ 2012-02-10 21:06 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1378 bytes --]

Hello everyone! Org-mode is amazing. I've totally fallen in love with it.
Glad to be joining the community.

I'm trying to get org-mode to automatically mark DONE when all sub
checkboxes are checked. On http://orgmode.org/worg/org-faq.html, I found a
function that purports to do this.

I pasted the function into my .emacs file, but now I'm getting an error
message when I launch: "Symbol's value as variable is void:
org-checkbox-statistics-hook."

Any thoughts? Thanks in advance!


;; see http://thread.gmane.org/gmane.emacs.orgmode/42715
(add-to-list 'org-checkbox-statistics-hook (function
ndk/checkbox-list-complete))

(defun ndk/checkbox-list-complete ()
  (save-excursion
    (org-back-to-heading t)
    (let ((beg (point)) end)
      (end-of-line)
      (setq end (point))
      (goto-char beg)
      (if (re-search-forward
"\\[\\([0-9]*%\\)\\]\\|\\[\\([0-9]*\\)/\\([0-9]*\\)\\]" end t)
            (if (match-end 1)
                (if (equal (match-string 1) "100%")
                    ;; all done - do the state change
                    (org-todo 'done)
                  (org-todo 'todo))
              (if (and (> (match-end 2) (match-beginning 2))
                       (equal (match-string 2) (match-string 3)))
                  (org-todo 'done)
                (org-todo 'todo))))))))



P.S. Not sure if it's relevant, but I'm on OSX using Aquamacs 2.4.

[-- Attachment #2: Type: text/html, Size: 1966 bytes --]

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

end of thread, other threads:[~2012-02-13  8:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-10 21:06 automatically mark DONE when all sub checkboxes are checked Peter Salazar
2012-02-10 21:13 ` John Hendy
2012-02-10 22:31   ` Angel de Vicente
2012-02-10 22:47     ` John Hendy
2012-02-11  0:41       ` Nick Dokos
2012-02-11  2:20         ` John Hendy
2012-02-11 18:17 ` Nick Dokos
2012-02-13  8:08   ` Peter Salazar

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