[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to find the headline matching a string

From: Eric Abrahamsen
Subject: Re: [O] How to find the headline matching a string
Date: Sat, 31 May 2014 23:27:55 +0800
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Chris Poole <address@hidden> writes:

> Hi all,
> Suppose I have a string, "my first task", that I know is tagged with
> "laptop".
> I want to search through the agenda files for a headline that matches
> this string, to be able to mark it as DONE (in an automated fashion).
> I can't find a function to search through for the headline --- is
> there one?
> Else, is it best to concat all the agenda files into a larger buffer,
> then parse the buffer and iterate through the headlines with
> org-element-map?
> Cheers,
> Chris

Depending on how automated you need this to be, the `org-map-entries'
function can be given a scope of 'agenda (see its docstring). You could
call it with the agenda scope and a matcher for the "laptop" tag -- that
would at least get you all the headings in all the agenda files with the
"laptop" tag. Then the actual mapping function could call
`org-get-heading' on each of the matching headings, and check the text.

In these cases, though, I generally try to find a way to know the
heading's ID property, and use `org-id-goto'.

Hope that helps,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]