I have 2 files:
- php file with code
- org file with docs
How to create a link to a line in php file from org file? So clicking it will move the cursor to the appropriate line in php file.
I have 2 files:
How to create a link to a line in php file from org file? So clicking it will move the cursor to the appropriate line in php file.
Use this notation in the org mode to create a link:
[[/path/to/file.php::line][string-to-display]]
If you want the file name to be displayed, use just
[[/path/to/file.php::line]]
See Hyperlinks in the Org mode Info page for details and other ways to specify links.
[[~/.hunspell_en_US]]
which is my user local dictionary. But when I place point on that file link and hit enter, it opens in TextEdit. –
Friede open-with
that for e.g. tells .pdf files to open in an external application, but I don't see anything in my config that should affect text files. Guess I'll ask it as a new question. Thanks though! –
Friede file:
for this to work properly. Otherwise it errors with "no match for fuzzy expression: <filename>". –
Pentstemon If I understand the question right you can do it automatically with two org-mode commands:
Move the point to a line in a php file and M-x org-store-link
.
Go to an org file and C-c C-l
or M-x org-insert-link
and follow the instructions in the minibuffer.
You are done, click the link or C-c C-o
when the point is on it to open the link.
I have org-store-link
on C-c l
and org-insert-link
on the default C-c C-l
. This makes the process very convenient and fast to execute.
Have fun with org-mode.
For posterity and some future seeker of this information, which I've been using for a few years in my docs.
Use: [[file+emacs:/path/to/file.php::line]]
The '+emacs' forces Emacs to open the link inside Emacs instead of some other app that handles that file extension.
© 2022 - 2024 — McMap. All rights reserved.
setq auto-mode-alist
for every dot file in my home directory, how can I force an org-mode file link to open the file in Emacs? – Friede