How can I have term.el (ansi-term) track directories if using anyhting other than bash

前端 未结 2 1481
情深已故
情深已故 2021-01-06 02:22

When using eshell or ansi-term and bash emacs changes the default-directory variable depending on what directory you are in.

So if I move to /home/user/code/pr

2条回答
  •  爱一瞬间的悲伤
    2021-01-06 02:44

    There are a number of solutions to this problem. I happen to prefer my implementation which changes the prompt to contain the current path, which Emacs recognizes and uses to get the behavior you want. Additionally, my solution hides the portion of the prompt which contains the path because I find it ugly.

    My solution can be found in the blog post: Emacs Tip #25 Shell Dirtrack By Prompt.

    However, there are a number of other solutions which can be found on the Emacs Wiki or other places:

    • Shell dirtracking again
    • Emacs Wiki Shell Dirtrack By Prompt

提交回复
热议问题