Wizard
Wizard

Reputation: 22093

Match keywords (which are neither of heading or names) with internal links

The external links have exact match as pattern

file:projects.org::some words= (text search)

In contrast, the internal links have only header and name match pattern.

Suppose place a function with a "foo.org"

 (defun bisect-search ...)

Below in the file, refer to it, I have to name it literally #+name: bisect-search

and set
<<bisect-search>> For keywords which are trivial or hard to be named, I tried

   file:current_file.org::keywords

Got but errors.

There might be a solution with elisp commands

   elisp:(command )

Could you please provide any hints to match keywords in the current file?

Upvotes: 1

Views: 59

Answers (1)

NickD
NickD

Reputation: 6412

The matching behavior of internal links is controlled by the variable org-link-search-must-match-exact-headline whose doc string says:

org-link-search-must-match-exact-headline is a variable defined in ‘ol.el’.

Its value is ‘query-to-create’ ...

Documentation: Non-nil means internal fuzzy links can only match headlines.

When nil, the a fuzzy link may point to a target or a named construct in the document. When set to the special value ‘query-to-create’, offer to create a new headline when none matched.

If you set this variable to nil, then a link like [[bisect-search]] will match the first instance of bisect-search in the file (except that it will not self-match). IMO that's a pretty hefty price you have to pay just to avoid #+NAME:ing something, but YMMV.

Upvotes: 1

Related Questions