[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Checkboxes and state toggling
From: |
Klaus Thoben |
Subject: |
Re: [O] Checkboxes and state toggling |
Date: |
Tue, 14 Jun 2011 22:22:59 +0200 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) |
Nick Dokos <address@hidden> writes:
>
> #+begin_src emacs-lisp
> (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)
> ;; check for the cookie: [100%] or [N/N]
> (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))
> (if (and (> (match-end 2) (match-beginning 2))
> (equal (match-string 2) (match-string 3)))
> ;; all done - do the state change
> (org-todo 'done))))))))
> #+end_src
>
> Nick
Thanks, works like charm.
Klaus