Emacs 如何在当前目录中打开终端?

Emacs 如何在当前目录中打开终端?,emacs,Emacs,当我使用M-xshell打开新终端时,它有时会将当前目录设置为中的文件。但有时不会。那么,是否有一个函数始终在当前目录中打开新的终端?M-x shell将切换到现有的shell(如果已经有一个正在运行),这可能是您的问题。如果您不介意创建大量shell缓冲区,那么下面的命令将在找不到访问给定目录的缓冲区时生成新的缓冲区: (需要“cl-lib”) (在dir(dir)处拆卸外壳 “在DIR打开一个shell。 如果已存在外壳缓冲区访问目录,请显示该目录。“ (交互式(列出默认目录)) (如果没有

当我使用M-xshell打开新终端时,它有时会将当前目录设置为中的文件。但有时不会。那么,是否有一个函数始终在当前目录中打开新的终端?

M-x shell
将切换到现有的shell(如果已经有一个正在运行),这可能是您的问题。如果您不介意创建大量shell缓冲区,那么下面的命令将在找不到访问给定目录的缓冲区时生成新的缓冲区:

(需要“cl-lib”)
(在dir(dir)处拆卸外壳
“在DIR打开一个shell。
如果已存在外壳缓冲区访问目录,请显示该目录。“
(交互式(列出默认目录))
(如果没有,则将其拆除
(lambda(it)
(使用当前缓冲区)
(和(派生模式-p'壳模式)
(等于默认目录目录目录)
(缓冲区列表‘‘‘‘)
(如适用)
(切换到缓冲区buf)
(shell(生成新的缓冲区名称“*shell*”));)

在ELPA中有一个软件包
shell:
M-x列出软件包
,在这里查找
shell
,标记安装(
i
)并执行(
x

自述文件摘录:

Open a shell buffer in (or relative to) default-directory,
e.g. whatever directory the current buffer is in. If you have
find-file-in-project installed, you can also move around relative
to the root of the current project.

I use Emacs shell buffers for everything, and shell-here is great
for getting where you need to quickly. The =find-file-in-project=
integration makes it very easy to manage multiple shells and
maintain your path / history / scrollback when switching between
projects.
github主页:

我也喜欢
shell弹出窗口
,可以轻松弹出一个shell缓冲窗口。埃尔帕可能还有更多