I would like to use a custom link, i.e. [[h:blue][blue highlighted text]], to create highlighted text. The background color of the highlighted text is specified by the path. I have

 :export (lambda (path desc backend)
    ((eq 'html backend)
     (format "<span style=\"background-color: %s\">%s</span>" path (or desc ""))
 ;:face `(:foreground ,(lambda (path) (format "%s" path)))
 :face '(:background "yellow")     

The export works as expected, but I need to hard-code the background face to make any sort of highlighting. How can I fix this statement?

 :face `(:foreground ,(lambda (path) (format "%s" path)))

so the path can specify the color in emacs?

1 Answer 1


Here's my answer

(defun path-color (path)
  (list :background path))

then update the face statement to

 :face 'path-color

I based my answer by reviewing the last example of http://kitchingroup.cheme.cmu.edu/blog/2016/11/04/New-link-features-in-org-9/. I don't understand why list is needed.

  • you don't "need' a list, you could also return `(:background ,path) I think. May 18, 2019 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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