emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-clock-report to insert a :scope sutree report when called from within a subtree?
@ 2011-03-17 10:52 Bastien
  2011-03-17 13:26 ` John Hendy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Bastien @ 2011-03-17 10:52 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi all,

The default when creating a clock report is to use :scope file.  I find
it not practical for big files, where the report can take long to build.

I'm thinking of applying this change: when called from within a subtree,
`C-c C-x C-r' will insert a clock report with ":scope subtree", and use
":scope subtree" elsewhere.

Please let me know if you think that's a bad idea.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-clock.el.patch --]
[-- Type: text/x-patch, Size: 1286 bytes --]

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index c567a26..87b175c 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1652,7 +1652,10 @@ fontified, and then returned."
 (defun org-clock-report (&optional arg)
   "Create a table containing a report about clocked time.
 If the cursor is inside an existing clocktable block, then the table
-will be updated.  If not, a new clocktable will be inserted.
+will be updated.  If not, a new clocktable will be inserted.  The scope
+of the new clock will be subtree when called from within a subtree, and 
+file elsewhere.
+
 When called with a prefix argument, move to the first clock table in the
 buffer and update it."
   (interactive "P")
@@ -1662,8 +1665,12 @@ buffer and update it."
     (org-show-entry))
   (if (org-in-clocktable-p)
       (goto-char (org-in-clocktable-p))
-    (org-create-dblock (append (list :name "clocktable")
-			       org-clock-clocktable-default-properties)))
+    (let ((props (if (ignore-errors 
+		       (save-excursion (org-back-to-heading)))
+		     (list :name "clocktable" :scope 'subtree)
+		   (list :name "clocktable"))))
+      (org-create-dblock 
+       (org-combine-plists org-clock-clocktable-default-properties props))))
   (org-update-dblock))
 
 (defun org-in-clocktable-p ()

[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
 Bastien

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

* Re: org-clock-report to insert a :scope sutree report when called from within a subtree?
  2011-03-17 10:52 org-clock-report to insert a :scope sutree report when called from within a subtree? Bastien
@ 2011-03-17 13:26 ` John Hendy
  2011-03-23 14:16   ` Bastien
  2011-03-23 14:12 ` [Accepted] " Bastien Guerry
  2011-03-23 14:15 ` Bastien
  2 siblings, 1 reply; 5+ messages in thread
From: John Hendy @ 2011-03-17 13:26 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

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

On Thu, Mar 17, 2011 at 5:52 AM, Bastien <bzg@altern.org> wrote:

> Hi all,
>
> The default when creating a clock report is to use :scope file.  I find
> it not practical for big files, where the report can take long to build.
>
> I'm thinking of applying this change: when called from within a subtree,
> `C-c C-x C-r' will insert a clock report with ":scope subtree", and use
> ":scope subtree" elsewhere.
>
> Please let me know if you think that's a bad idea.
>
>
It probably depends on the number of people using huge files vs. those not.
Or the number of people who want this vs. those that don't. Actually, I
don't think it really matters because it's so easy to change it anyway. Once
it's created and changed a little, I often don't change it again.

Personally, my org-mode usage favors "bite-sized" files that get replaced
over time rather than keeping huge files. My files cover one month and
that's it. Then they are filed away. For me... :scope file isn't a big deal.


John


>
> --
>  Bastien
>
>

[-- Attachment #2: Type: text/html, Size: 1579 bytes --]

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

* [Accepted] org-clock-report to insert a :scope sutree report when called from within a subtree?
  2011-03-17 10:52 org-clock-report to insert a :scope sutree report when called from within a subtree? Bastien
  2011-03-17 13:26 ` John Hendy
@ 2011-03-23 14:12 ` Bastien Guerry
  2011-03-23 14:15 ` Bastien
  2 siblings, 0 replies; 5+ messages in thread
From: Bastien Guerry @ 2011-03-23 14:12 UTC (permalink / raw)
  To: emacs-orgmode

Patch 696 (http://patchwork.newartisans.com/patch/696/) is now "Accepted".

Maintainer comment: none

This relates to the following submission:

http://mid.gmane.org/%3C874o72koig.fsf%40altern.org%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] org-clock-report to insert a :scope sutree report when called
> 	from within a subtree?
> Date: Thu, 17 Mar 2011 15:52:23 -0000
> From: Bastien Guerry <bzg@altern.org>
> X-Patchwork-Id: 696
> Message-Id: <874o72koig.fsf@altern.org>
> To: emacs-orgmode@gnu.org
> 
> Hi all,
> 
> The default when creating a clock report is to use :scope file.  I find
> it not practical for big files, where the report can take long to build.
> 
> I'm thinking of applying this change: when called from within a subtree,
> `C-c C-x C-r' will insert a clock report with ":scope subtree", and use
> ":scope subtree" elsewhere.
> 
> Please let me know if you think that's a bad idea.
> 
> 
> diff --git a/lisp/org-clock.el b/lisp/org-clock.el
> index c567a26..87b175c 100644
> --- a/lisp/org-clock.el
> +++ b/lisp/org-clock.el
> @@ -1652,7 +1652,10 @@ fontified, and then returned."
>  (defun org-clock-report (&optional arg)
>    "Create a table containing a report about clocked time.
>  If the cursor is inside an existing clocktable block, then the table
> -will be updated.  If not, a new clocktable will be inserted.
> +will be updated.  If not, a new clocktable will be inserted.  The scope
> +of the new clock will be subtree when called from within a subtree, and 
> +file elsewhere.
> +
>  When called with a prefix argument, move to the first clock table in the
>  buffer and update it."
>    (interactive "P")
> @@ -1662,8 +1665,12 @@ buffer and update it."
>      (org-show-entry))
>    (if (org-in-clocktable-p)
>        (goto-char (org-in-clocktable-p))
> -    (org-create-dblock (append (list :name "clocktable")
> -			       org-clock-clocktable-default-properties)))
> +    (let ((props (if (ignore-errors 
> +		       (save-excursion (org-back-to-heading)))
> +		     (list :name "clocktable" :scope 'subtree)
> +		   (list :name "clocktable"))))
> +      (org-create-dblock 
> +       (org-combine-plists org-clock-clocktable-default-properties props))))
>    (org-update-dblock))
>  
>  (defun org-in-clocktable-p ()
> 

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

* Re: org-clock-report to insert a :scope sutree report when called from within a subtree?
  2011-03-17 10:52 org-clock-report to insert a :scope sutree report when called from within a subtree? Bastien
  2011-03-17 13:26 ` John Hendy
  2011-03-23 14:12 ` [Accepted] " Bastien Guerry
@ 2011-03-23 14:15 ` Bastien
  2 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2011-03-23 14:15 UTC (permalink / raw)
  To: emacs-orgmode

Bastien <bzg@altern.org> writes:

> The default when creating a clock report is to use :scope file.  I find
> it not practical for big files, where the report can take long to build.
>
> I'm thinking of applying this change: when called from within a subtree,
> `C-c C-x C-r' will insert a clock report with ":scope subtree", and use
> ":scope subtree" elsewhere.
>
> Please let me know if you think that's a bad idea.

I have now applied this: now `C-c C-x C-r' will change the scope
depending on where the point is: if it's within a subtree, the scope
will be "subtree" -- otherwise it will be file.

-- 
 Bastien

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

* Re: org-clock-report to insert a :scope sutree report when called from within a subtree?
  2011-03-17 13:26 ` John Hendy
@ 2011-03-23 14:16   ` Bastien
  0 siblings, 0 replies; 5+ messages in thread
From: Bastien @ 2011-03-23 14:16 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi John,

John Hendy <jw.hendy@gmail.com> writes:

> It probably depends on the number of people using huge files vs.
> those not. Or the number of people who want this vs. those that
> don't. Actually, I don't think it really matters because it's so easy
> to change it anyway. Once it's created and changed a little, I often
> don't change it again.
>
> Personally, my org-mode usage favors "bite-sized" files that get
> replaced over time rather than keeping huge files. My files cover one
> month and that's it. Then they are filed away. For me... :scope file
> isn't a big deal.

thanks for your feedback -- I've applied the patch.  I also think it's
quite easy to configure, and avoiding possibly long clock reports by
default is a good thing IMHO.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2011-03-23 14:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-17 10:52 org-clock-report to insert a :scope sutree report when called from within a subtree? Bastien
2011-03-17 13:26 ` John Hendy
2011-03-23 14:16   ` Bastien
2011-03-23 14:12 ` [Accepted] " Bastien Guerry
2011-03-23 14:15 ` 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).