Linking and Exporting Org "info:" links— Kaushal Modi
Journey of Org links from copying (storing) them, inserting them in
Org documents and exporting them. The focus of this post is on the
info: type Org links, but the same concept would apply to any Org
- This post was re-exported today to get better
info:link exports as described in a newer post.
This post was inspired out of the exercise of support
info: Org link
There are 3 steps:
- Storing a link from any buffer that you want to later document in an Org file.
- Inserting that link that you stored earlier.
- Exporting the Org document.
I am focusing on the
info: Org links in this post, they these steps
apply to any Org link type.
1 Storing links to Info nodes #
If you follow the instructions on Org Info: Activation, you’ll see that
it is recommended
This post assumes that you have actually set this binding. If you
haven’t yet, go do it already!
(global-set-key (kbd "C-c l") #'org-store-link)
to bind the
org-store-link command to C-c l in your Emacs
org-store-link stores an Org Mode compatible link based on the
context i.e. type of buffer where the point is. Org supports a
variety of links as documented in Org Info: External Links.
If the point is in an ∗Info∗ buffer and
org-store-link is called, it
info: type link that will lead back to the same node where
the point was.
Let’s say you have opened the Org Info manual and you hit C-c l. You should then see this in the Echo Area:
The link to Org manual’s Top node is stored by that command, but only temporarily – it isn’t yet saved anywhere.
2 Inserting stored links #
These stored links can now be saved in an Org file. To do that,
- Visit an Org file or a buffer and call M-x org-insert-link (bound to C-c C-l by default) and follow the prompts.
- An immediate RET after the prompt will select the last stored link to be inserted.
- The second prompt allows you to change the link description, and then the link will be inserted.
If I insert the
org#Top Info link that I stored earlier over here,
and accept the default link description, it will paste as
But .. how did the link description become “
org#Top” by default?
ol-info.el library did that.
Org Link library for
info: links (
The default description for
info: type links was set at the time of
storing those links, with the help of the
ol-info.el. That same description is then suggested at
the time of inserting that link.
This library defines these “actions” for
[[info:..]] type of links:
- Defines when (in which buffer, major mode, etc.) the
“store” operation should store to an
info:type link, and what metadata should be stored. Some of the stored metadata are: the Info file name, node name, link string and description string.
- Defines what action to perform when
org-open-at-point(C-c C-o) is called with point on the link. Hitting this binding with point on an
info:link will open or switch to that ∗Info∗ node.
- Defines how the link should be exported for various
ol-infodefines how the
info:links should be exported, but only for
[[info:..]] links using
ol-info.el defines the
:export “action” such that
get converted to hyperlinks pointing to online Org manual pages, when
But it didn’t do the same when exporting using
ox-hugo. That feature
got added recently in this
ox-hugo commit. Now
[[info:org#Top][org#Top]] to org#Top.
I didn’t like the
org-info-store-link added to the default
description (notice that previous link). So I added a tiny little
feature to the
info: export behavior 😁 — If you leave the
info: link descriptions empty when inserting the links,
injects its own “auto description” which are better (in my
Now when that same Info link is inserted description-less as
[[info:org#Top]], it renders to: Org Info.
- Store link (from anywhere in Emacs) : C-c l
- Insert link (in an Org file) : C-c C-l
- Export the Org file as usual.