emacs-libvterm
emacs-libvterm copied to clipboard
Directory & prompt tracking work, except in tmux
I love this package as it's giving me a decent terminal inside Emacs. But I'm having trouble getting directory & prompt tracking to work inside tmux.
Without tmux, everything works. I can use find-file
and it will prompt me for a file in the directory that's current in vterm. But once I activate tmux, this stops working: I'm prompted in the directory in which I originally started tmux
, regardless of which directory I moved to in the meantime.
The same thing happens with prompt tracking: C-c C-n
and C-c C-p
work reliably without tmux, but they don't work properly once tmux is activated.
I source .bashrc-emacs-vterm.sh
at the end of .profile
, and inside tmux, the value of PS1
contains \[$(vterm_prompt_end)\]
, so the file gets sourced in tmux.
Do you have any idea where the problem might be, or where I might start looking to troubleshoot?
Emacs 28, latest vterm, libvterm 0.2, tmux 3.3.
I'm seeing the same problem with zsh.
I've tried everything I can think of; and can validate that the vterm_prompt_end
variable is getting initialized properly, but directory tracking just doesn't work inside tmux.
Would be happy to troubleshoot as well --
Emacs 28 and 29 , latest vterm, libvterm 0.2, tmux 3.3a --
I don't know if this is a clue, but when I enter a tmux session, simple vterm_cmd commands don't work --
I have in my .zshrc this stanza:
find_file() {
echo "RUNNING"
vterm_cmd find-file "$(realpath "${@:-.}")"
}
It fires both in a plain vterm session and under tmux -- in both cases I see the "RUNNING", but under tmux the vterm_cmd
doesn't happen and the file doesn't open... bizarre --
Actually, I've debugged further and I think the escape sequence in vterm_printf
just isn't working for me --
my version of the function is:
if [ -n "$TMUX" ] && ([ "${TERM%%-*}" = "tmux" ] || [ "${TERM%%-*}" = "screen" ] ); then
# Tell tmux to pass the escape sequences through
printf "\ePtmux;\e\e]%s\007\e\\" "$1"
elif [ "${TERM%%-*}" = "screen" ]; then
# GNU screen (screen, screen-256color, screen-256color-bce)
printf "\eP\e]%s\007\e\\" "$1"
else
printf "\e]%s\e\\" "$1"
fi
}
and my current TERM inside tmux is tmux-256color
which is firiing the first escape sequence clause -- any ideas for to debug further?
I've figured this out.
Tmux 3.3 added a new option allow-passthrough
to turn on / off passing through escape sequences. Its default is off
joostkremers:
put this in your .tmux.conf --
set -g allow-passthrough on
and dir tracking will work again
So not an issue in emacs-vterm -- !
Thanks for figuring this out. Unfortunately, there must be something else in my config that's causing this issue, because I'm running tmux 3.0 and installing 3.3 doesn't change anything...
Edit: On my work computer, which has a different Linux distro (Arch) and which has tmux 3.3, it does work...
Same here, doesn't seem to work with tmux, even with set -g allow-passthrough on
. 🤔