From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: (org-entry-get (point) "CLOCK") fails now Date: Sun, 30 Aug 2015 20:59:38 +0200 Message-ID: <87io7w38md.fsf@nicolasgoaziou.fr> References: <87io7xc8au.fsf@kaffanke.at> <87r3ml2ca9.fsf@nicolasgoaziou.fr> <87h9ngdbyv.fsf@kaffanke.at> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW7nl-0008TF-9E for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:58:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZW7nk-0000g4-ED for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:58:01 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:45872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZW7nk-0000fT-73 for emacs-orgmode@gnu.org; Sun, 30 Aug 2015 14:58:00 -0400 In-Reply-To: <87h9ngdbyv.fsf@kaffanke.at> (Martin Kaffanke's message of "Sun, 30 Aug 2015 17:37:12 +0200") 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: Martin Kaffanke Cc: emacs-orgmode@gnu.org Martin Kaffanke writes: > I have only one CLOCK property for my entry and I just want to extract > the start time of that clock entry. I did after the get-entry: > > (let* > ( > .... > (clockentry (org-entry-get (point) "CLOCK")) > (clockstart (apply 'encode-time (org-parse-time-string clockentry))) > .... > ) > ..... > ) > > > So maybe you just know how to rewrite this two lines? Well, that's an usual pattern: search something using a lax regexp, discard false positives with parser, and return a specific value: (let ((clockstart (org-with-wide-buffer (org-back-to-heading t) (let ((end (save-excursion (outline-next-heading))) (re (concat "^[ \t]*" org-clock-string))) (catch :found (while (re-search-forward re end t) (let ((element (org-element-at-point))) (when (eq (org-element-type element) 'clock) (throw :found (org-timestamp--to-internal-time (org-element-property :value element))))))))))) ...) I should probably rename `org-timestamp--to-internal-time' to `org-timestamp-to-internal-time' if it is useful out of org.el. Regards,