From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: manipulating the agenda from elisp? Date: Thu, 7 Apr 2011 22:05:22 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00504502d31997a76a04a05ea853 Return-path: Received: from [140.186.70.92] (port=58223 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q814g-0006GJ-AQ for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 22:05:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q814f-0004Sn-4f for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 22:05:26 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:37296) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q814f-0004SW-0a for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 22:05:25 -0400 Received: by wwb39 with SMTP id 39so3218718wwb.30 for ; Thu, 07 Apr 2011 19:05:23 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --00504502d31997a76a04a05ea853 Content-Type: text/plain; charset=ISO-8859-1 Hi, I'm thinking I might like to try some programming to do things to the agenda from an elisp function. I tried 'apropos agenda' but I didn't really see the kind of thing I'm looking for. What I'm hoping is for some way to iterate over each item in the agenda, and be able to access the content of the item in some structured way. I think I've seen functions that can pull info like TODO state and priority from the item under the cursor, so it's the iteration part that I'm really interested in. Any advice? Cheers. Fil -- Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --00504502d31997a76a04a05ea853 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi,
I'm thinking I might like to try some programming to do things = to the agenda from an elisp function.
I tried 'apropos agenda= ' but I didn't really see the kind of thing I'm looking for.
What I'm hoping is for some way to iterate over each item in the a= genda, and be able to access the content of the item in some structured way= .
I think I've seen functions that can pull info like TODO st= ate and priority from the item under the cursor, so it's the iteration = part that I'm really interested in.

Any advice?
Cheers.
Fil

--
Filippo A. Salustri, Ph.D., P.Eng.
Mechanical and Indus= trial Engineering
Ryerson University
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5000 ext 7749
Fax: 416/979-5265
Email= : salustri@ryerson.ca
http://deseng.ryerson.ca/~fil/
--00504502d31997a76a04a05ea853-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: Re: manipulating the agenda from elisp? Date: Thu, 07 Apr 2011 23:34:07 -0400 Message-ID: <87bp0h2z80.fsf@norang.ca> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=43143 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q82SZ-0007rL-Q7 for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q82SY-0007tz-Fk for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:34:11 -0400 Received: from mho-01-ewr.mailhop.org ([204.13.248.71]:59403) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q82SY-0007tb-CZ for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:34:10 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Filippo A. Salustri" Cc: emacs-orgmode@gnu.org "Filippo A. Salustri" writes: > Hi, > I'm thinking I might like to try some programming to do things to the > agenda from an elisp function. > I tried 'apropos agenda' but I didn't really see the kind of thing > I'm looking for. > What I'm hoping is for some way to iterate over each item in the > agenda, and be able to access the content of the item in some > structured way. > I think I've seen functions that can pull info like TODO state and > priority from the item under the cursor, so it's the iteration part > that I'm really interested in. > > Any advice? Hi Fil, I just found the B f code to execute an arbitrary function on marked entries in the agenda. Maybe this will help? This following code visits the marked entries and just displays the heading for the task. Mark multiple entries in the agenda with 'm' and then 'B f bh/test RET' should display the heading of each marked task in the *Messages* buffer. --8<---------------cut here---------------start------------->8--- (defun bh/test () (interactive) (let* ((marker (or (org-get-at-bol 'org-marker) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker))) (with-current-buffer buffer (if (org-mode-p) (save-excursion (goto-char pos) (message "%s" (nth 4 (org-heading-components)))))))) --8<---------------cut here---------------end--------------->8--- Depending on what you want to do you can either act on marked entries or create a custom agenda skip function that can visit the tasks as the agenda is built. HTH, Bernt From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: manipulating the agenda from elisp? Date: Thu, 7 Apr 2011 23:53:15 -0400 Message-ID: References: <87bp0h2z80.fsf@norang.ca> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016367faf9b65757204a0602a99 Return-path: Received: from [140.186.70.92] (port=48329 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q82l4-0004Wl-Eo for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:53:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q82l2-0003yE-P6 for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:53:18 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:58763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q82l2-0003yA-IC for emacs-orgmode@gnu.org; Thu, 07 Apr 2011 23:53:16 -0400 Received: by wwb39 with SMTP id 39so3264695wwb.30 for ; Thu, 07 Apr 2011 20:53:15 -0700 (PDT) In-Reply-To: <87bp0h2z80.fsf@norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: emacs-orgmode@gnu.org --0016367faf9b65757204a0602a99 Content-Type: text/plain; charset=ISO-8859-1 That's a good start! Thanks! Cheers. Fil On 7 April 2011 23:34, Bernt Hansen wrote: > "Filippo A. Salustri" writes: > > > Hi, > > I'm thinking I might like to try some programming to do things to the > > agenda from an elisp function. > > I tried 'apropos agenda' but I didn't really see the kind of thing > > I'm looking for. > > What I'm hoping is for some way to iterate over each item in the > > agenda, and be able to access the content of the item in some > > structured way. > > I think I've seen functions that can pull info like TODO state and > > priority from the item under the cursor, so it's the iteration part > > that I'm really interested in. > > > > Any advice? > > Hi Fil, > > I just found the B f code to execute an arbitrary function on marked > entries in the agenda. Maybe this will help? > > This following code visits the marked entries and just displays the > heading for the task. > > Mark multiple entries in the agenda with 'm' and then 'B f bh/test RET' > should display the heading of each marked task in the *Messages* buffer. > > --8<---------------cut here---------------start------------->8--- > (defun bh/test () > (interactive) > (let* ((marker (or (org-get-at-bol 'org-marker) > (org-agenda-error))) > (buffer (marker-buffer marker)) > (pos (marker-position marker))) > (with-current-buffer buffer > (if (org-mode-p) > (save-excursion > (goto-char pos) > (message "%s" (nth 4 (org-heading-components)))))))) > --8<---------------cut here---------------end--------------->8--- > > Depending on what you want to do you can either act on marked entries or > create a custom agenda skip function that can visit the tasks as the > agenda is built. > > HTH, > Bernt > -- Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --0016367faf9b65757204a0602a99 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable That's a good start! =A0Thanks!
Cheers.
Fil

On 7 April 2011 23:34, Bernt Hansen = <bernt@norang.ca> wrote= :
"Filippo A. Salustri= " <salustri@ryerson.ca&g= t; writes:

> Hi,
> I'm thinking I might like to try some programming to do things to = the
> agenda from an elisp function.
> I tried 'apropos agenda' but I didn't really see the kind = of thing
> I'm looking for.
> What I'm hoping is for some way to iterate over each item in the > agenda, and be able to access the content of the item in some
> structured way.
> I think I've seen functions that can pull info like TODO state and=
> priority from the item under the cursor, so it's the iteration par= t
> that I'm really interested in.
>
> Any advice?

Hi Fil,

I just found the B f code to execute an arbitrary function on marked
entries in the agenda. =A0Maybe this will help?

This following code visits the marked entries and just displays the
heading for the task.

Mark multiple entries in the agenda with 'm' and then 'B f bh/t= est RET'
should display the heading of each marked task in the *Messages* buffer.
--8<---------------cut here---------------start------------->8---
(defun bh/test ()
=A0(interactive)
=A0(let* ((marker (or (org-get-at-bol 'org-marker)
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-agenda-error)))
=A0 =A0 =A0 =A0 (buffer (marker-buffer marker))
=A0 =A0 =A0 =A0 (pos (marker-position marker)))
=A0 =A0(with-current-buffer buffer
=A0 =A0 =A0(if (org-mode-p)
=A0 =A0 =A0 =A0 =A0(save-excursion
=A0 =A0 =A0 =A0 =A0 =A0(goto-char pos)
=A0 =A0 =A0 =A0 =A0 =A0(message "%s" (nth 4 (org-heading-compone= nts))))))))
--8<---------------cut here---------------end--------------->8---

Depending on what you want to do you can either act on marked entries or create a custom agenda skip function that can visit the tasks as the
agenda is built.

HTH,
Bernt



--
Filippo A. Salus= tri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Univ= ersity
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5= 000 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--0016367faf9b65757204a0602a99-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Re: manipulating the agenda from elisp? Date: Fri, 08 Apr 2011 01:00:40 -0400 Message-ID: <5451.1302238840@alphaville.dokosmarshall.org> References: <87bp0h2z80.fsf@norang.ca> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=52095 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8448-00072Y-MT for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 01:17:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8446-00082p-LK for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 01:17:04 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]:38855) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8446-0007xI-Bt for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 01:17:02 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LJB004SYINQRTG0@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 00:16:44 -0500 (CDT) In-reply-to: Message from "Filippo A. Salustri" of "Thu\, 07 Apr 2011 23\:53\:15 EDT." List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Filippo A. Salustri" Cc: Bernt Hansen , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Filippo A. Salustri wrote: > That's a good start! =C2=A0Thanks! > Cheers. > Fil >=20 > On 7 April 2011 23:34, Bernt Hansen wrote: >=20 > "Filippo A. Salustri" writes: >=20=20=20=20 > > Hi, > > I'm thinking I might like to try some programming to do things to t= he > > agenda from an elisp function. > > I tried 'apropos agenda' but I didn't really see the kind of thing > > I'm looking for. > > What I'm hoping is for some way to iterate over each item in the > > agenda, and be able to access the content of the item in some > > structured way. > > I think I've seen functions that can pull info like TODO state and > > priority from the item under the cursor, so it's the iteration part > > that I'm really interested in. > > > > Any advice? >=20=20=20=20 Be sure to read the "Hacking" appendix in the org manual, in particular "Using the property API" and "Using the mapping API". Nick > Hi Fil, >=20=20=20=20 > I just found the B f code to execute an arbitrary function on marked > entries in the agenda. =C2=A0Maybe this will help? >=20=20=20=20 > This following code visits the marked entries and just displays the > heading for the task. >=20=20=20=20 > Mark multiple entries in the agenda with 'm' and then 'B f bh/test RE= T' > should display the heading of each marked task in the *Messages* buff= er. >=20=20=20=20 > --8<---------------cut here---------------start------------->8--- > (defun bh/test () > =C2=A0(interactive) > =C2=A0(let* ((marker (or (org-get-at-bol 'org-marker) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (org-agenda-error))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (buffer (marker-buffer marker)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (pos (marker-position marker))) > =C2=A0 =C2=A0(with-current-buffer buffer > =C2=A0 =C2=A0 =C2=A0(if (org-mode-p) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char pos) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(message "%s" (nth 4 (org-he= ading-components)))))))) > --8<---------------cut here---------------end--------------->8--- >=20=20=20=20 > Depending on what you want to do you can either act on marked entries= or > create a custom agenda skip function that can visit the tasks as the > agenda is built. >=20=20=20=20 > HTH, > Bernt >=20 > -- > Filippo A. Salustri, Ph.D., P.Eng. > Mechanical and Industrial Engineering > Ryerson University > 350 Victoria St, Toronto, ON > M5B 2K3, Canada > Tel: 416/979-5000 ext 7749 > Fax: 416/979-5265 > Email: salustri@ryerson.ca > http://deseng.ryerson.ca/~fil/ >=20 >=20 > ---------------------------------------------------- > Alternatives: >=20 > ---------------------------------------------------- From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: Re: manipulating the agenda from elisp? Date: Fri, 8 Apr 2011 07:30:42 -0400 Message-ID: References: <87bp0h2z80.fsf@norang.ca> <5451.1302238840@alphaville.dokosmarshall.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=00504502d3195ab2db04a0668e43 Return-path: Received: from [140.186.70.92] (port=55275 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q89tl-0006gt-7k for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 07:30:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q89tj-0000gz-HT for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 07:30:45 -0400 Received: from mail-ww0-f49.google.com ([74.125.82.49]:47143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q89tj-0000gq-7A for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 07:30:43 -0400 Received: by wwb39 with SMTP id 39so3537915wwb.30 for ; Fri, 08 Apr 2011 04:30:42 -0700 (PDT) In-Reply-To: <5451.1302238840@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Bernt Hansen , emacs-orgmode@gnu.org --00504502d3195ab2db04a0668e43 Content-Type: text/plain; charset=ISO-8859-1 Yup; I'd noticed those sections and noted them for future study. Thanks. Cheers. Fil On 8 April 2011 01:00, Nick Dokos wrote: > Filippo A. Salustri wrote: > > > That's a good start! Thanks! > > Cheers. > > Fil > > > > On 7 April 2011 23:34, Bernt Hansen wrote: > > > > "Filippo A. Salustri" writes: > > > > > Hi, > > > I'm thinking I might like to try some programming to do things to > the > > > agenda from an elisp function. > > > I tried 'apropos agenda' but I didn't really see the kind of thing > > > I'm looking for. > > > What I'm hoping is for some way to iterate over each item in the > > > agenda, and be able to access the content of the item in some > > > structured way. > > > I think I've seen functions that can pull info like TODO state and > > > priority from the item under the cursor, so it's the iteration part > > > that I'm really interested in. > > > > > > Any advice? > > > > Be sure to read the "Hacking" appendix in the org manual, in particular > "Using the property API" and "Using the mapping API". > > Nick > > > Hi Fil, > > > > I just found the B f code to execute an arbitrary function on marked > > entries in the agenda. Maybe this will help? > > > > This following code visits the marked entries and just displays the > > heading for the task. > > > > Mark multiple entries in the agenda with 'm' and then 'B f bh/test > RET' > > should display the heading of each marked task in the *Messages* > buffer. > > > > --8<---------------cut here---------------start------------->8--- > > (defun bh/test () > > (interactive) > > (let* ((marker (or (org-get-at-bol 'org-marker) > > (org-agenda-error))) > > (buffer (marker-buffer marker)) > > (pos (marker-position marker))) > > (with-current-buffer buffer > > (if (org-mode-p) > > (save-excursion > > (goto-char pos) > > (message "%s" (nth 4 (org-heading-components)))))))) > > --8<---------------cut here---------------end--------------->8--- > > > > Depending on what you want to do you can either act on marked entries > or > > create a custom agenda skip function that can visit the tasks as the > > agenda is built. > > > > HTH, > > Bernt > > > > -- > > Filippo A. Salustri, Ph.D., P.Eng. > > Mechanical and Industrial Engineering > > Ryerson University > > 350 Victoria St, Toronto, ON > > M5B 2K3, Canada > > Tel: 416/979-5000 ext 7749 > > Fax: 416/979-5265 > > Email: salustri@ryerson.ca > > http://deseng.ryerson.ca/~fil/ > > > > > > ---------------------------------------------------- > > Alternatives: > > > > ---------------------------------------------------- > -- Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --00504502d3195ab2db04a0668e43 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yup; I'd noticed those sections and noted them for future study.
Th= anks.
Cheers.
Fil

On = 8 April 2011 01:00, Nick Dokos <nicholas.dokos@hp.com> wrote:
Filippo A. Salustri <<= a href=3D"mailto:salustri@ryerson.ca">salustri@ryerson.ca> wrote:
> That's a good start! =A0Thanks!
> Cheers.
> Fil
>
> On 7 April 2011 23:34, Bernt Hansen <bernt@norang.ca> wrote:
>
> =A0 =A0 "Filippo A. Salustri" <salustri@ryerson.ca> writes:
>
> =A0 =A0 > Hi,
> =A0 =A0 > I'm thinking I might like to try some programming to = do things to the
> =A0 =A0 > agenda from an elisp function.
> =A0 =A0 > I tried 'apropos agenda' but I didn't really = see the kind of thing
> =A0 =A0 > I'm looking for.
> =A0 =A0 > What I'm hoping is for some way to iterate over each = item in the
> =A0 =A0 > agenda, and be able to access the content of the item in = some
> =A0 =A0 > structured way.
> =A0 =A0 > I think I've seen functions that can pull info like T= ODO state and
> =A0 =A0 > priority from the item under the cursor, so it's the = iteration part
> =A0 =A0 > that I'm really interested in.
> =A0 =A0 >
> =A0 =A0 > Any advice?
>

Be sure to read the "Hacking" appendix in the org manual, i= n particular
"Using the property API" and "Using the mapping API".
Nick

> =A0 =A0 Hi Fil,
>
> =A0 =A0 I just found the B f code to execute an arbitrary function on = marked
> =A0 =A0 entries in the agenda. =A0Maybe this will help?
>
> =A0 =A0 This following code visits the marked entries and just display= s the
> =A0 =A0 heading for the task.
>
> =A0 =A0 Mark multiple entries in the agenda with 'm' and then = 'B f bh/test RET'
> =A0 =A0 should display the heading of each marked task in the *Message= s* buffer.
>
> =A0 =A0 --8<---------------cut here---------------start------------= ->8---
> =A0 =A0 (defun bh/test ()
> =A0 =A0 =A0(interactive)
> =A0 =A0 =A0(let* ((marker (or (org-get-at-bol 'org-marker)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (org-agenda-error))) > =A0 =A0 =A0 =A0 =A0 =A0 (buffer (marker-buffer marker))
> =A0 =A0 =A0 =A0 =A0 =A0 (pos (marker-position marker)))
> =A0 =A0 =A0 =A0(with-current-buffer buffer
> =A0 =A0 =A0 =A0 =A0(if (org-mode-p)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0(save-excursion
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(goto-char pos)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(message "%s" (nth 4 (org-hea= ding-components))))))))
> =A0 =A0 --8<---------------cut here---------------end--------------= ->8---
>
> =A0 =A0 Depending on what you want to do you can either act on marked = entries or
> =A0 =A0 create a custom agenda skip function that can visit the tasks = as the
> =A0 =A0 agenda is built.
>
> =A0 =A0 HTH,
> =A0 =A0 Bernt
>
> --
> Filippo A. Salustri, Ph.D., P.Eng.
> Mechanical and Industrial Engineering
> Ryerson University
> 350 Victoria St, Toronto, ON
> M5B 2K3, Canada
> Tel: 416/979-5000 ext 7749
> Fax: 416/979-5265
> Email: salustri@ryerson.ca<= br> > http://de= seng.ryerson.ca/~fil/
>
>
> ----------------------------------------------------
> Alternatives:
>
> ----------------------------------------------------



--
Filippo A. Salustri, Ph= .D., P.Eng.
Mechanical and Industrial Engineering
Ryerson University<= br>350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5000 ext= 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--00504502d3195ab2db04a0668e43-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: manipulating the agenda from elisp? Date: Fri, 08 Apr 2011 18:36:36 +0200 Message-ID: <871v1c8zu3.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=36651 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8Efs-0000xx-5r for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8Efr-0003t2-4F for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:36:44 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:38045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8Efq-0003sy-Vr for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:36:43 -0400 Received: by wyf19 with SMTP id 19so3848693wyf.0 for ; Fri, 08 Apr 2011 09:36:42 -0700 (PDT) In-Reply-To: (Filippo A. Salustri's message of "Thu, 7 Apr 2011 22:05:22 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "Filippo A. Salustri" Cc: emacs-orgmode@gnu.org Hi Filippo, "Filippo A. Salustri" writes: > I'm thinking I might like to try some programming to do things to the > agenda from an elisp function. > I tried 'apropos agenda' but I didn't really see the kind of thing > I'm looking for. > What I'm hoping is for some way to iterate over each item in the > agenda, and be able to access the content of the item in some > structured way. > I think I've seen functions that can pull info like TODO state and > priority from the item under the cursor, so it's the iteration part > that I'm really interested in. In an agenda, try `C-u C-x =' to see all the text properties at point. You can grab a lot of information from these properties. HTH, -- Bastien From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: manipulating the agenda from elisp? Date: Fri, 8 Apr 2011 18:59:38 +0200 Message-ID: References: <87bp0h2z80.fsf@norang.ca> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=42398 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8F2C-0006Ue-CD for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:59:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8F2B-0003oq-GH for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:59:48 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:32976) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8F2B-0003oU-9G for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 12:59:47 -0400 Received: by ewy9 with SMTP id 9so1186827ewy.0 for ; Fri, 08 Apr 2011 09:59:45 -0700 (PDT) In-Reply-To: <87bp0h2z80.fsf@norang.ca> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Bernt Hansen Cc: "Filippo A. Salustri" , emacs-orgmode@gnu.org On 8.4.2011, at 05:34, Bernt Hansen wrote: > "Filippo A. Salustri" writes: > >> Hi, >> I'm thinking I might like to try some programming to do things to the >> agenda from an elisp function. >> I tried 'apropos agenda' but I didn't really see the kind of thing >> I'm looking for. >> What I'm hoping is for some way to iterate over each item in the >> agenda, and be able to access the content of the item in some >> structured way. >> I think I've seen functions that can pull info like TODO state and >> priority from the item under the cursor, so it's the iteration part >> that I'm really interested in. >> >> Any advice? > > Hi Fil, > > I just found the B f code to execute an arbitrary function on marked > entries in the agenda. Maybe this will help? > > This following code visits the marked entries and just displays the > heading for the task. > > Mark multiple entries in the agenda with 'm' and then 'B f bh/test RET' > should display the heading of each marked task in the *Messages* buffer. > > --8<---------------cut here---------------start------------->8--- > (defun bh/test () > (interactive) > (let* ((marker (or (org-get-at-bol 'org-marker) > (org-agenda-error))) > (buffer (marker-buffer marker)) > (pos (marker-position marker))) > (with-current-buffer buffer > (if (org-mode-p) > (save-excursion > (goto-char pos) > (message "%s" (nth 4 (org-heading-components)))))))) > --8<---------------cut here---------------end--------------->8--- Also useful can be (org-entry-properties marker) Kind of slow for *many* entries, but perfectly good for a limited number... - Carsten From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Filippo A. Salustri" Subject: Re: Re: manipulating the agenda from elisp? Date: Fri, 8 Apr 2011 13:00:24 -0400 Message-ID: References: <87bp0h2z80.fsf@norang.ca> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=0016364d21c57cee7304a06b2924 Return-path: Received: from [140.186.70.92] (port=59906 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8FBQ-0007BZ-DK for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 13:09:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8FBO-00078L-Vw for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 13:09:20 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:53112) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8F2n-00042g-Ul for emacs-orgmode@gnu.org; Fri, 08 Apr 2011 13:00:26 -0400 Received: by wyf19 with SMTP id 19so3869504wyf.0 for ; Fri, 08 Apr 2011 10:00:25 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: Bernt Hansen , emacs-orgmode@gnu.org --0016364d21c57cee7304a06b2924 Content-Type: text/plain; charset=ISO-8859-1 Thanks to everyone for the hints and tips. It's much appreciated. Cheers. Fil On 8 April 2011 12:59, Carsten Dominik wrote: > > On 8.4.2011, at 05:34, Bernt Hansen wrote: > > > "Filippo A. Salustri" writes: > > > >> Hi, > >> I'm thinking I might like to try some programming to do things to the > >> agenda from an elisp function. > >> I tried 'apropos agenda' but I didn't really see the kind of thing > >> I'm looking for. > >> What I'm hoping is for some way to iterate over each item in the > >> agenda, and be able to access the content of the item in some > >> structured way. > >> I think I've seen functions that can pull info like TODO state and > >> priority from the item under the cursor, so it's the iteration part > >> that I'm really interested in. > >> > >> Any advice? > > > > Hi Fil, > > > > I just found the B f code to execute an arbitrary function on marked > > entries in the agenda. Maybe this will help? > > > > This following code visits the marked entries and just displays the > > heading for the task. > > > > Mark multiple entries in the agenda with 'm' and then 'B f bh/test RET' > > should display the heading of each marked task in the *Messages* buffer. > > > > --8<---------------cut here---------------start------------->8--- > > (defun bh/test () > > (interactive) > > (let* ((marker (or (org-get-at-bol 'org-marker) > > (org-agenda-error))) > > (buffer (marker-buffer marker)) > > (pos (marker-position marker))) > > (with-current-buffer buffer > > (if (org-mode-p) > > (save-excursion > > (goto-char pos) > > (message "%s" (nth 4 (org-heading-components)))))))) > > --8<---------------cut here---------------end--------------->8--- > > Also useful can be > > (org-entry-properties marker) > > Kind of slow for *many* entries, but perfectly good for a limited number... > > - Carsten > > -- Filippo A. Salustri, Ph.D., P.Eng. Mechanical and Industrial Engineering Ryerson University 350 Victoria St, Toronto, ON M5B 2K3, Canada Tel: 416/979-5000 ext 7749 Fax: 416/979-5265 Email: salustri@ryerson.ca http://deseng.ryerson.ca/~fil/ --0016364d21c57cee7304a06b2924 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Thanks to everyone for the hints and tips. =A0It's much appreciated.Cheers.
Fil

On 8 April 2011 1= 2:59, Carsten Dominik <carsten.dominik@gmail.com> wrote:

On 8.4.2011, at 05:34, Bernt Hansen wrote:

> "Filippo A. Salustri" <salustri@ryerson.ca> writes:
>
>> Hi,
>> I'm thinking I might like to try some programming to do things= to the
>> agenda from an elisp function.
>> I tried 'apropos agenda' but I didn't really see the k= ind of thing
>> I'm looking for.
>> What I'm hoping is for some way to iterate over each item in t= he
>> agenda, and be able to access the content of the item in some
>> structured way.
>> I think I've seen functions that can pull info like TODO state= and
>> priority from the item under the cursor, so it's the iteration= part
>> that I'm really interested in.
>>
>> Any advice?
>
> Hi Fil,
>
> I just found the B f code to execute an arbitrary function on marked > entries in the agenda. =A0Maybe this will help?
>
> This following code visits the marked entries and just displays the > heading for the task.
>
> Mark multiple entries in the agenda with 'm' and then 'B f= bh/test RET'
> should display the heading of each marked task in the *Messages* buffe= r.
>
> --8<---------------cut here---------------start------------->8--= -
> (defun bh/test ()
> =A0(interactive)
> =A0(let* ((marker (or (org-get-at-bol 'org-marker)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(org-agenda-error)))
> =A0 =A0 =A0 =A0(buffer (marker-buffer marker))
> =A0 =A0 =A0 =A0(pos (marker-position marker)))
> =A0 =A0(with-current-buffer buffer
> =A0 =A0 =A0(if (org-mode-p)
> =A0 =A0 =A0 =A0 (save-excursion
> =A0 =A0 =A0 =A0 =A0 (goto-char pos)
> =A0 =A0 =A0 =A0 =A0 (message "%s" (nth 4 (org-heading-compon= ents))))))))
> --8<---------------cut here---------------end--------------->8--= -

Also useful can be

=A0 =A0 =A0(org-entry-properties marker)

Kind of slow for *many* entries, but perfectly good for a limited number...=

- Carsten




--
Filippo A. Salus= tri, Ph.D., P.Eng.
Mechanical and Industrial Engineering
Ryerson Univ= ersity
350 Victoria St, Toronto, ON
M5B 2K3, Canada
Tel: 416/979-5= 000 ext 7749
Fax: 416/979-5265
Email: salustri= @ryerson.ca
http://deseng= .ryerson.ca/~fil/
--0016364d21c57cee7304a06b2924--