Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
On Mon, Nov 2, 2009 at 12:29 AM, James TD Smith wrote: Hi Carsten and Mikael, On 2009-11-01 18:24:41(+0100), Carsten Dominik wrote: Hi Mikael, thanks for doing the testing! Yes, thanks a lot. James, do you want to integrate Mikaels changes? If yes, can you please do so and let me know when and from where I can pull? I've already applied the patch and pushed it to misc-new-features in my repo. Also, if one of you would like to go through the trouble to adapt the XEmacs version, that would be very nice. I'll have a go at it. I had forgotten there was another version of colview; if I had known I would made the changes there. I'll let you know when it's done. I cloned the repo at git://yog-sothoth.mohorovi.cc/org-mode.git but did not find `misc-new-features' branch and could not find the changes in the org-mode proper as well. The changes sound very interesting and I recently found a need for it. Hope you have not decided to abandon the feature. Warm regards and a very happy new year! -- Manish ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Manish, On 2009-12-30 17:02:47(+0530), Manish wrote: I cloned the repo at git://yog-sothoth.mohorovi.cc/org-mode.git but did not find `misc-new-features' branch and could not find the changes in the org-mode proper as well. The changes sound very interesting and I recently found a need for it. Hope you have not decided to abandon the feature. No, it's finished and working; I deleted the branch once Carsten had merged it into the main org branch. The changes are definately in 6.33 and later, it's mentioned in the Changelog. What version of org-mode are you using? Warm regards and a very happy new year! And to you as well. James -- |-James TD Smith-email/ahktenz...@mohorovi.cc-| ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Mikael, thanks for doing the testing! James, do you want to integrate Mikaels changes? If yes, can you please do so and let me know when and from where I can pull? Also, if one of you would like to go through the trouble to adapt the XEmacs version, that would be very nice. Thanks! - Carsten P.S. What needs to be added to the manual? On Oct 31, 2009, at 2:41 PM, Mikael Fornius wrote: Thanks for a very good explanation, now I understand and I have tested it successfully. Looks like it works perfectly well to me. The interactive function org-columns-new also works as expected. This is a very good addition and I think it can be useful in many different areas. It also opens for more advanced calculations in colview mode due to the extension of `org-columns-compile-map'. Personally I prefer using colview to tables for temporary views of dynamic and alive data (like my running exercise diary) and want to use it more then I do now. I have modified the patch with one missing parenthesis and a more extensive documentation string to the important variable `org-columns-format-compile-map' which I wrote most for my own recapitulation of the subject and understanding your patch. Also org-columns-new had a reference to free variable `funcs' and I changed it to `fun' (member of functions argument list) which I believe is the right one?, you have to check me on this. Two other references, probably older, to free variables I have also tried to fix by let binding them. Feel free to use it if you want. (Attached patch to this messages. Difference is against your misc-new-features branch pulled today.) As an ending parenthesis commenting column view in general: I see three small problems with org-colview that I (or someone else interested) should fix some day: 1. A annoying problem is not being able to have multiple columns summarizing the same property but with different operators. #+COLUMNS: %timestamp_...@min} %timestamp_...@max} This will result only in min calculations for both columns. I remember that I have looked at this before and think it is non trivial to fix because of the internal way data is collected and calculated. Almost a rewrite of this part is necessary. 2. Being able to use Emacs calc HMS forms (info (Calc) HMS forms) for calculating and presenting time as I can to in the org-mode spreadsheet. I use this time format to manipulate my exercise data now days. Maybe this be added easily with the new `calc' slot in the `org-columns-compile-map' structure. 3. More intelligent handling of property values like automatic detection of times, dates or numbers to simplify the definitions and have only one 'max' summary option instead of now three (max, :max, @max). Cheers! diff (And don't forget to patch the bastard colview-xemacs ;-), could be made effectively with a ediff manual merging I think.) -- Mikael Fornius - Carsten ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Carsten and Mikael, On 2009-11-01 18:24:41(+0100), Carsten Dominik wrote: Hi Mikael, thanks for doing the testing! Yes, thanks a lot. James, do you want to integrate Mikaels changes? If yes, can you please do so and let me know when and from where I can pull? I've already applied the patch and pushed it to misc-new-features in my repo. Also, if one of you would like to go through the trouble to adapt the XEmacs version, that would be very nice. I'll have a go at it. I had forgotten there was another version of colview; if I had known I would made the changes there. I'll let you know when it's done. P.S. What needs to be added to the manual? I have added the new summary types to the column attributes section. I have also menetioned the limitation that you can only have one summary type for any property in the column view.. James -- |-James TD Smith-email/ahktenz...@mohorovi.cc-| ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Thanks for a very good explanation, now I understand and I have tested it successfully. Looks like it works perfectly well to me. The interactive function org-columns-new also works as expected. This is a very good addition and I think it can be useful in many different areas. It also opens for more advanced calculations in colview mode due to the extension of `org-columns-compile-map'. Personally I prefer using colview to tables for temporary views of dynamic and alive data (like my running exercise diary) and want to use it more then I do now. I have modified the patch with one missing parenthesis and a more extensive documentation string to the important variable `org-columns-format-compile-map' which I wrote most for my own recapitulation of the subject and understanding your patch. Also org-columns-new had a reference to free variable `funcs' and I changed it to `fun' (member of functions argument list) which I believe is the right one?, you have to check me on this. Two other references, probably older, to free variables I have also tried to fix by let binding them. Feel free to use it if you want. (Attached patch to this messages. Difference is against your misc-new-features branch pulled today.) As an ending parenthesis commenting column view in general: I see three small problems with org-colview that I (or someone else interested) should fix some day: 1. A annoying problem is not being able to have multiple columns summarizing the same property but with different operators. #+COLUMNS: %timestamp_...@min} %timestamp_...@max} This will result only in min calculations for both columns. I remember that I have looked at this before and think it is non trivial to fix because of the internal way data is collected and calculated. Almost a rewrite of this part is necessary. 2. Being able to use Emacs calc HMS forms (info (Calc) HMS forms) for calculating and presenting time as I can to in the org-mode spreadsheet. I use this time format to manipulate my exercise data now days. Maybe this be added easily with the new `calc' slot in the `org-columns-compile-map' structure. 3. More intelligent handling of property values like automatic detection of times, dates or numbers to simplify the definitions and have only one 'max' summary option instead of now three (max, :max, @max). Cheers! diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 2c16d0b..ba99ff7 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -733,10 +733,20 @@ around it. (@max max_age max (lambda (x) (- org-columns-time x))) (@mean mean_age (lambda (rest x) (/ (apply '+ x) (float (length x - (lambda (x) (- org-columns-time x))) - Operator - format,function map. + (lambda (x) (- org-columns-time x + Operator - format,function,calc map. Used to compile/uncompile columns format and completing read in -interactive function org-columns-new.) +interactive function org-columns-new. + +operatorstring used in #+COLUMNS definition describing the +summary type +format symbol describing summary type selected interactively in +org-columns-new and internally in +org-columns-number-to-string and +org-columns-string-to-number +functioncalled with a list of values as argument to calculate +the summary value +calcfunction called on every element before summarizing) (defun org-columns-new (optional prop title width op fmt fun rest rest) Insert a new column, to the left of the current column. @@ -757,7 +767,7 @@ interactive function org-columns-new.) org-columns-compile-map) nil t)) (setq fmt (intern fmt) - funcs (cdr (assoc fmt (mapcar 'cdr org-columns-compile-map + fun (cdr (assoc fmt (mapcar 'cdr org-columns-compile-map (if (eq fmt 'none) (setq fmt nil)) (if editp (progn @@ -766,7 +776,7 @@ interactive function org-columns-new.) (setq cell (nthcdr (1- (current-column)) org-columns-current-fmt-compiled)) (setcdr cell (cons (list prop title width nil fmt nil - (car funcs) (cadr funcs)) + (car fun) (cadr fun)) (cdr cell (org-columns-store-format) (org-columns-redo))) @@ -1050,7 +1060,7 @@ Don't set this, this is meant for dynamic scoping.) (defun org-columns-uncompile-format (cfmt) Turn the compiled columns format back into a string representation. - (let ((rtn ) e s prop title op op-match width fmt printf fun) + (let ((rtn ) e s prop title op op-match width fmt printf fun calc) (while (setq e (pop cfmt)) (setq prop (car e) title (nth 1 e) @@ -1295,7 +1305,7 @@ and tailing newline characters. (org-columns-remove-overlays) (move-marker org-columns-begin-marker (point)) (let ((org-columns-time (time-to-number-of-days (current-time))) - cache maxwidths m p a d) + cache maxwidths m p a d fmt) (cond ((and
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
I will give this patch a try! -- Mikael Fornius ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Maybe someone other than me should test this because I am not sure if I understand it correctly? The only reference to age or creation time I can find is in the documentation string of org-sort-entries-or-items. ... creation time, which is assumed to be the first inactive time stamp at the beginning of a line. I pulled from your git://yog-sothoth.mohorovi.cc/org-mode.git misc-new-features branch and have tried a basic setup with timestamps as described with no success. I must have missed something. When I use org-columns-new (M-S-right/left) to add a column there is no choice named age or creation time, should I use TIMESTAMP_IA? When I do I have three (new?) options age, age, age as summary options and I think it should be min_age, mean_age, max_age instead? When I manually tried to summarize a %timestamp_...@mean} I got just numbers when I expected a date. I also have another problem with org-columns-new that when selecting a summary type the #+COLUMNS row is not updated, format specification works. I do not know if this is introduced by this patch or some other but it used to work... -- Mikael Fornius ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Mikael Fornius m...@abc.se writes: Maybe someone other than me should test this because I am not sure if I understand it correctly? The only reference to age or creation time I can find is in the documentation string of org-sort-entries-or-items. Now I found a reference in ChangeLog, SINCE it should be called, great, I will give it another try later on. -- Mikael Fornius ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Mikael, On 2009-10-29 14:17:11(+0100), Mikael Fornius wrote: Maybe someone other than me should test this because I am not sure if I understand it correctly? The only reference to age or creation time I can find is in the documentation string of org-sort-entries-or-items. ... creation time, which is assumed to be the first inactive time stamp at the beginning of a line. Sorry, I could have been more specific in my description of what the patch does. What it does is add three operators which can be applied to properties containing timestamps, which show the length of time between the timestamp and the current time for leaf entries, and either the minimum, maximum or average elapsed time for entries with children. The age/creation time thing is just a suggested usage. All my remember templates add a CREATED property containing a timestamp, so by adding %creat...@min} to the columns for a tree I can get a display of the time which has elapsed since that item was added. I pulled from your git://yog-sothoth.mohorovi.cc/org-mode.git misc-new-features branch and have tried a basic setup with timestamps as described with no success. I must have missed something. When I use org-columns-new (M-S-right/left) to add a column there is no choice named age or creation time, should I use TIMESTAMP_IA? When I do I have three (new?) options age, age, age as summary options and I think it should be min_age, mean_age, max_age instead? I didn't test org-columns-new much; I tend to set up columns manually using the COLUMNS property. I'll have to take a look at that. When I manually tried to summarize a %timestamp_...@mean} I got just numbers when I expected a date. You shouldn't see a date. You should see something like '22d 3h 4m 11s' giving the time since the first inactive timestamp in each item, and if an item has children the average of the values from the childen. If you have a file like: --8---cut here---start-8--- #+COLUMNS: %20ITEM %16timestamp_...@min} * Test 1 [2008-10-29 Thu 21:05] * Test 2 [2009-10-29 Thu 21:05] * Test 3 ** Test 4 [2009-10-29 Thu 20:05] ** Test 5 [2009-11-29 Thu 21:05] --8---cut here---end---8--- You should see something like this (from the column view dblock): --8---cut here---start-8--- | ITEM | TIMESTAMP_IA | |---+--| | * Test 1 | 365d 00h 04m 01s | |---+--| | * Test 2 | 0d 00h 04m 01s | |---+--| | * Test 3 | -31d 00h 04m 01s | | ** Test 4 | 0d 01h 04m 01s | | ** Test 5 | -31d 00h 04m 01s | --8---cut here---end---8--- I also have another problem with org-columns-new that when selecting a summary type the #+COLUMNS row is not updated, format specification works. I do not know if this is introduced by this patch or some other but it used to work... It's probably the patch. Thanks for testing this, and also for the improvements you made to column view which made this possible. James -- |-James TD Smith-email/ahktenz...@mohorovi.cc-| ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Mikael, On 2009-10-29 21:10:50(+0100), Mikael Fornius wrote: Mikael Fornius m...@abc.se writes: Maybe someone other than me should test this because I am not sure if I understand it correctly? The only reference to age or creation time I can find is in the documentation string of org-sort-entries-or-items. Now I found a reference in ChangeLog, SINCE it should be called, great, I will give it another try later on. The SINCE property was from my previous attempt at doing this. It doesn't exist in the new patch. I've fixed the problems with org-column-new you were having and pushed it to my repo, and fixed another bug which stopped the new operators working in column view in the agenda. Let me know if you have any more problems with the patch.. James -- |-James TD Smith-email/ahktenz...@mohorovi.cc-| ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi James, hi everyone, this is a reasonably complex patch - could we get some volunteers putting this to the test? Thanks. - Carsten On Oct 26, 2009, at 1:04 AM, James TD Smith wrote: I posted a patch to the list in July which added two new special properties intended for displaying the age of an entry in column view. After some discussion with Bastien (who was maintainer at the time) we decided I would reimplement this functionality using column summary operators. It took me a while bit I've finally got a working version. The patch is also available in the misc-new-features branch at git://yog-sothoth.mohorovi.cc/org-mode.git. --- lisp/ChangeLog | 38 +++--- lisp/org-colview.el | 198 +++ +--- lisp/org.el |4 +- 3 files changed, 156 insertions(+), 84 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b5848e..5677058 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,27 @@ +2009-10-25 James TD Smith ahktenz...@mohorovi.cc + + * org-colview.el (org-format-time-period): Function to format + times in fractional days for display. + (org-columns-display-here): Add support for showing a calculated + value in place of the property. + (org-columns): Set `org-columns-time' to the current time so time + difference calculations will work. + (org-columns-time): Use to store the current time when column view + is displayed, so all time differences will use the same reference + point. + (org-columns-compile-map): There is now an extra position in each + entry specifying the function to use to calculate the displayed + value for the non-calculated properties in the column, + (org-columns-compute-all): Set `org-columns-time' to the current + time so time difference calculations will work. + (org-columns-compute): Handle column operators where the values + used are calculated from the underlying property. + (org-columns-number-to-string): Handle the 'age' column format + (org-columns-string-to-number): Correct the function name (was + org-column...). Add support for the 'age' column format. + (org-columns-compile-format): Support the additional parameter in + org-columns-compile-map. + 2009-10-25 Carsten Dominik carsten.domi...@gmail.com * org-clock.el (org-clock-has-been-used): New variable. @@ -1543,20 +1567,14 @@ * org-exp.el (org-export-format-source-code-or-example): Fix bad line numbering when exporting examples in HTML. -2009-07-12 James TD Smith ahktenz...@mohorovi.cc - * org-colview.el (org-format-time-period): Formats a time in fractional days as days, hours, mins, seconds. (org-columns-display-here): Add special handling for SINCE and SINCE_IA to format for display. - * org.el (org-time-since): Add a function to get the time since an - org timestamp. - (org-entry-properties): Add two new special properties: SINCE and - SINCE_IA. These give the time since any active or inactive - timestamp in an entry. - (org-special-properties): Add SINCE, SINCE_IA. - (org-tags-sort-function): Add custom declaration for tags +2009-07-12 James TD Smith ahktenz...@mohorovi.cc + + * org.el (org-tags-sort-function): Add custom declaration for tags sorting function. (org-set-tags): Sort tags if org-tags-sort-function is set @@ -4423,7 +4441,7 @@ (org-agenda-change-all-lines, org-tags-sparse-tree) (org-time-string-to-absolute, org-small-year-to-year) (org-link-escape): Re-apply changes accidentially overwritten - by last commit to Emacs. + by last commit to Emacs 2008-11-23 Carsten Dominik carsten.domi...@gmail.com diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 374d22a..87c1412 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -111,8 +111,8 @@ This is the compiled version of the format.) (org-defkey org-columns-map [(shift meta left)] 'org-columns-delete) (dotimes (i 10) (org-defkey org-columns-map (number-to-string i) - `(lambda () (interactive) - (org-columns-next-allowed-value nil ,i + `(lambda () (interactive) +(org-columns-next-allowed-value nil ,i (easy-menu-define org-columns-menu org-columns-map Org Column Menu '(Column @@ -165,7 +165,7 @@ This is the compiled version of the format.) (face1 (list color 'org-agenda-column-dateline ref-face)) (pl (or (get-text-property (point-at-bol) 'prefix-length) 0)) (cphr (get-text-property (point-at-bol) 'org-complex-heading- regexp)) -pom property ass width f string ov column val modval s2 title) +pom property ass width f string ov column val modval s2 title calc) ;; Check if the entry is in another buffer. (unless props (if (eq major-mode
Re: [Orgmode] [PATCH] Add min/max/mean age operators to column view.
Hi Carsten, On 2009-10-28 18:01:44(+0100), Carsten Dominik wrote: this is a reasonably complex patch - could we get some volunteers putting this to the test? If anyone wants to test this, please pull from my git repo; there's a couple of missing brackets in this patch. James -- |-James TD Smith-email/ahktenz...@mohorovi.cc-| ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] [PATCH] Add min/max/mean age operators to column view.
I posted a patch to the list in July which added two new special properties intended for displaying the age of an entry in column view. After some discussion with Bastien (who was maintainer at the time) we decided I would reimplement this functionality using column summary operators. It took me a while bit I've finally got a working version. The patch is also available in the misc-new-features branch at git://yog-sothoth.mohorovi.cc/org-mode.git. --- lisp/ChangeLog | 38 +++--- lisp/org-colview.el | 198 --- lisp/org.el |4 +- 3 files changed, 156 insertions(+), 84 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1b5848e..5677058 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,27 @@ +2009-10-25 James TD Smith ahktenz...@mohorovi.cc + + * org-colview.el (org-format-time-period): Function to format + times in fractional days for display. + (org-columns-display-here): Add support for showing a calculated + value in place of the property. + (org-columns): Set `org-columns-time' to the current time so time + difference calculations will work. + (org-columns-time): Use to store the current time when column view + is displayed, so all time differences will use the same reference + point. + (org-columns-compile-map): There is now an extra position in each + entry specifying the function to use to calculate the displayed + value for the non-calculated properties in the column, + (org-columns-compute-all): Set `org-columns-time' to the current + time so time difference calculations will work. + (org-columns-compute): Handle column operators where the values + used are calculated from the underlying property. + (org-columns-number-to-string): Handle the 'age' column format + (org-columns-string-to-number): Correct the function name (was + org-column...). Add support for the 'age' column format. + (org-columns-compile-format): Support the additional parameter in + org-columns-compile-map. + 2009-10-25 Carsten Dominik carsten.domi...@gmail.com * org-clock.el (org-clock-has-been-used): New variable. @@ -1543,20 +1567,14 @@ * org-exp.el (org-export-format-source-code-or-example): Fix bad line numbering when exporting examples in HTML. -2009-07-12 James TD Smith ahktenz...@mohorovi.cc - * org-colview.el (org-format-time-period): Formats a time in fractional days as days, hours, mins, seconds. (org-columns-display-here): Add special handling for SINCE and SINCE_IA to format for display. - * org.el (org-time-since): Add a function to get the time since an - org timestamp. - (org-entry-properties): Add two new special properties: SINCE and - SINCE_IA. These give the time since any active or inactive - timestamp in an entry. - (org-special-properties): Add SINCE, SINCE_IA. - (org-tags-sort-function): Add custom declaration for tags +2009-07-12 James TD Smith ahktenz...@mohorovi.cc + + * org.el (org-tags-sort-function): Add custom declaration for tags sorting function. (org-set-tags): Sort tags if org-tags-sort-function is set @@ -4423,7 +4441,7 @@ (org-agenda-change-all-lines, org-tags-sparse-tree) (org-time-string-to-absolute, org-small-year-to-year) (org-link-escape): Re-apply changes accidentially overwritten - by last commit to Emacs. + by last commit to Emacs 2008-11-23 Carsten Dominik carsten.domi...@gmail.com diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 374d22a..87c1412 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -111,8 +111,8 @@ This is the compiled version of the format.) (org-defkey org-columns-map [(shift meta left)] 'org-columns-delete) (dotimes (i 10) (org-defkey org-columns-map (number-to-string i) - `(lambda () (interactive) - (org-columns-next-allowed-value nil ,i + `(lambda () (interactive) +(org-columns-next-allowed-value nil ,i (easy-menu-define org-columns-menu org-columns-map Org Column Menu '(Column @@ -165,7 +165,7 @@ This is the compiled version of the format.) (face1 (list color 'org-agenda-column-dateline ref-face)) (pl (or (get-text-property (point-at-bol) 'prefix-length) 0)) (cphr (get-text-property (point-at-bol) 'org-complex-heading-regexp)) -pom property ass width f string ov column val modval s2 title) +pom property ass width f string ov column val modval s2 title calc) ;; Check if the entry is in another buffer. (unless props (if (eq major-mode 'org-agenda-mode) @@ -189,19 +189,25 @@ This is the compiled version of the format.) (nth 2 column) (length property)) f (format