From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: Re: Is there a way to get all agenda TODOs programmatically? Date: Fri, 29 Dec 2017 20:55:32 +0100 Message-ID: <877et5joln.fsf@mbork.pl> References: <87376v36up.fsf@mbork.pl> <87a813rqdx.fsf@fastmail.fm> <87r2ue29j8.fsf@mbork.pl> <874lrasxu2.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eV0kz-0004nM-2V for emacs-orgmode@gnu.org; Fri, 29 Dec 2017 14:55:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eV0kv-0006Ah-1i for emacs-orgmode@gnu.org; Fri, 29 Dec 2017 14:55:53 -0500 Received: from mail.mojserwer.eu ([195.110.48.8]:48798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eV0ku-00064E-QH for emacs-orgmode@gnu.org; Fri, 29 Dec 2017 14:55:48 -0500 In-reply-to: <874lrasxu2.fsf@fastmail.fm> 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: Matt Lundin Cc: Org-Mode mailing list On 2017-10-07, at 18:54, Matt Lundin wrote: >>> Finally, if you want simply to gather the todo data programmatically for >>> further processing you can use the function org-map-entries. >> >> Thanks, that seems to be a good pointer. I'll check it out. > > I think something like this would generate a such a list: > > (org-map-entries '(cons (nth 4 (org-heading-components)) > (list (org-get-deadline-time nil))) > "/!TODO" 'agenda) > > Each item in the list would look something like this: > > ("Test" (23000 24400)) > > You could then feed the list to whatever function you'd like. Thanks again. I played around with this for some time, but there is one problem. The agenda has a lot of settings, and replicating them with org-map-entries turned out to be no fun. Is there a way to plug into the agenda generating functions somehow to get a Lisp list of agenda items? I'm pretty sure that can be done - org-super-agenda does something similar, after all - but I have no idea why. I could delve into agenda source myself, but is is quite hairy, so maybe someone knows that already? TIA, -- Marcin Borkowski