emacsansi-term

clickable overlay in ansi-term


I am the author of the julia-repl package, which runs an inferior Julia REPL inside ansi-term. A full terminal is necessary because of color and terminal interactions. I need some help extending this to make error locations "clickable".

Julia error messages look like this:

julia> Foo.foo()
ERROR: DomainError:
Stacktrace:
 [1] foo() at /tmp/Foo.jl:2

I would like to make the /tmp/Foo.jl:2 "clickable", so that a mouse click takes the user to line 2 of /tmp/Foo.jl.

I started reading the relevant section of the Emacs manual but need some help implementing this. In particular,

  1. what's the best way to find these snippets of text with a regex?
  2. how to run this each time the buffer changes?
  3. can I run this on only the new output?
  4. how to specify a particular line of a file as a target?

I am happy to do some reading and study existing examples, but don't know where to start. A minimal example would help a lot.


Solution

  • Ideally you'd want to use something like compilation-shell-minor-mode. But I'm not sure how/if it can work in an ansi-term buffer.