From mboxrd@z Thu Jan 1 00:00:00 1970 From: Myles English Subject: Re: Bug: columnview times don't accumulate properly [7.8.03 (release_7.8.03.576.gbeb02)] Date: Fri, 16 Mar 2012 02:56:45 +0000 Message-ID: <87bonxjlsi.fsf@gmail.com> References: <87boo07ltk.fsf@ed.ac.uk> Reply-To: emacs-orgmode Mode , Myles English Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:41749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8NHP-0000w6-WA for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 22:52:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S8NHN-00061S-WD for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 22:52:35 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:32810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S8NHN-00061E-KI for emacs-orgmode@gnu.org; Thu, 15 Mar 2012 22:52:33 -0400 Received: by werj55 with SMTP id j55so4506080wer.0 for ; Thu, 15 Mar 2012 19:52:31 -0700 (PDT) In-Reply-To: <87boo07ltk.fsf@ed.ac.uk> (Myles English's message of "Tue, 13 Mar 2012 12:00:07 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Myles English , emacs-orgmode Mode --=-=-= >> On Tue, 13 Mar 2012 12:00:07 +0000, Myles English said: > 1. start with emacs -q > 2. find file test-sums.org (attached) > 3. adjust paths in the source block at the top of the file and evaluate > (execute?) it with C-c > 4. goto the columnview block and C-c > I would expect a table like this to be inserted: > | ITEM | Sum | > |---------------------------------------------+------| > | * Introduction | 5:40 | > |---------------------------------------------+------| > | ** test sums | 0:30 | > |---------------------------------------------+------| > | ** Getting warmed up | 5:10 | > |---------------------------------------------+------| > | *** Nitty gritty | 5:10 | > | *************** TODO Do something fantastic | 5:00 | > | *************** END | | > |---------------------------------------------+------| > | **** This is not added | 0:10 | > | *************** TODO Do something else | 0:10 | > | *************** END | | > Hoever, the table looks like this: > | ITEM | Sum | > |---------------------------------------------+------| > | * Introduction | 5:30 | > |---------------------------------------------+------| > | ** test sums | 0:30 | > |---------------------------------------------+------| > | ** Getting warmed up | 5:00 | > |---------------------------------------------+------| > | *** Nitty gritty | 5:00 | > | *************** TODO Do something fantastic | 5:00 | > | *************** END | | > |---------------------------------------------+------| > | **** This is not added | 0:10 | > | *************** TODO Do something else | 0:10 | > | *************** END | | > i.e. the 0:10 is not being picked up in the accumulation. The attached patch produces the expected output, for the same test file: I am an elisp novice so please would someone check this before I tag it as a [PATCH]. In particular, something I am not sure about is the "(require 'org-inlinetask)" which obviously introduces a dependency. --=-=-= Content-Disposition: attachment; filename=org-inlinetask.el.diff diff --git a/lisp/org-colview.el b/lisp/org-colview.el index 04d2b62..5645ed3 100644 --- a/lisp/org-colview.el +++ b/lisp/org-colview.el @@ -931,6 +931,7 @@ Don't set this, this is meant for dynamic scoping.") (defun org-columns-compute (property) "Sum the values of property PROPERTY hierarchically, for the entire buffer." (interactive) + (require 'org-inlinetask) (let* ((re org-outline-regexp-bol) (lmax 30) ; Does anyone use deeper levels??? (lvals (make-vector lmax nil)) @@ -942,7 +943,8 @@ Don't set this, this is meant for dynamic scoping.") (fun (nth 6 ass)) (calc (or (nth 7 ass) 'identity)) (beg org-columns-top-level-marker) - last-level val valflag flag end sumpos sum-alist sum str str1 useval) + (last-level org-inlinetask-min-level) + val valflag flag end sumpos sum-alist sum str str1 useval) (save-excursion ;; Find the region to compute (goto-char beg) @@ -951,16 +953,24 @@ Don't set this, this is meant for dynamic scoping.") ;; Walk the tree from the back and do the computations (while (re-search-backward re beg t) (setq sumpos (match-beginning 0) - last-level level + last-level (if (and (not (equal level 0) ) + (not (equal level org-inlinetask-min-level))) + level last-level) level (org-outline-level) val (org-entry-get nil property) valflag (and val (string-match "\\S-" val))) (cond ((< level last-level) ;; put the sum of lower levels here as a property - (setq sum (when (aref lvals last-level) + (setq sum (when (and + (not (equal last-level org-inlinetask-min-level)) + (aref lvals last-level)) (apply fun (aref lvals last-level))) - flag (aref lflag last-level) ; any valid entries from children? + sum2 (when (aref lvals org-inlinetask-min-level) + (apply fun (aref lvals org-inlinetask-min-level))) + sum (+ (or sum 0) (or sum2 0)) + flag (or (aref lflag last-level) ; any valid entries from children? + (aref lflag org-inlinetask-min-level)) ; or inline tasks? str (org-columns-number-to-string sum format printf) str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold) useval (if flag str1 (if valflag val "")) --=-=-= Thanks, Myles --=-=-=--