1

How can I expand all the headings with a name matching a search term? For example, take the following fully expanded document:

* Famous Animals
** Pigs
   - Ace
   - Babe
** Cats
   - Duchess
   - Felix
* Musical Characters
** Cats
   - Demeter
   - Macavity
** Chicago
   - Roxie
   - Velma

Now let's collapse it completely:

* Famous Animals
* Musical Characters

I'd like to be able to search for "Cats" and get the following headings to expand:

* Famous Animals
** Pigs
** Cats
   - Duchess
   - Felix
* Musical Characters
** Cats
   - Demeter
   - Macavity
** Chicago

Extra points if I can do an incremental search and have the headings expand as I type.

1

org-sparse-tree (C-c /) does exactly what you want.

For example, C-c / / Cats RET will expand all content where "Cats" appears, and collapse the rest.

4
  • It's very close. It shows the "Cats' heading, but unless I'm doing it wrong, it doesn't show the lists under "Cats". Is there any way to expand them further?
    – oneself
    Apr 25 '20 at 14:30
  • I also tried applying the answer here to no avail: emacs.stackexchange.com/questions/15109/…
    – oneself
    Apr 25 '20 at 14:42
  • 1
    @oneself does: (add-to-list 'org-show-context-detail '(occur-tree . local)) work for you? It won't show the siblings I think.
    – jagrg
    Apr 26 '20 at 0:54
  • Yes, it that works perfectly. Thank you!
    – oneself
    Apr 27 '20 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.