From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id QDZuL9+5Yl+IQgAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 01:20:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id MBocK9+5Yl/qFwAAB5/wlQ (envelope-from ) for ; Thu, 17 Sep 2020 01:20:31 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 14E599403C6 for ; Thu, 17 Sep 2020 01:20:31 +0000 (UTC) Received: from localhost ([::1]:33218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIib6-0003ot-Rp for larch@yhetil.org; Wed, 16 Sep 2020 21:20:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIia3-00035L-QF for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 21:19:23 -0400 Received: from mail-pj1-x1042.google.com ([2607:f8b0:4864:20::1042]:37997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIia1-0002fU-Hr for emacs-orgmode@gnu.org; Wed, 16 Sep 2020 21:19:23 -0400 Received: by mail-pj1-x1042.google.com with SMTP id u3so366799pjr.3 for ; Wed, 16 Sep 2020 18:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:in-reply-to:references:date:message-id:mime-version :content-transfer-encoding; bh=PuZ5UWMcsTL1A1GTzIq0mPuVze2vR8JPEakakineUxc=; b=HskfLUa9QaezVRW3MuvecnBohD0HWQ9AMIYAgRcILUolLU4z11yWei4QNnS/9aQts0 C2ryHRUwKG+TIEjs57FxSf3R7M8sBHB0LQlTS3n8MKyJh18EvtEGllWgSfl43T8MPQNV Gg13dDXQrMPe0HQQPUjFyxTjRGuEbQ1wo2zTomoKeIqjlhgyQzm489175KZpjRUw7yCR 3SHLzyv90k4lZFwSX70yGx9mQ4Zz/kPk6xlCeERwLXHh8Wk1Cw9TrRKRcebwqBezFKOw 4AOCm4ZdeSUn6Y9OTNNsT1jrbbxveHzIb+fMYXoF1kmy65mHNvyUjX8FXuodyoZBuzEZ xVJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=PuZ5UWMcsTL1A1GTzIq0mPuVze2vR8JPEakakineUxc=; b=t0KvyYrXvYRtcDhCIAmf+Kwuk2tepO9UBJ9ih1/cnwUt0Vmqaof3+0Q7/wuNNWEM/F zSUsPU5f/8c6Xx0m9qddWvOGGbtfuptHK9UCZ+8ScgzARgDJ7zEwlLPyrV6BmXBx3nsN PrZwRr2+YAf1Ya4mKQvlpzZ6Io5BFPbHlSS2LSwDadI7/C8HvQMMv2lnsaEdU5FgtFsa TC8aaxfmScoHkhm6whpO0JFOgyeuXHLgNwwpB9XnGk1zR2dHYfTHu5u66Cmb/aB4UbSJ ElcE2egsCDRd2YI+lPjovJPE/+6LP2LcZWkdUQbM3As1b4d94qI/0+jAELPhHrli8gBw 1Brg== X-Gm-Message-State: AOAM530zM96iyO42An3ahfjfvw/MytDwa2A63ZAD/RyfcyXg4J6rYZIb wVryzQPyH3BlW5f/vNtxCC7PgDRbG9jLJg== X-Google-Smtp-Source: ABdhPJx/K+/3BSCl+h8K6btyh+yJpUFcZCPI3+DqyS+JPTPOCJYz2ktE0GsX+WrKA0nL5hZtV8DThg== X-Received: by 2002:a17:90a:4046:: with SMTP id k6mr6254522pjg.11.1600305558951; Wed, 16 Sep 2020 18:19:18 -0700 (PDT) Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id q21sm2995091pgt.48.2020.09.16.18.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 18:19:17 -0700 (PDT) From: Ihor Radchenko To: =?utf-8?Q?Przemys=C5=82aw_Kami=C5=84ski?= , emacs-orgmode@gnu.org Subject: Re: official orgmode parser In-Reply-To: <1e35b658-11c2-0b25-0f7b-ecd37ed06a5d@intrepidus.pl> References: <68dc1ea1-52e8-7d9e-fb2d-bcf08c111eca@intrepidus.pl> <87d02n2yyr.fsf@gmail.com> <482cea5c-4214-57ac-dfeb-1e305180fee5@intrepidus.pl> <875z8echfi.fsf@mbork.pl> <87h7rym9xi.fsf@localhost> <87een2lyja.fsf@localhost> <1e35b658-11c2-0b25-0f7b-ecd37ed06a5d@intrepidus.pl> Date: Thu, 17 Sep 2020 09:18:18 +0800 Message-ID: <878sd9mc9x.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=2607:f8b0:4864:20::1042; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1042.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=HskfLUa9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.21 X-TUID: gDa3m+XE9WCI > So basically this is what this thread is about. One needs a working=20 > Emacs instance and work in "push" mode to export any Org data. This=20 > requires dealing with temporary files, as described above, and some=20 > ad-hoc formats to keep whatever data I need to pull from org. > "Pull" mode would be preferred. I could then, say, write a script in=20 > Guile, execute 'emacs -batch' to export org data (I'm ok with that),=20 > then parse the S-expressions to get what I need. My choice to use "push" mode is just for performance reasons. Nothing prevents you from writing a function called from emacs --batch that converts parsed org data into whatever format your Guile script prefers. That function may be either on Emacs side or on Guile side. Probably, Emacs has more capabilities when dealing with s-expressions though. You can even directly push the information from Emacs to API server. You may find https://github.com/tkf/emacs-request useful for this task. Finally, you may also consider clock tables to create clock summaries using existing org-mode functionality. The tables can be named and accessed using any programming language via babel. Best, Ihor Przemys=C5=82aw Kami=C5=84ski writes: > On 9/16/20 2:02 PM, Ihor Radchenko wrote: >>> However what Ihor presented is interesting. Do you use similar approach >>> with shellout and 'emacs -batch' to show currently running task or you >>> 'push' data from emacs to show it in the taskbar? >>=20 >> I prefer to avoid querying emacs too often for performance reasons. >> Instead, I only update the clocking info when I clock in/out in emacs. >> Then, the clocked in time is dynamically updated by independent bash >> script. >>=20 >> The scheme is the following: >> 1. org clock in/out in Emacs trigger writing clocking info into >> ~/.org-clock-in status file >> 2. bash script periodically monitors the file and calculates the clocked >> in time according to the contents and time from last modification >> 3. the script updates simple textbox widget using awesome-client >> 4. the script also warns me (notify-send) when the weighted clocked in >> time is negative (meaning that I should switch to some more >> productive activity) >>=20 >> Best, >> Ihor >>=20 >> Przemys=C5=82aw Kami=C5=84ski writes: >>=20 >>> On 9/16/20 9:56 AM, Ihor Radchenko wrote: >>>>> Wow, another awesomewm user here; could you share your code? >>>> >>>> Are you interested in something particular about awesome WM integratio= n? >>>> >>>> I am using simple textbox widgets to show currently clocked in task and >>>> weighted summary of clocked time. See the attachments. >>>> >>>> Best, >>>> Ihor >>>> >>>> >>>> >>>> >>>> Marcin Borkowski writes: >>>> >>>>> On 2020-09-15, at 11:17, Przemys=C5=82aw Kami=C5=84ski wrote: >>>>> >>>>>> So, I keep clock times for work in org mode, this is very >>>>>> handy. However, my customers require that I use their service to >>>>>> provide the times. They do offer API. So basically I'm using elisp to >>>>>> parse org, make API calls, and at the same time generate CSV reports >>>>>> with a Python interop with org babel (because my elisp is just too b= ad >>>>>> to do that). If I had access to some org parser, I'd pick a language >>>>>> that would be more comfortable for me to get the job done. I guess it >>>>>> can all be done in elisp, however this is just a tool for me alone a= nd >>>>>> I have limited time resources on hacking things for myself :) >>>>> >>>>> I was in the exact same situation - I use Org-mode clocking, and we u= se >>>>> Toggl at our company, so I wrote a simple tool to fire API requests to >>>>> Toggl on clock start/cancel/end: https://github.com/mbork/org-toggl >>>>> It's a bit more than 200 lines of Elisp, so you might try to look into >>>>> it and adapt it to whatever tool your employer is using. >>>>> >>>>>> Another one is generating total hours report for day/week/month to p= ut >>>>>> into my awesomewm toolbar. I ended up using orgstat >>>>>> https://github.com/volhovM/orgstat >>>>>> however the author is creating his own DSL in YAML and I guess things >>>>>> were much better off if it all stayed in some Scheme :) >>>>> >>>>> Wow, another awesomewm user here; could you share your code? >>>>> >>>>> Best, >>>>> >>>>> --=20 >>>>> Marcin Borkowski >>>>> http://mbork.pl >>> >>> >>> I don't have interesting code, just standard awesomevm setup. I run >>> periodic script to output data computed by orgstat and show it in the >>> taskbar (uses the shellout_widget). >>> >>> However what Ihor presented is interesting. Do you use similar approach >>> with shellout and 'emacs -batch' to show currently running task or you >>> 'push' data from emacs to show it in the taskbar? >>> >>> P. > > > So basically this is what this thread is about. One needs a working=20 > Emacs instance and work in "push" mode to export any Org data. This=20 > requires dealing with temporary files, as described above, and some=20 > ad-hoc formats to keep whatever data I need to pull from org. > > "Pull" mode would be preferred. I could then, say, write a script in=20 > Guile, execute 'emacs -batch' to export org data (I'm ok with that),=20 > then parse the S-expressions to get what I need. > > P.