0

I have a set of tasks (TODOs), split into sub-tasks. I have 3 TODO states e.g. started, in-progress, and done.

As per the org manual the parent TODO can be made to show DONE - on setting of all children to DONE, and progress of completed sub tasks can be monitored by adding [/] to the parent ITEM.

When I export this with columnview I don't seem to be able to bring the [/] into the ITEM in the table. I can kinda get around this either by having a separate column for checkboxes which I can then summarise using using {X/}, but my table is already very wide and an extra column feels like noise.

Instead I'd like to have the [/] included in the in the parent TODO column , but as eg [1/2] is not a valid TODO type this obviously doesn't work. I can get around this by removing the TODO from parents and using the summary status below.

(defun org-columns--summary-status-count (statuses _)
    "Summarise statuses with a Complete cookie."
    (print statuses)
    (format "%d/%d"
        (cl-count-if (lambda (b) (string-equal b "DONE"))
             statuses)
        (length statuses)))

This is OK, but it what would be nicer would be would be to include the [1/2] in the ITEM rather than the TODO.

To do this I can write a collect function similar to this - to collect from a different column: Org mode column view dependent columns?

Something like this:

(defun org-collect-confirmed (property)
  (let ((prop (org-entry-get nil property))
    (confirmed (org-entry-get nil "TODO")))
    (if (and prop (string= "DONE" confirmed))
      "1"
      "0")))

Then my summary function would need to sum-up like org-columns--summary-sum, but also concatenate the parent ITEM and the [final sum / length of collection]. So the collector would have to return count on TODO and the string of the property.

My questions are:

  1. Am I over-complicating this - is there a simple way of included the [/] in ITEM of columnview?
  2. Assuming "No" to question 1. How do I extract the parent ITEM string from the property? I seem to be constrained by the fact that the COLLECT function must return a string rather than a tuple to represent both the ITEM and TODO columns AND that there is no way of knowing the level of the property in the heirachy in the SUMMARIZE and COLLECT functions as defined in org-columns-summary-types?

For more context current full document and code is here - I make a summary type named "C+" which uses the workaround above which is OK, but not ideal: https://raw.githubusercontent.com/falloutphil/Misc/master/cpd.org

Your Answer

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

Browse other questions tagged or ask your own question.