How to search all of my org files for a string appearing in an ordinary list?

I’ve pasted in below a (perhaps too long) snippet of one of my org-mode files (named “personal”), intended to store personal reference data.   In real life it has many top-level headings, but I’ve kept for illustration parts of the “Alfie” (dog) and “books” trees.

Suppose I want to remember which volumes of TAOCP I own and whether they are at home or at work.  I’d like to be able to search for “knuth” (case-insensitive) and have beorg open up the file “personal.org” and then show me the “*** above desk - 2nd shelf (left)” heading (which is a sub heading of “** office bookshelf contents”, which itself is a sub heading of “* books”) and put the cursor on the unordered plain list item “- Knuth / Fundamental Algorithms TAOCP”.  There may or may not be highlighting of matched words, and there may or may not be a button to jump ahead to the next match (which may be in the same file or a different one).  It’s OK with me if it just jumps to the first match if I’m not specific enough.

Ideally, I would be able to specify multiple search terms, and only list items containing both terms would match, so that I could search for “knuth sorting” and match just the list item “- Knuth / Sorting and Searching TAOCP”.

I use plain list items instead of headlines because list items are allowed to wrap, while headlines are not.  (I am old-school and like hard line-wrap at column 72, but I could be talked out of that.)  I am willing to reformat into level-4 headlines (****) instead of plain list items if that would be simplier.  Then one would display the subset of headlines whose contents match all search terms.

It appears to me that the current beorg search (from TODO) only lets me search the headlines themselves, not the text beneath the headlines.  Is there a search modifier that lets me match the entire subtree text for a given headline?  I don’t mind writing Scheme code.

For instance, I am currently able to match the “** dog food / calories” subtree by searching for “dog calo” (that’s fine), but unfortunately not by searching for “science diet”. 

Here’s the long (but still highly redacted!) sample of text, so you can see why I want to be able to narrow down using search.

====

reference material - personal

-- mode: org; --

#+startup: indent folded

Notes about Alfie ** alfie walk distances


Full search of notes is planned for a future release. It might be I’ve prematurely optimised search not to include it and it’ll be easier than I think to do and still perform well.


OMG, that’s great news —  I’m looking forward to it!  Meanwhile I’ve been using “C-c a /” in emacs to do an “occur”-style agenda.  It will be quite handy to have similar functionality while on-the-move.


I am glad to read it.

Download now for iPhone and iPad

Follow us on Mastodon and Bluesky

Privacy Policy | Press Kit