From mboxrd@z Thu Jan 1 00:00:00 1970 From: Detlef Steuer Subject: Re: [ANN] New Org duration library Date: Tue, 14 Feb 2017 09:17:12 +0100 Message-ID: <20170214091712.725025f4@gaia> References: <87bmu6p4f5.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdYQI-000269-O7 for emacs-orgmode@gnu.org; Tue, 14 Feb 2017 03:25:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdYQE-0001Qj-EU for emacs-orgmode@gnu.org; Tue, 14 Feb 2017 03:25:18 -0500 Received: from [195.159.176.226] (port=51381 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdYQE-0001QA-6z for emacs-orgmode@gnu.org; Tue, 14 Feb 2017 03:25:14 -0500 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1cdYQ5-0007lY-VM for emacs-orgmode@gnu.org; Tue, 14 Feb 2017 09:25:05 +0100 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" To: emacs-orgmode@gnu.org Dear Nicolas, after updating org this morning from git I get: org-duration-to-minutes: Invalid duration format: " 9:00" if I try to invoke my agenda with C-c a a What gives me headaches: I don't use, AFAIK, durations anywhere and a grep over my org files shows *no* occurence of " 9:00". This is the complete relevant part of the message buffer: org-duration-to-minutes: Invalid duration format: " 9:00" Quit Making completion list... [2 times] Quit [4 times] Saving file /home/steuer/.emacs.d/init.el... Wrote /home/steuer/.emacs.d/init.el Press key for agenda command (unrestricted): org-duration-to-minutes: Invalid duration format: " 9:00" Any idea? My agenda is inaccessible for me at the moment, what is not so nice. Regards Detlef Am Mon, 13 Feb 2017 15:10:38 +0100 schrieb Nicolas Goaziou : > Hello, >=20 > * TL;DR; >=20 > `org-time-clocksum-format', `org-time-clocksum-use-fractional' and > `org-time-clocksum-fractional-format' are obsolete. If you changed > them, consider modifying ~org-duration-format~ instead. >=20 > Variable `org-time-clocksum-use-effort-durations' is also obsolete. > Consider setting `org-duration-units' instead. >=20 > * Rationale >=20 > In current stable version, time duration handling is unsatisfactory: >=20 > - There are overlapping and confusing functions: > `org-minutes-to-clocksum-string', `org-hh:mm-string-to-minutes' and > `org-duration-string-to-minutes'. >=20 > - Duration format is powerful but complex to handle since there are > four variables involved: `org-time-clocksum-format', > `org-time-clocksum-use-fractional', > `org-time-clocksum-fractional-format' and > `org-time-clocksum-use-effort-durations'. >=20 > - More importantly, if you set that format to something fancy, it is > not possible anymore to read the produced string back. >=20 > Therefore, I implemented and merged a simple "duration" library that > takes care of reading and producing such durations. Quoting the file's > commentary: >=20 > This library provides tools to manipulate durations. A duration > can have multiple formats: > =20 > - 3:12 > - 1:23:45 > - 1y 3d 3h 4min > - 3d 13:35 > - 2.35h > =20 > More accurately, it consists of numbers and units, as defined in > variable `org-duration-units', separated with white spaces, and > a "H:MM" or "H:MM:SS" part. White spaces are tolerated between > the number and its relative unit. Variable `org-duration-format' > controls durations default representation. > =20 > The library provides functions allowing to convert a duration to, > and from, a number of minutes: `org-duration-to-minutes' and > `org-duration-from-minutes'. It also provides two lesser tools: > `org-duration-p', and `org-duration-h:mm-only-p'. > =20 > Users can set the number of minutes per unit, or define new units, > in `org-duration-units'. The library also supports canonical > duration, i.e., a duration that doesn't depend on user's settings, > through optional arguments. >=20 > At the cost of some incompatibilities if you introduced some fancy > duration format, and a slightly more limited choice of representation, > we get a more consistent and sturdy interface. >=20 > * About base unit design choice >=20 > The base unit for a duration is the minute. I hesitated with the more > natural second but >=20 > - Org time precision is the minute, >=20 > - `org-duration-to-minutes' and `org-duration-from-minutes' can be > drop-in replacements for the functions quoted above, >=20 > - We would need to handle floats anyway as we don't require custom > units to be multiple of the base unit. >=20 >=20 > Feedback welcome. >=20 > Regards, >=20 --=20 "Wisely and slow. Those stumble that run fast." Shakespeare -- Romeo and Juliet Dr. Detlef Steuer Helmut-Schmidt-Universit=C3=A4t Fakult=C3=A4t WiSo Holstenhofweg 85 22043 Hamburg Tel: 040/6541-2819 mail: steuer@hsu-hh.de