emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Remaining work/progress report: nearly useful, help needed
@ 2012-10-10 13:49 Myles English
  2012-10-11 12:01 ` Myles English
  0 siblings, 1 reply; 5+ messages in thread
From: Myles English @ 2012-10-10 13:49 UTC (permalink / raw)
  To: Emacs Org mode

[-- Attachment #1: Type: text/plain, Size: 2682 bytes --]


Hi orgees,

In March I had a go at making a "Remaining work/progress report"[1].
Having make some progress, I am looking for:

- help,
- collaborators,
- opinions on whether this would be useful enough to be worth the
  effort,
- whether anyone else has something like this (but better) and
- any other wisdom,

with a view to contributing it.


Table of Contents
_________________

1 Features
2 Usage
3 How it works
4 Improvements necessary to make it truly useful


1 Features
~~~~~~~~~~

  Attachments: minimal.el my-progress.el a.org b.org

  Currently it can make a table consisting of a mixture of the Table of
  Contents (TOC) entries and the inline tasks within each section, e.g.:

   ITEM                         Effort  CLOCKSUM  Remaining   
  ------------------------------------------------------------
   .1 Heading One                           1:25              
   ... 1.1 A sub heading                    0:36              
   .        Draw a figure       1:00        0:36  0:24        
   ... 1.2 Another sub heading              0:49              
   .        Write this bit      1:20        0:49  0:31        


  Most of the code was available from various places so there is not
  much original work from me in this.


2 Usage
~~~~~~~

  - start emacs: emacs -Q -l minimal.el a.org

  - excute the emacs-lisp source blocks

  - refresh the "Remaining" properties:
    goto each property and press C-c s RET RET

  - Execute the dynamic block C-c c in "Progress table"


3 How it works
~~~~~~~~~~~~~~

  Whenever a task is clocked in to, the value of a new "Effort" property
  is prompted for.  When the task is clocked out of, a new property
  "Remaining" is added that is the difference of Effort special property
  CLOCKSUM.

  The buffer is exported ascii-like to get the TOC with its headline
  numbering, and is matched with corresponding lines of the captured
  column view.


4 Improvements necessary to make it truly useful
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  1. include a captured column view of the INCLUDEd file b.org: the file's
     headings are included in the TOC because it uses the new exporter, but
     not in the column-view.  Maybe exporting as org first and then
     taking the column view of that buffer would work.

  2. Accumulate the time Remaining in the same way that CLOCKSUM does;
     it propagates upwards to higher level headings so that you can see
     (e.g.) how long Chapter 1 will take in total

  3. Refresh all the Remaining properties automatically

  I would really appreciate some help, particularly with 1.

Thanks,

Myles


Footnotes: 
[1]  http://comments.gmane.org/gmane.emacs.orgmode/53567



[-- Attachment #2: minimal.el --]
[-- Type: application/emacs-lisp, Size: 180 bytes --]

[-- Attachment #3: my-progress.el --]
[-- Type: application/emacs-lisp, Size: 10843 bytes --]

[-- Attachment #4: a.org --]
[-- Type: text/plain, Size: 4978 bytes --]

#+COLUMNS: %50ITEM %5Effort %5CLOCKSUM %5Remaining

#+BEGIN_SRC emacs-lisp
  ;; (unload-feature 'my-progress)
  ;; (setq org-clock-in-prepare-hook nil
  ;;       org-clock-out-hook nil
  ;;       org-export-filter-final-output-functions nil)
  
  (load (concat default-directory "my-progress.el") nil t t)  
  (add-to-list 'org-export-filter-final-output-functions
               'my-progress-remove-toc-heading)
#+END_SRC

#+BEGIN_SRC emacs-lisp
  (setq org-properties-postprocess-alist
        '(("Remaining" lambda(value)
           (let ((clocksum (org-clock-sum-current-item))
                 (effort (org-duration-string-to-minutes
                          (org-entry-get (point) "Effort"))))
             (org-minutes-to-hh:mm-string (- effort clocksum))))))
  
  (require 'org-inlinetask)
  
  (add-hook 'org-clock-in-prepare-hook 'my-progress-org-mode-ask-effort 'append)
  (add-hook 'org-clock-out-hook
            (lambda () (org-set-property "Remaining" 0)) 'append)
#+END_SRC

* Heading One
** A sub heading
*************** TODO Inline ting
		CLOCK: [2012-10-10 Wed 11:07]--[2012-10-10 Wed 11:34] =>  0:27
		CLOCK: [2012-10-10 Wed 10:55]--[2012-10-10 Wed 11:04] =>  0:09
		:PROPERTIES:
		:Effort:   1:00
		:Remaining: 0:51
		:END:
*************** END

** Another sub heading
*************** TODO Write this bit
		CLOCK: [2012-10-10 Wed 11:10]--[2012-10-10 Wed 11:59] =>  0:49
		:PROPERTIES:
		:Effort:   1:20
		:Remaining: 0:31
		:END:
*************** END

** Heading with no inline tasks
*** a
    This heading could be omitted because it has no tasks.

* Heading Two
*************** TODO Finish writing under heading two
*************** END
** Sub heading that will show up in the table
*** Will this one?
*************** TODO Test
		CLOCK: [2012-10-10 Wed 11:55]--[2012-10-10 Wed 11:56] =>  0:01
		CLOCK: [2012-10-10 Wed 11:50]--[2012-10-10 Wed 11:54] =>  0:04
		:PROPERTIES:
		:Effort:   0:20
		:Remaining: 0:14
		:END:
*************** END

**** And this?
** Yet another subheading
*** A sub sub heading
    And an inline task:

*************** TODO Do an inline thing
		CLOCK: [2012-10-10 Wed 11:45]--[2012-10-10 Wed 11:50] =>  0:05
		:PROPERTIES:
		:Remaining: 0:15
		:Effort:   0:20
		:END:
*************** END
*** Another sub sub heading
**** This heading contains no tasks
   ...and so will not appear in the progress table.

#+INCLUDE: "b.org" :minlevel 1

* Progress table

#+name: progressTbl
#+BEGIN: columnview-toc :id file:/home/myles/tmp/toctbl/mwe/a.org
| ITEM                                               | Effort | CLOCKSUM | Remaining |   |
|----------------------------------------------------+--------+----------+-----------+---|
| .1 Heading One                                     |        |     1:25 |           |   |
| ... 1.1 A sub heading                              |        |     0:36 |           |   |
| .        Inline ting                               |   1:00 |     0:36 |      0:51 |   |
| ... 1.2 Another sub heading                        |        |     0:49 |           |   |
| .        Write this bit                            |   1:20 |     0:49 |      0:31 |   |
| ... 1.3 Heading with no inline tasks               |        |          |           |   |
| ...... 1.3.1 a                                     |        |          |           |   |
| .2 Heading Two                                     |        |     0:10 |           |   |
| .   Finish writing under heading two               |        |          |           |   |
| ... 2.1 Sub heading that will show up in the table |        |     0:05 |           |   |
| ...... 2.1.1 Will this one?                        |        |     0:05 |           |   |
| .             Test                                 |   0:20 |     0:05 |      0:14 |   |
| ... 2.2 Yet another subheading                     |        |     0:05 |           |   |
| ...... 2.2.1 A sub sub heading                     |        |     0:05 |           |   |
| .             Do an inline thing                   |   0:20 |     0:05 |      0:15 |   |
| ...... 2.2.2 Another sub sub heading               |        |          |           |   |
| .5 Progress table                                  |        |          |           |   |
|----------------------------------------------------+--------+----------+-----------+---|
| Total time [H:M]:                                  |   1:35 |          |           |   |

#+END:

#+BEGIN_SRC elisp
(org-export-as 'my-progress-toc)
#+END_SRC

#+RESULTS:
#+begin_example
1 Heading One
.. 1.1 A sub heading
.. 1.2 Another sub heading
.. 1.3 Heading with no inline tasks
..... 1.3.1 a
2 Heading Two
.. 2.1 Sub heading that will show up in the table
..... 2.1.1 Will this one?
.. 2.2 Yet another subheading
..... 2.2.1 A sub sub heading
..... 2.2.2 Another sub sub heading
3 Heading Three of main doc
.. 3.1 An included sub heading
.. 3.2 Yet another included subheading
..... 3.2.1 An included sub sub heading
4 Heading Four
5 Progress table
#+end_example

[-- Attachment #5: b.org --]
[-- Type: text/plain, Size: 450 bytes --]


* Heading Three of main doc
** An included sub heading
** Yet another included subheading
*** An included sub sub heading
    And an inline task:

*************** TODO Yet More Do an included inline thing
		CLOCK: [2012-10-10 Wed 12:42]--[2012-10-10 Wed 13:42] =>  1:00
		:PROPERTIES:
		:Effort:   1:30
		:Remaining: 0:30
		:END:
*************** END

* Heading Four
*************** TODO Finish writing under included heading two
*************** END

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Remaining work/progress report: nearly useful, help needed
  2012-10-10 13:49 Remaining work/progress report: nearly useful, help needed Myles English
@ 2012-10-11 12:01 ` Myles English
  2012-10-12 16:15   ` Myles English
  0 siblings, 1 reply; 5+ messages in thread
From: Myles English @ 2012-10-11 12:01 UTC (permalink / raw)
  To: Emacs Org mode


Just an update to say I have managed to do one of the things I was
asking for help with.  As with most things, it was easier than I
thought.


Myles English writes:

> Hi orgees,
>
> In March I had a go at making a "Remaining work/progress report"[1].
> Having make some progress, I am looking for:
>
> - help,
> - collaborators,
> - opinions on whether this would be useful enough to be worth the
>   effort,
> - whether anyone else has something like this (but better) and
> - any other wisdom,
>
> with a view to contributing it.

[yaddayadda]

> 4 Improvements necessary to make it truly useful
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>   1. include a captured column view of the INCLUDEd file b.org: the file's
>      headings are included in the TOC because it uses the new exporter, but
>      not in the column-view.  Maybe exporting as org first and then
>      taking the column view of that buffer would work.

Done!  It can be achieved by making this change to my-progress.el:

         (with-current-buffer (if view-file
                                  (get-file-buffer view-file)
                                (current-buffer))
+  ;; do everything in a copy of the current buffer
+  (org-export-with-current-buffer-copy
+          (org-export-expand-include-keyword)
           (save-excursion (setq mytoc (reverse (toc-alist))))
           (save-excursion
             (save-restriction

               (org-columns)
               (setq tbl (org-columns-capture-view maxlevel skip-empty-rows))
               (setq nfields (length (car tbl)))
-            (org-columns-quit))))
+              (org-columns-quit)))))
         (goto-char pos)
         (move-marker pos nil)
         (when tbl


>   2. Accumulate the time Remaining in the same way that CLOCKSUM does;
>      it propagates upwards to higher level headings so that you can see
>      (e.g.) how long Chapter 1 will take in total
>
>   3. Refresh all the Remaining properties automatically
>
>   I would really appreciate some help, particularly with 1.

2 & 3

>
>
> Thanks,
>
> Myles
>
>
> Footnotes: 
> [1]  http://comments.gmane.org/gmane.emacs.orgmode/53567

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Remaining work/progress report: nearly useful, help needed
  2012-10-11 12:01 ` Myles English
@ 2012-10-12 16:15   ` Myles English
  2012-10-13  1:48     ` Myles English
  0 siblings, 1 reply; 5+ messages in thread
From: Myles English @ 2012-10-12 16:15 UTC (permalink / raw)
  To: Emacs Org mode


Just in case anyone is following this, but it is starting to feel like
my own personal thread.

>> 4 Improvements necessary to make it truly useful
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Solved.

>>   2. Accumulate the time Remaining in the same way that CLOCKSUM does;
>>      it propagates upwards to higher level headings so that you can see
>>      (e.g.) how long Chapter 1 will take in total

This is done using {:} in the column specification:

#+COLUMNS: %10ITEM %5Effort{:} %5CLOCKSUM %5Remaining{:}

So now (part of) my dynamic block looks like this:

| ITEM                                 | Effort | CLOCKSUM | Remaining |
|--------------------------------------+--------+----------+-----------|
| .1 Heading One                       |   4:28 |     1:46 |      2:48 |
| ... 1.1 A sub heading                |        |     0:42 |           |
| .        Inline ting                 |   1:00 |     0:42 |      0:24 |
| ... 1.2 Another sub heading          |        |     1:04 |           |
| .        Write this bit              |   1:20 |     0:49 |      0:31 |
| .        Do something                |   1:23 |     0:05 |      1:18 |
| .        This bit too                |   0:45 |     0:10 |      0:35 |
| ... 1.3 Heading with no inline tasks |        |          |           |
| ...... 1.3.1 a                       |        |          |           |


>>   3. Refresh all the Remaining properties automatically

Any ideas?  (Don't worry I'll work it out....)

Myles

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Remaining work/progress report: nearly useful, help needed
  2012-10-12 16:15   ` Myles English
@ 2012-10-13  1:48     ` Myles English
  2012-12-22 17:29       ` Bastien
  0 siblings, 1 reply; 5+ messages in thread
From: Myles English @ 2012-10-13  1:48 UTC (permalink / raw)
  To: Emacs Org mode

[-- Attachment #1: my-progress.el --]
[-- Type: application/emacs-lisp, Size: 13816 bytes --]

[-- Attachment #2: Type: text/plain, Size: 4171 bytes --]


I have a solution that does everything I need apart from exclude DONE
items from the CLOCKSUM property.  Writing it here for posterity.

I get a table like this (Note: the "0:08" is from a DONE task that is
excluded from the table and the other property columns):

#+BEGIN: columnview-toc :id file:a.org
| ITEM                                               | Effort | CLOCKSUM | Remaining |   |
|----------------------------------------------------+--------+----------+-----------+---|
| .1 Heading One                                     |   3:28 |     1:13 |      2:23 |   |
| ... 1.1 First heading                              |        |          |           |   |
| ... 1.2 A sub heading                              |        |     0:08 |           |   |
| ... 1.3 Another sub heading                        |        |     1:05 |           |   |
| .        Write this bit                            |   1:20 |     0:50 |      0:30 |   |
| .        Do something                              |   1:23 |     0:05 |      1:18 |   |
| .        This bit too                              |   0:45 |     0:10 |      0:35 |   |
| ... 1.4 Heading with no inline tasks               |        |          |           |   |
| ...... 1.4.1 a                                     |        |          |           |   |
| .2 Heading Two                                     |   0:40 |     0:12 |      0:33 |   |
| .   Finish writing under heading two               |        |          |           |   |
| ... 2.1 Sub heading that will show up in the table |   0:20 |     0:05 |      0:14 |   |
| ...... 2.1.1 Will this one?                        |   0:20 |     0:05 |      0:14 |   |
| .             Test                                 |   0:20 |     0:05 |      0:14 |   |
| ... 2.2 Yet another subheading                     |   0:20 |     0:07 |      0:19 |   |
| ...... 2.2.1 A sub sub heading                     |        |     0:07 |           |   |
| .             Do an inline thing                   |   0:20 |     0:07 |      0:19 |   |
| ...... 2.2.2 Another sub sub heading               |        |          |           |   |
| .3 Heading Three of main doc                       |   2:28 |     1:00 |      0:30 |   |
| ... 3.1 An included sub heading                    |        |          |           |   |
| ... 3.2 Yet another included subheading            |   2:28 |     1:00 |      0:30 |   |
| ...... 3.2.1 An included sub sub heading           |        |     1:00 |           |   |
| .             Yet More Do an included inline thing |   1:30 |     1:00 |      0:30 |   |
| .4 Heading Four                                    |        |     0:06 |           |   |
| .   Finish writing under included heading two      |        |          |           |   |
| .   Somethingorother                               |   0:58 |     0:06 |           |   |
| .5 Progress table                                  |        |          |           |   |
|----------------------------------------------------+--------+----------+-----------+---|
| Total time [H:M]:                                  |   6:36 |          |      3:26 |   |

#+END:

By using the attached library (my-progress.el), having these columns
defined:

#+COLUMNS: %5ITEM %5Effort{:} %5CLOCKSUM %5Remaining{:}

and using this config:

;; ----------------------------- BEGIN my-progress.el --------
(add-to-list 'load-path "~/lib/lisp")
(require 'my-progress)
(add-to-list 'org-export-filter-final-output-functions
	     'my-progress-remove-toc-heading)
(add-to-list 'org-properties-postprocess-alist
	     '("Remaining" lambda(value)
	       (let ((clocksum (org-duration-string-to-minutes
				(my-get-clock-sum)))
		     (effort (org-duration-string-to-minutes
			      (org-entry-get (point) "Effort"))))
		 (org-minutes-to-hh:mm-string (- effort clocksum)))))

(add-hook 'org-clock-in-prepare-hook
	  'my-progress-org-mode-ask-effort 'append)

(add-hook 'org-clock-out-hook
	  (lambda ()
	    (org-set-property my-progress-remaining-property 0))
	  'append)

(add-hook 'org-after-todo-state-change-hook
	  'my-progress-rename-properties)
;; ----------------------------- END my-progress.el ----------

Myles

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Remaining work/progress report: nearly useful, help needed
  2012-10-13  1:48     ` Myles English
@ 2012-12-22 17:29       ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2012-12-22 17:29 UTC (permalink / raw)
  To: Myles English; +Cc: Emacs Org mode

Hi Myles,

Myles English <mylesenglish@gmail.com> writes:

> I have a solution that does everything I need apart from exclude DONE
> items from the CLOCKSUM property.  Writing it here for posterity.

This looks useful.  It's a bit big for adding it to org-hacks.org on
Worg.  If you happen to publish this online (on gitorious.org or any
other service), could you share the link so that I add a link to Worg?

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-22 23:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 13:49 Remaining work/progress report: nearly useful, help needed Myles English
2012-10-11 12:01 ` Myles English
2012-10-12 16:15   ` Myles English
2012-10-13  1:48     ` Myles English
2012-12-22 17:29       ` Bastien

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).