1

I am attempting to write a convenience function that would, on an item in an orgmode list, insert a checkbox if there is none, and do nothing otherwise.

The question is how would I be able to test for the existence of a checkbox in a list item?

I'm aware of testing for a list item via org-in-item-p, but am unable to find a similar predicate for checkboxes.

Any help would be appreciated. Thanks.

3
  • What version of orgmode are you on? In orgmode 8.2.10, there is org-at-item-checkbox-p. Mar 25, 2017 at 22:12
  • I have no idea. How do I check?
    – Wagk
    Mar 26, 2017 at 4:08
  • M-x org-version Mar 26, 2017 at 8:23

1 Answer 1

3

If you have a remotely recent version of Orgmode, you should have the function org-at-item-checkbox-p in org-list.el.

Look in your org-list.el to see if it's there. If not, update to a more recent version of Orgmode, or implement it yourself:

(defun org-at-item-checkbox-p ()
  "Is point at a line starting a plain-list item with a checklet?"
  (org-list-at-regexp-after-bullet-p "\\(\\[[- X]\\]\\)[ \t]+"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.