With the variable org-link-search-must-match-exact-headline you can only choose between various search options but I would like to have the following behaviour:

  • First try to match against headlines only
  • If the above fails fallback to searching the whole buffer

Is there an option for this, or how could I achieve that?

  • I think that is the default behaviour, see the internal links section in the manual.
    – suvayu
    Oct 12 '15 at 6:25
  • @suvayu If you set the above variable to t it will match against the corresponding headline, if you set it to nil it will match other things in the buffer, I want it to match against headlines first and only if it fails match against other things. It does not work on my side this way, it will jump to any string matching the link if I set the variable to nil even if there is a matching headline.
    – clemera
    Oct 12 '15 at 9:30
  • Looks like it's an either or. The manual seems to suggest otherwise. I would report this to the Org mailing list. Either the code should add this feature, or the documentation should be fixed.
    – suvayu
    Oct 12 '15 at 15:16

I have worked around it with the following for now:

(setq org-link-search-must-match-exact-headline nil)

and replaced links to headlines with [[*Headline name][Link name]] and links to inline text with [[In line text to search for][Link name]].

The first will only match against headlines.

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.