emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Leo Alekseyev <dnquark@gmail.com>, Emacs orgmode <emacs-orgmode@gnu.org>
Subject: Re: How to generate CLOCKSUM property from time ranges?
Date: Sat, 12 Jan 2019 17:37:16 -0500	[thread overview]
Message-ID: <87ef9hwlib.fsf@kyleam.com> (raw)
In-Reply-To: <CADzxs1mTtzMW-qqBZP46V3SxVwo8m37JuaAh9RSrsas9szet3A@mail.gmail.com>

Hello,

[sorry for the late response]

Leo Alekseyev <dnquark@gmail.com> writes:

> Greetings all,
> I am looking into using `org-invoice` to generate some invoices. It uses
> the CLOCKSUM property, which according to the docs gets auto-generated when
> the clock entries are summed in a subtree.
>
> Concretely, docs say: "CLOCKSUM: The sum of CLOCK intervals in the
> subtree.  ‘org-clock-sum’ must be run first to compute the values in the
> current buffer."  However, `org-clock-sum` is a non-interactive function,
> and evaluating it by hand doesn't do anything for me.
> [...]
> Question: how do I get CLOCKSUM property generated and stored in a subtree
> with timestamps so that org-invoice functions can pick it up?

I haven’t used the CLOCKSUM property (or org-invoice), but my
understanding is that it’s a special property that should not actually
be set in the property drawer: ‘(info "(org)Special properties")’.

Running org-clock-sum doesn’t generate a property drawer, but it does
store the value as a text property.  Say we have this file:

--8<---------------cut here---------------start------------->8---
* TODO things
:LOGBOOK:
CLOCK: [2019-01-12 Sat 17:33]--[2019-01-12 Sat 17:40] =>  0:07
:END:
--8<---------------cut here---------------end--------------->8---

org-invoice retrieves the CLOCKSUM value with org-entry-get.  Here’s
what we get if we run that in the above buffer, before and after calling
org-clock-sum:

  (org-entry-get nil "CLOCKSUM" nil)   ; => nil
  (org-clock-sum)                      ; => 7
  (org-entry-get nil "CLOCKSUM" nil)   ; => "0:07"

So, running org-clock-sum (or any function that calls org-clock-sum),
does generate and store a value that org-invoice can use; you just can’t
see it easily.

-- 
Kyle

      reply	other threads:[~2019-01-12 22:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-02  3:01 How to generate CLOCKSUM property from time ranges? Leo Alekseyev
2019-01-12 22:37 ` Kyle Meyer [this message]

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=87ef9hwlib.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=dnquark@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).