Emacs: Opening a file within the same Emacs session from a tmux session in ansi-term

256 Views Asked by At

I often come across the situation where I want to open a file that I am viewing from my tmux session in ansi-term into my Emacs session. I tried to use find-file-at-point (see Max Bozzi's answer below), but in tmux it only directs me to the working directory of my ansi-term session, and it does not detect the file in my tmux session. With ansi-term alone, find-file-at-point works fine, but I prefer to use a session manager, or at least a solid terminal multiplexer.

Any suggestions?

For example, here is my tmux session in ansi-term:

lucas@~/Downloads$ ls
A CHRISTMAS CAROL (ILLUSTRATED with Special Kindle Format).azw3
bleachbit_1.0_all_ubuntu1310.deb
Island of the Blue Dolphins.azw3
javaPong.jnlp
test.txt

How do I open test.txt within my Emacs session?

1

There are 1 best solutions below

1
smiling_nameless On

One option is to place point on the name of the file and then run find-file-at-point. I find that to be useful enough to bind to M-'.

Another is to just use the standard C-c C-f and tab-complete the name, or maybe if you really wanted to, to have recursive Emacs and have Emacs running inside Emacs' own terminal buffer. Presumably you wouldn't, though, so I would stick to find-file-at-point.