# How to mimic Org-Mode with cell dingbats?

I love using org-mode to organize my to-do lists, the functionality is amazing, but it suffers from being stuck inside the emacs terminal...

I'm hoping to replicate some basic features into a notebook, specially checklists. I'm looking for something like this, where the cell dingbats are checkboxes and subitems get dynamically tallied:

So my question is:

How to make counters in cells that update based on the count of the checkboxes of their subitems?

It is unclear whether the checklist reflects the total number of boxes checked or the position of the boxes. For example if you only has the second box checked do you want to see [1/2] or [2/2]?

Having said that here is something quick to try:

x = {False, False};

CellPrint@
CellPrint@
TextCell[Text@
Row[{Dynamic@Row[{"[", Total@Boole@x, "/", Length[x], "]"}],
"Checklist"}, Spacer[5]], "Item", ShowStringCharacters -> False]
CellPrint@
"Subitem", ShowStringCharacters -> False]
CellPrint@
"Subitem", ShowStringCharacters -> False]


If you want to make this part of the cell dingbat rather than in the actual cell then:

CellPrint@
TextCell[Text@Row[{"Checklist"}, Spacer[5]], "Item",
ShowStringCharacters -> False,
CellDingbat ->
ToBoxes@Text@
Row[{Style["\[FilledSmallSquare]", Alignment -> Baseline,
RGBColor[0.8, 0.043, 0.008]],
Dynamic@Row[{"[", Total@Boole@x, "/", Length[x], "]"}]}]]


...but I think it is formatted better as is.

Edit

chewFood[numberOfCheckBoxes_] := Module[{x},
x = ConstantArray[False, numberOfCheckBoxes];
CellPrint@
CellPrint@
TextCell[
Text@Row[{Dynamic@Row[{"[", Total@Boole@x, "/", Length[x], "]"}],
"Checklist"}, Spacer[5]], "Item",
ShowStringCharacters -> False];
CellPrint@
TextCell[
Text@Row[{Checkbox[Dynamic[x[[#]]]],
"task " <> CharacterRange["a", "z"][[#]]}, Spacer[5]],
"Subitem", ShowStringCharacters -> False,
ShowGroupOpener -> False] & /@ Range[numberOfCheckBoxes];
]


• The ordering doesn't matter, if you only have the second box checked, it's still 1/2 total. Also, if one wants to quickly add more item cells the label would change to 1/n... – M.R. Jan 13 '15 at 22:06
• if the ordering doesn't matter then the above is ok? – Mike Honeychurch Jan 13 '15 at 22:13
• Yes, but it's not dynamically counting the cells underneath... so if i copy past task b into a task c, the Checklist should have [x/3] not [x/2]... – M.R. Jan 14 '15 at 0:31
• Did you change x from {False,False} to {False,False,False}`? No offense but you have a 4K rep and need to contribute as well! The answer was intended to get you started. – Mike Honeychurch Jan 14 '15 at 0:48
• Thanks! I honestly don't know how to achieve what I want - and it might not be possible... I'm not looking for a function that I have to re-execute, but a "dynamic cell style" for which option+return would duplicate and update everything appropriately. Sorry if the question was too vague! – M.R. Jan 14 '15 at 1:51