2

With point over the link here, org-open-at-point jumps to the following line ("ham eggs"):

* spam
** spam [[ham%20eggs][ham eggs]]
** ham eggs

Here however (final line extended), the same action makes emacs prompt No match - create this as a new heading? (y or n) in the minibuffer:

* spam
** spam [[ham%20eggs][ham eggs]]
** ham eggs spam

Is it possible to define links that do a substring search, so that the search would succeed in this case? It certainly is possible when linking to non-org mode files, and I would like to do the same for internal links.

1 Answer 1

3

You can set org-link-search-must-match-exact-headline to nil.

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

Now this will search the buffer for 'ham eggs' (which does not need to be in a heading.).

* spam [[ham eggs]]
* ham eggs spam

To restrict it to a heading (and an exact match), lead with a '*'.

* spam [[*ham eggs]]
* ham eggs spam

See (info "(org)External links") for more details.

2
  • After setting org-link-search-must-match-exact-headline, search works as you describe except that leading with a star does not limit to exact matches. Apr 5, 2015 at 18:46
  • 2
    Thank you for pointing that out. Leading with a star should work the way I described starting with version 8.3. (A commit from December 2014, 6d691e2aa8e, introduced this change.)
    – Kyle Meyer
    Apr 5, 2015 at 20:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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