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 kPzQKaOAY1+9FwAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 15:28:35 +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 oOWfJaOAY19WCgAAB5/wlQ (envelope-from ) for ; Thu, 17 Sep 2020 15:28:35 +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 1080C940606 for ; Thu, 17 Sep 2020 15:28:35 +0000 (UTC) Received: from localhost ([::1]:42960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIvpp-0006To-8e for larch@yhetil.org; Thu, 17 Sep 2020 11:28:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIvlu-0005gp-9O for emacs-orgmode@gnu.org; Thu, 17 Sep 2020 11:24:30 -0400 Received: from dal2relay46.mxroute.com ([64.40.26.46]:42141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIvlp-0005tu-S3 for emacs-orgmode@gnu.org; Thu, 17 Sep 2020 11:24:29 -0400 Received: from filter003.mxroute.com ([168.235.111.26] 168-235-111-26.cloud.ramnode.com) (Authenticated sender: mN4UYu2MZsgR) by dal2relay46.mxroute.com (ZoneMTA) with ESMTPSA id 1749caa88b20004d87.001 for (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256); Thu, 17 Sep 2020 15:24:15 +0000 X-Zone-Loop: 3d789281ca35c2f724090b78c3cfcbe61d7e1720fbf6 X-Originating-IP: [168.235.111.26] Received: from friday.mxlogin.com (friday.mxlogin.com [159.69.65.104]) by filter003.mxroute.com (Postfix) with ESMTPS id CBCA760050 for ; Thu, 17 Sep 2020 15:24:14 +0000 (UTC) Subject: Re: official orgmode parser To: emacs-orgmode@gnu.org 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> <878sd9mc9x.fsf@localhost> From: =?UTF-8?B?UHJ6ZW15c8WCYXcgS2FtacWEc2tp?= Message-ID: Date: Thu, 17 Sep 2020 17:24:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <878sd9mc9x.fsf@localhost> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-AuthUser: pk@mmksoft.uk Received-SPF: pass client-ip=64.40.26.46; envelope-from=pk@intrepidus.pl; helo=dal2relay46.mxroute.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/17 11:24:20 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, 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=none; dmarc=none; 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.01 X-TUID: I4gSHg33XA8M On 9/17/20 3:18 AM, Ihor Radchenko wrote: >> So basically this is what this thread is about. One needs a working >> Emacs instance and work in "push" mode to export any Org data. This >> requires dealing with temporary files, as described above, and some >> 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 >> Guile, execute 'emacs -batch' to export org data (I'm ok with that), >> 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ław Kamiński 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? >>> >>> 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. >>> >>> 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) >>> >>> Best, >>> Ihor >>> >>> Przemysław Kamiński writes: >>> >>>> 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 integration? >>>>> >>>>> 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ław Kamiński 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 bad >>>>>>> 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 and >>>>>>> I have limited time resources on hacking things for myself :) >>>>>> >>>>>> I was in the exact same situation - I use Org-mode clocking, and we use >>>>>> 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 put >>>>>>> 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, >>>>>> >>>>>> -- >>>>>> 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 >> Emacs instance and work in "push" mode to export any Org data. This >> requires dealing with temporary files, as described above, and some >> 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 >> Guile, execute 'emacs -batch' to export org data (I'm ok with that), >> then parse the S-expressions to get what I need. >> >> P. > OK so this is what I got so far https://gitlab.com/cgenie/org-parse I stole the simple test.org file from ox-json test suite. Guile seems to correctly parse that output. At least something to start with :) Any comments are welcome :) Best, Przemek