7

I'd like to have this sort of functionality:

* TODO master task
** [ ] my subtask 1   << checkbox in heading :-D
** [X] my completed subtask

With the C-c C-c combo checking/unchecking such checkmarks.

The reason is that I use sub-tasks extensivley but I don't want them to appear on my agenda.

Is this possible somehow?

  • 3
    Nope. Well, yes, technically possible, but I wouldn't touch the problem with a ten-foot pole. – Sean Allred Mar 13 '15 at 2:04
  • If I might ask though, why not just filter out subtasks from the agenda? – Sean Allred Mar 13 '15 at 2:13
  • 1
    Well, for things that take more than 10 hours, I have a '* TODO task', for things that take less than 10 hours I use check marks. I do want to keep sub-tasks in my agenda but have the flexibility of checkmarks+headings so that I could collapse sections. – Leo Ufimtsev Mar 13 '15 at 2:15
  • 2
    As far as I'm aware, you can already collapse these 'simple' lists (I don't know what else to call them). – Sean Allred Mar 13 '15 at 2:16
  • 1
    What Sean Allread said already: I think I tried once to change something like that in the heading and I ended up seeing strange artifacts any time I did something with headings (like in non-org-mode buffers, where I used org-struct etc.) – wvxvw Mar 13 '15 at 7:13
5

There are a couple of possibilities.

Edit: If you generally want to omit subentries of todo items in the agenda, set org-agenda-todo-list-sublevels to nil. This will generate lists with only the highest level todo item.

If all you need is folding, as Sean Allred pointed out, you can do this with plain list items of you set org-cycle-include-plain-lists to 'integrate.

If you want a checkbox marker in a headline and be able to toggle it, this shouldn't be too hard either. Here is an idea:

(defun org-toggle-headine-checkbox ()
  "Toggle checkbox marker in headlines."
  (interactive)
  (when (and (org-at-heading-p)
             (save-excursion
               (beginning-of-line)
               (looking-at "\\*+ +\\[\\(?1:[X ]?\\)\\]")))
    (let ((state (string= (match-string 1) "X")))
      (save-excursion
        (replace-match (format "%s" (if state " " "X")) nil t nil 1)))))

Bind it to a key of your liking. If you want it on C-c C-c, you could put a before advice on org-ctrl-c-ctrl-c; the problem with this approach is that C-c C-c on headlines already sets the tags.

Of course, there are other possibilities: Don't set a todo keyword at all (you can still mark them DONE and clock into the headline); set a different keyword (e.g. TASK) and filter in the agenda. etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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