From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: Re: Is there a way to get all agenda TODOs programmatically? Date: Sat, 07 Oct 2017 11:54:13 -0500 Message-ID: <874lrasxu2.fsf@fastmail.fm> References: <87376v36up.fsf@mbork.pl> <87a813rqdx.fsf@fastmail.fm> <87r2ue29j8.fsf@mbork.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0sMo-0002pb-4q for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 12:54:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0sMi-00043P-VV for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 12:54:22 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:39933) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e0sMi-00042L-H1 for emacs-orgmode@gnu.org; Sat, 07 Oct 2017 12:54:16 -0400 In-Reply-To: <87r2ue29j8.fsf@mbork.pl> (Marcin Borkowski's message of "Sat, 07 Oct 2017 18:43:39 +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" To: Marcin Borkowski Cc: Org-Mode mailing list Marcin Borkowski writes: > On 2017-10-07, at 16:20, Matt Lundin wrote: > >> Hi Marcin, >> >> Marcin Borkowski writes: >> >>> I'd like to get a list of all agenda TODOs, with titles and due dates. >>> Is there something ready in Org/contrib/blogosphere to help me? >> >> This functionality is built into org-mode. The simplest way to get such >> a list is to use the agenda (specifically M-x org-todo-list). To display >> scheduling information you can customize the variable >> org-agenda-prefix-format. > > I know (and use) that. What I want is not /display/, but a /data > structure/ containing that info. Ah, I see! A lisp list, not a list on the screen. >> 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. Best, Matt