Re: [O] More than one column view in a file

2012-05-01 Thread Ippei FURUHASHI
Hi Sebastien

"Sebastien Vauban"
 writes:

> Hello,
>
> I'd like to have a couple of different (column) views in my Org file, for
> example:
>
> - one (public) view with the estimated time only
> - another one (private, I mean "not exported") with the real clocked time

My previous patch and this patch cooperate to generate
the columnview dynamic block with given columns format.

The result for your example is shown below, and I hope you like it.
Please regard #+BEGIN line as 1 line, though it seems to be wrapped.


#+TITLE: Effort vs Estimate
#+AUTHOR:Seb Vauban

* Tasks
  :PROPERTIES:
  :ID:   49380c04-9b6e-4298-aff8-d936d9679d8e
  :COLUMNS:  %66ITEM(Task) %6Effort(Estim.){:} %6CLOCKSUM(Time)
  :END:

** TODO A

*** TODO A1
:PROPERTIES:
:Effort:   12:00
:END:
:LOGBOOK:
CLOCK: [2012-03-01 Thu 09:00]--[2012-03-01 Thu 17:00] =>  8:00
CLOCK: [2012-03-02 Fri 09:00]--[2012-03-02 Fri 17:00] =>  8:00
CLOCK: [2012-04-05 Thu 09:00]--[2012-04-05 Thu 12:45] =>  3:45
CLOCK: [2012-04-16 Mon 09:00]--[2012-04-16 Mon 14:45] =>  5:45
:END:

*** TODO A2
:PROPERTIES:
:Effort:   24:00
:END:

** TODO B
   :PROPERTIES:
   :Effort: 1:00
   :END:
   :LOGBOOK:
   CLOCK: [2012-03-01 Thu 09:00]--[2012-03-01 Thu 09:30] =>  0:30
   :END:

* Budget estimate

We have estimated the budget as follows:

#+tblname: dblock-tasks
#+BEGIN: columnview :hlines 1 :id "49380c04-9b6e-4298-aff8-d936d9679d8e" 
:maxlevel 3 :format "%6TODO %66ITEM(Task) %6Effort(Estim.){:}"
| TODO | Task| Estim. |
|--+-+|
|  | * Tasks |  37:00 |
| TODO | ** A|  36:00 |
| TODO | *** A1  |  12:00 |
| TODO | *** A2  |  24:00 |
| TODO | ** B|   1:00 |
#+END:

* Worked hours :noexport:

We have worked that much, and can compare with what had been estimated:

#+tblname: dblock-tasks
#+BEGIN: columnview :hlines 1 :id "49380c04-9b6e-4298-aff8-d936d9679d8e" 
:maxlevel 3 :format "%6TODO %66ITEM(Task) %6Effort(Estim.){:} %6CLOCKSUM(Time)"
| TODO | Task| Estim. |  Time |
|--+-++---|
|  | * Tasks |  37:00 | 26:00 |
| TODO | ** A|  36:00 | 25:30 |
| TODO | *** A1  |  12:00 | 25:30 |
| TODO | *** A2  |  24:00 |   |
| TODO | ** B|   1:00 |  0:30 |
#+END:


Best regards,
IP


>From 50701702a646064034eb4fc718862aa8b7f53bcd Mon Sep 17 00:00:00 2001
From: Ippei FURUHASHI 
Date: Wed, 2 May 2012 05:23:00 +0900
Subject: [PATCH] lisp/org-colview.el: add new param of format to columnview
 dblock

* lisp/org-colview.el (org-dblock-write:columnview): Add a new param,
:format which specifies the column view format to be output as
columnview dynamic block.

One can generate columnview dynamic block with chosen format:
  #+BEGIN: columnview :format "%6TODO %66ITEM(Task) %6Effort(Estim.){:}"
  #+END:

TINYCHANGE
---
 lisp/org-colview.el |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index c7b5d45..d3fb601 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1229,13 +1229,16 @@ (defun org-dblock-write:columnview (params)
 :vlines   When t, make each column a colgroup to enforce vertical lines.
 :maxlevel When set to a number, don't capture headlines below this level.
 :skip-empty-rows
-	  When t, skip rows where all specifiers other than ITEM are empty."
+	  When t, skip rows where all specifiers other than ITEM are empty.
+:format   When a non-nil string like \"%66ITEM(Task) %6Effort(Estim.){:}\",
+  it specifies the format of column view."
   (let ((pos (move-marker (make-marker) (point)))
 	(hlines (plist-get params :hlines))
 	(vlines (plist-get params :vlines))
 	(maxlevel (plist-get params :maxlevel))
 	(content-lines (org-split-string (plist-get params :content) "\n"))
 	(skip-empty-rows (plist-get params :skip-empty-rows))
+	(columns-fmt (plist-get params :format))
 	(case-fold-search t)
 	tbl id idpos nfields tmp recalc line
 	id-as-string view-file view-pos)
@@ -1265,7 +1268,7 @@ (defun org-dblock-write:columnview (params)
 	(save-restriction
 	  (widen)
 	  (goto-char (or view-pos (point)))
-	  (org-columns)
+	  (org-columns columns-fmt)
 	  (setq tbl (org-columns-capture-view maxlevel skip-empty-rows))
 	  (setq nfields (length (car tbl)))
 	  (org-columns-quit
-- 
1.7.9.msysgit.0



Re: [O] More than one column view in a file

2012-05-01 Thread Ippei FURUHASHI
Hi Sebastien,

"Sebastien Vauban"
 writes:

> Hello,
>
> I'd like to have a couple of different (column) views in my Org file

How about trying this patch which lets you have another format in column
view?

After applying this patch, try this at the Tasks tree in your example.
 M-: (org-columns "%66ITEM(Task) %6CLOCKSUM(Time) %6Effort(Estim.){:}")
to compare with the result of
 M-: (org-columns)

Best,
IP

(snip)
>
> #+TITLE: Effort vs Estimate
> #+AUTHOR:Seb Vauban
>
> * Tasks
>   :PROPERTIES:
>   :ID:   49380c04-9b6e-4298-aff8-d936d9679d8e
>   :COLUMNS:  %6TODO %66ITEM(Task) %6Effort(Estim.){:}
>   :END:
>
> ** TODO A
(snip and end)

>From ee660fcb0c5a3a547681d8390284bb57399e05bf Mon Sep 17 00:00:00 2001
From: Ippei FURUHASHI 
Date: Tue, 1 May 2012 12:11:06 +0900
Subject: [PATCH] org-colview.el: Add functions to column view with formats
 selectively

* lisp/org-colview.el (org-columns): Give new argument
`columns-fmt-string'.
* lisp/org-colview.el (org-columns-get-format-end-top-level): Split
this function into 2 functions, `org-columns-get-format' and
`org-columns-goto-top-level'.

For example, even if the item (or the parent) has the property,
  :COLUMNS:  %66ITEM(Task) %6Effort(Estim.){:} %6CLOCKSUM(Time)
Org can offer column view with another format by typing
  M-: (org-columns "%66ITEM(Task) %6Effort(Estim.){:}")
---
 lisp/org-colview.el |   30 ++
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5409701..c7b5d45 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -665,27 +665,41 @@ (defun org-columns-open-link (&optional arg)
 (org-open-link-from-string value arg)))
 
 (defun org-columns-get-format-and-top-level ()
-  (let (fmt)
+  (let (fmt (org-columns-get-format))
+(org-columns-goto-top-level)
+fmt))
+
+(defun org-columns-get-format (&optional fmt-string)
+  (interactive)
+  (let (fmt-as-property)
 (when (condition-case nil (org-back-to-heading) (error nil))
-  (setq fmt (org-entry-get nil "COLUMNS" t)))
-(setq fmt (or fmt org-columns-default-format))
+  (setq fmt-as-property (org-entry-get nil "COLUMNS" t)))
+(setq fmt (or fmt-string fmt-as-property org-columns-default-format))
 (org-set-local 'org-columns-current-fmt fmt)
 (org-columns-compile-format fmt)
+fmt))
+
+(defun org-columns-goto-top-level ()
+  (let ()
+(when (condition-case nil (org-back-to-heading) (error nil))
+  (org-entry-get nil "COLUMNS" t)
 (if (marker-position org-entry-property-inherited-from)
 	(move-marker org-columns-top-level-marker
 		 org-entry-property-inherited-from)
-  (move-marker org-columns-top-level-marker (point)))
-fmt))
+  (move-marker org-columns-top-level-marker (point))
 
-(defun org-columns ()
-  "Turn on column view on an org-mode file."
+(defun org-columns (&optional columns-fmt-string)
+  "Turn on column view on an org-mode file.  When `COLUMNS-FMT-STRING'
+is specified e.g. \"%66ITEM(Task) %6Effort(Estim.){:}\"), it is
+treated as format for columns, COLUMNS property."
   (interactive)
   (org-verify-version 'columns)
   (org-columns-remove-overlays)
   (move-marker org-columns-begin-marker (point))
   (let ((org-columns-time (time-to-number-of-days (current-time)))
 	beg end fmt cache maxwidths)
-(setq fmt (org-columns-get-format-and-top-level))
+(org-columns-goto-top-level)
+(setq fmt (org-columns-get-format columns-fmt-string))
 (save-excursion
   (goto-char org-columns-top-level-marker)
   (setq beg (point))
-- 
1.7.9.msysgit.0



Re: [O] More than one column view in a file

2012-05-01 Thread Ippei FURUHASHI
Hi Sebastien,

"Sebastien Vauban"
 writes:

> I'd like to have a couple of different (column) views in my Org file

How about trying this patch which let you have another format in column
view?

After applying this patch, try this.
  M-: (org-columns "%66ITEM(Task) %6Effort(Estim.){:}")

Best,
IP
>From ee660fcb0c5a3a547681d8390284bb57399e05bf Mon Sep 17 00:00:00 2001
From: Ippei FURUHASHI 
Date: Tue, 1 May 2012 12:11:06 +0900
Subject: [PATCH] org-colview.el: Add functions to column view with formats
 selectively

* lisp/org-colview.el (org-columns): Give new argument
`columns-fmt-string'.
* lisp/org-colview.el (org-columns-get-format-end-top-level): Split
this function into 2 functions, `org-columns-get-format' and
`org-columns-goto-top-level'.

For example, even if the item (or the parent) has the property,
  :COLUMNS:  %66ITEM(Task) %6Effort(Estim.){:} %6CLOCKSUM(Time)
Org can offer column view with another format by typing
  M-: (org-columns "%66ITEM(Task) %6Effort(Estim.){:}")
---
 lisp/org-colview.el |   30 ++
 1 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 5409701..c7b5d45 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -665,27 +665,41 @@ (defun org-columns-open-link (&optional arg)
 (org-open-link-from-string value arg)))
 
 (defun org-columns-get-format-and-top-level ()
-  (let (fmt)
+  (let (fmt (org-columns-get-format))
+(org-columns-goto-top-level)
+fmt))
+
+(defun org-columns-get-format (&optional fmt-string)
+  (interactive)
+  (let (fmt-as-property)
 (when (condition-case nil (org-back-to-heading) (error nil))
-  (setq fmt (org-entry-get nil "COLUMNS" t)))
-(setq fmt (or fmt org-columns-default-format))
+  (setq fmt-as-property (org-entry-get nil "COLUMNS" t)))
+(setq fmt (or fmt-string fmt-as-property org-columns-default-format))
 (org-set-local 'org-columns-current-fmt fmt)
 (org-columns-compile-format fmt)
+fmt))
+
+(defun org-columns-goto-top-level ()
+  (let ()
+(when (condition-case nil (org-back-to-heading) (error nil))
+  (org-entry-get nil "COLUMNS" t)
 (if (marker-position org-entry-property-inherited-from)
 	(move-marker org-columns-top-level-marker
 		 org-entry-property-inherited-from)
-  (move-marker org-columns-top-level-marker (point)))
-fmt))
+  (move-marker org-columns-top-level-marker (point))
 
-(defun org-columns ()
-  "Turn on column view on an org-mode file."
+(defun org-columns (&optional columns-fmt-string)
+  "Turn on column view on an org-mode file.  When `COLUMNS-FMT-STRING'
+is specified e.g. \"%66ITEM(Task) %6Effort(Estim.){:}\"), it is
+treated as format for columns, COLUMNS property."
   (interactive)
   (org-verify-version 'columns)
   (org-columns-remove-overlays)
   (move-marker org-columns-begin-marker (point))
   (let ((org-columns-time (time-to-number-of-days (current-time)))
 	beg end fmt cache maxwidths)
-(setq fmt (org-columns-get-format-and-top-level))
+(org-columns-goto-top-level)
+(setq fmt (org-columns-get-format columns-fmt-string))
 (save-excursion
   (goto-char org-columns-top-level-marker)
   (setq beg (point))
-- 
1.7.9.msysgit.0



Re: [O] More than one column view in a file

2012-04-20 Thread Bastien
Hi Johnny,

Johnny  writes:

> "Sebastien Vauban"  writes:
>
>> Bastien wrote:
>>> "Sebastien Vauban"  writes:
>>>
 I'd like to have a couple of different (column) views in my Org file
>>>
>>> This is currently not possible and would require a lot of work.
>
> This is something I have been looking for as well and it would be a
> great feature, if someone feels the inspiration to work on it! However,
> I went on to use different specification lines and choosing the one to
> use by commenting the ones not to use. This is a reasonable work around
> until I learn enough lisp to change it. :)

Mhh... you made me reread Sébastien'd proposal more carefully and I now
understand.  If the idea is to have the choice between several column
views, then it's easily feasible.  I thought the question was to have
several different overlays *simultaneously*... (and got half crazy by
just trying to imagine this.)

So, yes, let's think about this.

-- 
 Bastien



Re: [O] More than one column view in a file

2012-04-20 Thread Johnny
"Sebastien Vauban"  writes:

> Bastien wrote:
>> "Sebastien Vauban"  writes:
>>
>>> I'd like to have a couple of different (column) views in my Org file
>>
>> This is currently not possible and would require a lot of work.

This is something I have been looking for as well and it would be a
great feature, if someone feels the inspiration to work on it! However,
I went on to use different specification lines and choosing the one to
use by commenting the ones not to use. This is a reasonable work around
until I learn enough lisp to change it. :)

> A pity, but I completely conceive it was not clear that it could have be more
> promising this way (using the columns definition of the caller tree, not the
> callee one).
>

?

Regards,

J

-- 
Johnny



Re: [O] More than one column view in a file

2012-04-20 Thread Sebastien Vauban
Hi Bastien,

Bastien wrote:
> "Sebastien Vauban"  writes:
>
>> I'd like to have a couple of different (column) views in my Org file
>
> This is currently not possible and would require a lot of work.

A pity, but I completely conceive it was not clear that it could have be more
promising this way (using the columns definition of the caller tree, not the
callee one).

Best regards,
  Seb

-- 
Sebastien Vauban




Re: [O] More than one column view in a file

2012-04-20 Thread Bastien
Hi Sébastien,

"Sebastien Vauban"  writes:

> I'd like to have a couple of different (column) views in my Org file

This is currently not possible and would require a lot of work. 

Best,

-- 
 Bastien



[O] More than one column view in a file

2012-04-17 Thread Sebastien Vauban
Hello,

I'd like to have a couple of different (column) views in my Org file, for
example:

- one (public) view with the estimated time only
- another one (private, I mean "not exported") with the real clocked time

I thought about setting the columns I wish to display in the corresponding
sections... but it appears that the column specification that's taken into
account must be defined where the tasks are (file-wide, or in the "Tasks"
subtree) -- not where the table will be generated.

This, by no way, is a bug: nobody said it should be working the way I'd like
it to be working right now.

Though, I have the impression the current way is quite limiting.

But my question is simply: do you have any idea for a way to work around this?

In the following ECM, you see (on purpose) that PRIOR is displayed in both
columns, while only set in the PROPERTY of the Tasks subtree.

Best regards,
  Seb

--8<---cut here---start->8---
#+TITLE: Effort vs Estimate
#+AUTHOR:Seb Vauban

* Tasks
  :PROPERTIES:
  :ID:   49380c04-9b6e-4298-aff8-d936d9679d8e
  :COLUMNS:  %6TODO %66ITEM(Task) %6Effort(Estim.){:}
  :END:

** TODO A

*** TODO A1
:PROPERTIES:
:Effort:   12:00
:END:
:LOGBOOK:
CLOCK: [2012-03-01 Thu 09:00]--[2012-03-01 Thu 17:00] =>  8:00
CLOCK: [2012-03-02 Fri 09:00]--[2012-03-02 Fri 17:00] =>  8:00
CLOCK: [2012-04-05 Thu 09:00]--[2012-04-05 Thu 12:45] =>  3:45
CLOCK: [2012-04-16 Mon 09:00]--[2012-04-16 Mon 14:45] =>  5:45
:END:

*** TODO A2
:PROPERTIES:
:Effort:   24:00
:END:

** TODO B
   :PROPERTIES:
   :Effort: 1:00
   :END:
   :LOGBOOK:
   CLOCK: [2012-03-01 Thu 09:00]--[2012-03-01 Thu 09:30] =>  0:30
   :END:

* Budget estimate
  :PROPERTIES:
  :COLUMNS:  %66ITEM(Task) %6Effort(Estim.){:}
  :END:

We have estimated the budget as follows:

#+tblname: dblock-tasks
#+BEGIN: columnview :hlines 1 :id "49380c04-9b6e-4298-aff8-d936d9679d8e" 
:maxlevel 3
| TODO | Task| Estim. |
|--+-+|
|  | * Tasks |  37:00 |
| TODO | ** A|  36:00 |
| TODO | *** A1  |  12:00 |
| TODO | *** A2  |  24:00 |
| TODO | ** B|   1:00 |
#+END:

* Worked hours  :noexport:
  :PROPERTIES:
  :COLUMNS:  %66ITEM(Task) %6CLOCKSUM(Time) %6Effort(Estim.){:}
  :END:

We have worked that much, and can compare with what had been estimated:

#+tblname: dblock-tasks
#+BEGIN: columnview :hlines 1 :id "49380c04-9b6e-4298-aff8-d936d9679d8e" 
:maxlevel 3
| TODO | Task| Estim. |
|--+-+|
|  | * Tasks |  37:00 |
| TODO | ** A|  36:00 |
| TODO | *** A1  |  12:00 |
| TODO | *** A2  |  24:00 |
| TODO | ** B|   1:00 |
#+END:
--8<---cut here---end--->8---

-- 
Sebastien Vauban