I have a working compilation error matcher, that contains the path to a file. The compilation buffer correctly adds a hyperlink to that file and I can open it in emacs. However, the file in question is an html report which I would like to open using an external browser. I already know how to modify the file element, so I could change it to give emacs a hint to open it with system tools. I think of something similar to a trump prefix for find-file, but in this case for overlay hyperlinks. Does such a prefix exist?

As a bonus question: I would like to not use the system default browser but a specific one, say firefox. How could that be done?

Note: I think as a last resort to try something like openwith, but this would smell more like a hack, because in general I want to open end edit html file in emacs.

1 Answer 1


You could redefine next-error-function in the compilation buffer and make it do something else, while using compilation-next-error-function as a fall-back. It's probably going to be some work.

  • In that case I would rather not let compilation-mode search for those errors and go for a (add-to-list 'compilation-finish-functions #'my-highlight-and-make-external-tool-buttons) or a hook like compilation-filter-hook. In my use case the files with external link are all at the buffer bottom, so I do not need compilation-next-error. I have to explore that in more detail, maybe someone can give me a hint which hook could be appropriate for this? Anyway, for completenes: how could I weave my findings into a compilation-next-error in custom filter functions?
    – theldoria
    Jul 6, 2017 at 5:29

Your Answer

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

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