From the emacs manual

Unlike Shell mode, Term mode does not track the current directory by examining your input. But some shells can tell Term what the current directory is. This is done automatically by bash version 1.15 and later.

It seems this is not done by zsh, at least not by default. Is there an option that I can enable or something?


1 Answer 1


After grepping around the bash source, I found this:

static void
send_pwd_to_eterm ()
  char *pwd;

  pwd = get_string_value ("PWD");
  if (pwd == 0)
    pwd = get_working_directory ("eterm");
  fprintf (stderr, "\032/%s\n", pwd);

That's a bit different then what is documented currently in term.el. It seems all I need to put in my .zshrc to get this to work is the following:

if [ -n "$INSIDE_EMACS" ]; then
    chpwd() {
        print -P "\032/$(pwd)"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .