From: Myles English <mylesenglish@gmail.com>
To: Myles English <mylesenglish@gmail.com>,
emacs-orgmode Mode <emacs-orgmode@gnu.org>
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 [thread overview]
Message-ID: <87bonxjlsi.fsf@gmail.com> (raw)
In-Reply-To: <87boo07ltk.fsf@ed.ac.uk> (Myles English's message of "Tue, 13 Mar 2012 12:00:07 +0000")
[-- Attachment #1: Type: text/plain, Size: 2414 bytes --]
>> 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.
[-- Attachment #2: org-inlinetask.el.diff --]
[-- Type: text/plain, Size: 2237 bytes --]
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 ""))
[-- Attachment #3: Type: text/plain, Size: 17 bytes --]
Thanks,
Myles
next prev parent reply other threads:[~2012-03-16 2:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 12:00 Bug: columnview times don't accumulate properly [7.8.03 (release_7.8.03.576.gbeb02)] Myles English
2012-03-16 2:56 ` Myles English [this message]
2012-03-16 3:08 ` mylesenglish
2012-03-16 18:03 ` Achim Gratz
2012-03-23 21:38 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bonxjlsi.fsf@gmail.com \
--to=mylesenglish@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).