From mboxrd@z Thu Jan 1 00:00:00 1970 From: Aankhen Subject: Re: Automatically clocking into parent items Date: Mon, 14 Mar 2011 16:30:39 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=38654 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pz5WH-0000T2-Fr for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 07:01:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pz5WG-0001Py-50 for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 07:01:01 -0400 Received: from mail-vw0-f41.google.com ([209.85.212.41]:59344) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pz5WG-0001Pm-2a for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 07:01:00 -0400 Received: by vws4 with SMTP id 4so2798662vws.0 for ; Mon, 14 Mar 2011 04:00:59 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode ml On Sun, Mar 13, 2011 at 01:30, Aankhen wrote: > I=E2=80=99ve been working on getting org-mode to automatically clock into= an > item=E2=80=99s ancestor when clocking out of that item. =C2=A0The way I h= ave it set > up now, it walks up the tree looking for an item that has a particular > property set. =C2=A0If that property is non-nil, it clocks in; if it=E2= =80=99s nil, > it doesn=E2=80=99t. =C2=A0Either way, it stops looking at that point. =C2= =A0Here=E2=80=99s what > I have so far: > > [snip] > > So given this structure: > > [snip] > > When I clock out of =E2=80=98Frob=E2=80=99, I=E2=80=99m automatically clo= cked into =E2=80=98Quux=E2=80=99, and > when I clock out of =E2=80=98Quux=E2=80=99, I=E2=80=99m automatically clo= cked into =E2=80=98Bar=E2=80=99. > This works pretty well, except for one problem: it happens *every > time* I clock out, meaning that if I=E2=80=99m clocked into =E2=80=98Quux= =E2=80=99 and I then > hit C-c C-x C-i on =E2=80=98Frob=E2=80=99, I end up being clocked into bo= th =E2=80=98Bar=E2=80=99 and > =E2=80=98Frob=E2=80=99, because I=E2=80=99m automatically clocked out of = =E2=80=98Quux=E2=80=99; my code is > run, clocking me into =E2=80=98Bar=E2=80=99; and then the normal clocking= mechanism > clocks me into =E2=80=98Frob=E2=80=99 (at least, I *think* the hook runs = first). > > I guess what I=E2=80=99m wondering is, what=E2=80=99s a good way to avoid= this > double-clocking? =C2=A0And while I=E2=80=99m asking for help, can anyone = think of > some less obnoxious names for the functions, variables and property? > :-) I think I managed to answer the first question myself. As =E2=80=98org-clock-in=E2=80=99 sets =E2=80=98org-clock-clocking-in=E2=80=99= before calling =E2=80=98org-clock-out=E2=80=99, checking the value of that variable before= clocking into the parent item seems to have done the trick. Aankhen