From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexis Roda Subject: Re: Triggering clock in/out from org state change and progress logging Date: Mon, 01 Sep 2014 19:32:13 +0200 Message-ID: <5404AD9D.30101@gmail.com> References: <53FC68DE.3000500@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOVSt-0006iB-2X for emacs-orgmode@gnu.org; Mon, 01 Sep 2014 13:32:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOVSk-00075A-2v for emacs-orgmode@gnu.org; Mon, 01 Sep 2014 13:32:27 -0400 Received: from mail-wg0-x22d.google.com ([2a00:1450:400c:c00::22d]:39510) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOVSj-00074y-Rv for emacs-orgmode@gnu.org; Mon, 01 Sep 2014 13:32:18 -0400 Received: by mail-wg0-f45.google.com with SMTP id k14so5802062wgh.16 for ; Mon, 01 Sep 2014 10:32:16 -0700 (PDT) In-Reply-To: <53FC68DE.3000500@gmail.com> 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: emacs-orgmode@gnu.org Hi list, after struggling a bit with edebug (too many things to learn) I have traced what the problem is. For the archives: State-change logging is deferred until the command finishes and is implemented by the function 'org-add-log-setup' adding the function 'org-add-log-note' to the hook 'post-command-hook'. The details of the note are stored in global variables 'org-log-note-xxx'. That implementation prevents recursive calls to 'org-todo' (that's what my code does in order the pause the active task) from logging both the paused and the started log messages. 'org-add-log-note' will be called only once since the hook won't accept duplicated entries. Anyway, the innermost call to 'org-add-log-setup' will overwrite the variables 'org-log-note-xxx' with the details of the note being paused. The outcome is that only the state change for the paused note is being logged. Now that I know what the problem is I only have to figure a workaround. Any clue? Regards