Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacs - org-mode insert checkbox

I am starting to use org-mode, to organise... well everything. I am following the manual.

Is there a binding in org-mode to insert items and checkboxes ? Ie. something like this :

 * TODO Organize party [2/4]
   - [-] call people [1/3]
     - [ ] Peter
     - [X] Sarah
     - [ ] Sam
   - [X] order food
   - [ ] think about what music to play
   - [X] talk to the neighbors [CURSOR HERE]

And now if I do M-x insert-checkbox-item (or similar, I haven't found the command) :

 * TODO Organize party [2/4]
   - [-] call people [1/3]
     - [ ] Peter
     - [X] Sarah
     - [ ] Sam
   - [X] order food
   - [ ] think about what music to play
   - [X] talk to the neighbors
   - [ ] [CURSOR HERE]

If possible, it would respect the indentation too. This would mean keeping the new item at the level of indentation of the item where the cursor was when invoking the command. Which means that it may have to skip a few lines of lower-level items.

like image 839
nha Avatar asked Dec 02 '15 09:12

nha


3 Answers

  1. For continuing checkbox lists (and ordinary lists) in org-mode I use org-autolist.

This should do exactly what you want.

  1. Also, for creating a new checkbox item I defined an emacs abbrev like so:

    ("rr" "- [ ]")

This means that I can type "rr " and emacs inserts "- [ ] " which is great.

like image 195
lono4040 Avatar answered Oct 07 '22 06:10

lono4040


Assuming point is already in a list like in your example, use org-insert-todo-heading, bound to M-S-return in Org by default. When point is in a checklist item C-c C-c will toggle its state.

This same binding will do other things depending on where point is, e.g. if you are at the end of a heading it will add another heading at the same level with a TODO keyword.

like image 14
Chris Avatar answered Oct 23 '22 20:10

Chris


Just C-u C-c C-c would do wherever your cursor on that line

Ref: https://orgmode.org/manual/Checkboxes.html

like image 9
Pravin Jadhav Avatar answered Oct 23 '22 22:10

Pravin Jadhav