Org-mode offers a variety of different link types ([http], [file], [bibtex], [magit]...). However, they all get the same look defined by the face value for org-link.

Is it possible to e.g. change the background color depending on the type of link? So that http links would have a yellow background and file links a blue one?

  • Yes, it's possible, and there is probably more then one way to do it... but that's about all I can tell you :) Hopefully someone with more elisp skills then I have can write out a simple minor mode or something.
    – Brian Z
    Apr 26 '15 at 10:40

I would make this a comment, but I don't have enough rep so here goes:

Check out this function: org-activate-plain-links (in org.el).

You can modify the function around the 'add-text-properties', doing a match on each link using a cond for instance. I have student supervision now, but if you don't succeed in doing this, I'll add more information later.

  • org-activate-plain-links is a function alias and interactive for ignore, defined in subr.el.gz. This command is obsolete since 9.0; use ignore instead.
    – HappyFace
    Sep 22 at 11:27
  • org-activate-links is the new function.
    – HappyFace
    Sep 22 at 11:40

See https://github.com/jkitchin/org-ref/blob/651d24df5f52bb3f0d31c71ebdb604ce356fe674/org-ref.el#L484

I use that code to change the appearance of links in org-ref using font lock at https://github.com/jkitchin/org-ref/blob/651d24df5f52bb3f0d31c71ebdb604ce356fe674/org-ref.el#L742

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.