简体   繁体   English

在 Emacs 中如何切换到其他缓冲区?

[英]In Emacs how to switch to other buffer?

The problem is following: I want to automate the way my emacs starts.问题如下:我想自动化我的 emacs 启动方式。 It has to be split in two buffers and the slime-repl has to be started in the smallest (bottom) buffer.它必须分成两个缓冲区,并且 slime-repl 必须在最小(底部)缓冲区中启动。 Plus, I want my file to be opened in the bigger (upper) buffer.另外,我希望我的文件在更大的(上)缓冲区中打开。 In my .emacs there are lines:在我的 .emacs 中有几行:

(slime)
...
(split-window-vertically -6)
(switch-to-buffer (other-buffer))
(find-file "g:/Private/pa/pa2.lsp")

SLIME opens ok in the bottom buffer, but the file is opened in one of the background buffers, while I want it to be in front. SLIME 在底部缓冲区中打开正常,但文件在后台缓冲区之一中打开,而我希望它在前面。

How to fix this?如何解决这个问题?

You can look to the function set-window-configuration...您可以查看函数 set-window-configuration...

But for slime you can use following functions - slime-complete-maybe-save-window-configuration & slime-complete-restore-window-configuration但是对于粘液,您可以使用以下功能 - slime-complete-maybe-save-window-configuration & slime-complete-restore-window-configuration

Instead of switch-to-buffer , use function pop-to-buffer .使用函数pop-to-buffer代替switch-to-buffer pop-to-buffer

(pop-to-buffer BUFFER-OR-NAME &optional OTHER-WINDOW NORECORD)

Select buffer BUFFER-OR-NAME in some window, preferably a different one.在某个窗口中选择缓冲区BUFFER-OR-NAME ,最好是不同的。

Try to add尝试添加

(ido-mode 1)

to your .emacs, and enjoy the result :)到您的 .emacs,并享受结果:)

Try:尝试:

(other-window 1)
(find-file "g:/Private/pa/pa2.lsp")

instead of your last two lines.而不是你的最后两行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM