I keep some files in RST and rst-mode has C-c C-t C-t runs the command rst-toc which open all section titles in separate buffer. I can search ignoring actual document content which tends to have massive amount of searched term (so occur or isearch is a wasting of time).

Other files I keep in .org files.

Can I search / isearch only by section titles?

I'd like to keep using .org mode as I set convenient archiving of old info.

  • If you are using swiper, ivy, counsel etc. then you might want to try counsel-org-goto which provides completion for org headings.
    – andrej
    May 16 '19 at 13:32
  • No, I don't use any of those. ido is my choice. And I am interested in searching/moving to section instead of completion.
    – gavenkoa
    May 16 '19 at 14:52
  • I would say that the command does what you want, i.e. searching and moving and a toc is presented in the minibuffer. Anyway there is also the built in org-goto. This question and answers might be of some help emacs.stackexchange.com/questions/32617/…
    – andrej
    May 16 '19 at 17:30

I found the answer here:

If you place an asterisk at the beginning of your search, Org-mode will search only headlines (and not entry text).

This is in the agenda view. So if you are interested only in the current file, in the agenda menu, press < to restrict to the current buffer, and then select s for search. Then type in the term, but prepend it with *.

You can do more advanced queries (e.g. search for all headings with foo, but not with bar:

*+foo -bar

Now I wonder if there's a way to do it with C-c / instead of going through the agenda view...

  • embarrassed to say how long I've been looking for this. Since before emacs.stackexchange existed.Thank you. Feb 25 at 22:41

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.