This is the official manual for the latest Org-mode release.
File links can contain additional information to make Emacs jump to a particular location in the file when following a link. This can be a line number or a search option after a double1 colon. For example, when the command C-c l creates a link (see Handling links) to a file, it encodes the words in the current line as a search string that can be used to find this line back later when following the link with C-c C-o.
Here is the syntax of the different ways to attach a search to a file link, together with an explanation:
[[file:~/code/main.c::255]] [[file:~/xx.org::My Target]] [[file:~/xx.org::*My Target]] [[file:~/xx.org::#my-custom-id]] [[file:~/xx.org::/regexp/]]
255
My Target
*My Target
#my-custom-id
CUSTOM_ID
property
/regexp/
regexp
. This uses the Emacs
command occur
to list all matches in a separate window. If the
target file is in Org mode, org-occur
is used to create a
sparse tree with the matches.
As a degenerate case, a file link with an empty file name can be used
to search the current file. For example, [[file:::find me]]
does
a search for ‘find me’ in the current file, just as
‘[[find me]]’ would.