我希望能够像以下命令一样使用Emacs打开多个文件:
emacs file1 file2
当Emacs启动时,我希望Emacs屏幕不会水平分割。我期望的是在不同的缓冲区中打开文件,只有一个文件显示在整个Emacs窗口中。
那么我该怎么做呢?
我希望能够像以下命令一样使用Emacs打开多个文件:
emacs file1 file2
(add-hook 'window-setup-hook 'delete-other-windows)
我想要的效果已经实现了...在我询问这里之后才发现。
好的,您可以这样设置一个(tcsh)别名
alias emacs emacs -eval '"(run-with-idle-timer 0 nil (quote delete-other-windows))"'
这将使emacs隐藏所有其他窗口(因此您只有一个窗口)。因此,您的调用
emacs file1 file2
被翻译为
emacs -eval '"(run-with-idle-timer 0 nil (quote delete-other-windows))"' file1 file2
虽然不太优雅,但是它能用:
$ emacs -nw --eval "(mapcar 'find-file '(\"1.txt\" \"2.txt\"))"
或者在Emacs加载后按C-x 1。
个人认为,如果您从命令行调用它,那么您正在误用Emacs。我倾向于从Emacs内部的eshell中访问文件。
find-file
命令在 eshell 中访问文件。 - jrockway