Org 9 Links

John Kitchin has a very nice post and video demonstrating some of the new link features in Org Mode 9. It’s now easy to create custom link types and control the display, look, and action of the resulting links. You can, for example, choose the color you want for the link or what gets displayed in the tool tip, even making it dynamic.

As an example, Kitchin demonstrates a better file link that asks you what you want to do when you follow it. You can, for example, open it as usual, open it in Dired, copy the path, or any other action that makes sense.

A link’s look and action are controlled by a set of properties, which can be individually set for each link type. Here’s a list of the properties cut from org.el.

:follow - A function that takes the link path as an argument.

:export - A function that takes the link path, description and
export-backend as arguments.

:store - A function responsible for storing the link.  See the
function `org-store-link-functions'.

:complete - A function that inserts a link with completion.  The
function takes one optional prefix arg.

:face - A face for the link, or a function that returns a face.
The function takes one argument which is the link path.  The
default face is `org-link'.

:mouse-face - The mouse-face. The default is `highlight'.

:display - `full' will not fold the link in descriptive
display.  Default is `org-link'.

:help-echo - A string or function that takes (window object position)
as arguments and returns a string.

:keymap - A keymap that is active on the link.  The default is
`org-mouse-map'.

:htmlize-link - A function for the htmlize-link.  Defaults
to (list :uri \"type:path\")

:activate-func - A function to run at the end of font-lock
activation.  The function must accept (link-start link-end path bracketp)

There isn’t very much documentation on how to use this new facility so Kitchin’s post is really useful if you want to take advantage of link properties. Have a look at Kitchin’s video to get an idea of what’s possible. It’s 10 minutes long so it won’t be hard to schedule some time to watch.

This entry was posted in General and tagged , . Bookmark the permalink.