Emacs:在同名但位于不同目录的缓冲区之间切换 [英] Emacs: Switching Between Buffers with the Same Name but in Different Directories

查看:19
本文介绍了Emacs:在同名但位于不同目录的缓冲区之间切换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个同名但在不同目录中的文件:

I have two files with the same name but in different directories:

apples/main.cpp
oranges/main.cpp

我通过 emacs apples/main.cpp oranges/main.cpp

当我使用 C-x b 在这两个缓冲区之间切换时,缓冲区名称是main.cpp"和main.cpp<2>".我希望在切换缓冲区时能够看到这两个文件的完整路径,以便我可以在苹果和橙子版本之间消除歧义.有没有办法做到这一点?

When I use C-x b to switch between these two buffers, the buffer names are "main.cpp" and "main.cpp<2>". I would love to be able to see the full path of these two files when switching buffers, so that I may disambiguate between the apples and the oranges version. Is there a way to do this?

一种方法是在 Emacs 检测到具有该名称的缓冲区已打开时,修改在第二个 main.cpp 之后生成 <2> 的任何代码.但是,我找不到如何执行此操作.

One way could be to modify whatever code generates the <2> after the second main.cpp when Emacs detects that a buffer with that name is already open. However, I couldn't find how to do this.

推荐答案

使用 uniquify.我是这样用的:

Use uniquify. I use it like that:

(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

这篇关于Emacs:在同名但位于不同目录的缓冲区之间切换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆