camdez.com

Rule #1: There are no rules.

μProject: checkbox.el

| Comments

I’ve been playing with Emacs in the evenings lately and writing a lot of Elisp, and I just finished a little Emacs package for quickly manipulating textual checkboxes ([ ] / [x], etc.) in buffers, like a simple version of org-mode’s task manipulation, but available everywhere. It’s called checkbox.el.

For example, if you have a simple to-do list in a Markdown file like this:

- [ ] Buy gin<point>
- [ ] Buy tonic

And you invoke checkbox-toggle, you’ll get the following:

- [x] Buy gin<point>
- [ ] Buy tonic

Invoke it again and you’re back to the original unchecked version.

- [ ] Buy gin<point>
- [ ] Buy tonic

Next, if we add a line without a checkbox…

- [ ] Buy gin
- [ ] Buy tonic
- Buy limes<point>

We can invoke the command again to insert a new checkbox.

- [ ] Buy gin
- [ ] Buy tonic
- [ ] Buy limes<point>

checkbox.el understands how to work with comments in programming modes, tries to be smart about when and where it moves point (DWIM!), allows for a fully custom set of “checkboxes” (e.g. TODO, DONE, HOLD), can remove checkboxes entirely with a universal argument (C-u), or directly select a particular checkbox state (rather than cycling through them) when given a numeric prefix.

It also has a fairly extensive test suite leveraging ert, ecukes, and continuous integration via Travis CI. Check out checkbox.el on GitHub or install it via MELPA or Marmalade!

Comments