0

I've created a little todo list with org mode and checkboxes, but the counter doesn't update automatically, is there a way to do that ? C-c C-c on the element works, but it seems a bit tedious to remember to update it your self. But an onload and onsave update would be nice :)

Example file.org

Taks [/]
- [ ] Todo1
- [ ] Todo2
- [ ] Todo3

2 Answers2

3

Calling this function:

(org-update-checkbox-count t)

will recalculate checkbox statistics in the whole document. Documentation here.

So you can add this method to save and load hooks.

Anyway, statistics cookies are normally updated automatically. If you add new items with M-S-RET, or you toggle checkboxes with C-c C-c, then the indicators are updated on the fly.

Juancho
  • 7,207
  • 27
  • 31
1

Thanks goes to: @Juancho, I was looking for this. Below is the function inside a local hook that works only in org-mode, as taken from here: How to add a hook to only run in a particular mode?

I added it to my .emacs, reloaded emacs and now upon save it autochecks things.

(defun custom_org_auto_check()
  (org-update-checkbox-count t)
  )

(add-hook 'org-mode-hook 
          (lambda () 
             (add-hook 'after-save-hook 'custom_org_auto_check nil 'make-it-local)))
Community
  • 1
  • 1
Leo Ufimtsev
  • 6,240
  • 5
  • 40
  • 48