如何防止emacs解析路径中的目录符号链接?

如何防止emacs解析路径中的目录符号链接?,emacs,path,symlink,Emacs,Path,Symlink,我有一个项目,叫做“foobar”,当我签出时,它的所有源代码都在文件夹“foobar/foobar”中。因为顶级foobar目录除了内部foobar目录之外什么都不包含,所以它毫无意义,但这就是最初将内容检入项目的方式,它不在我的控制范围之内。这会使路径变得更长、更难读取,因此我将顶层foobar重命名为“foobar checkout”,然后创建一个名为“foobar”的符号链接,链接到“foobar checkout/foobar”。这样我就可以打开“foobar/source.c”而不是

我有一个项目,叫做“foobar”,当我签出时,它的所有源代码都在文件夹“foobar/foobar”中。因为顶级foobar目录除了内部foobar目录之外什么都不包含,所以它毫无意义,但这就是最初将内容检入项目的方式,它不在我的控制范围之内。这会使路径变得更长、更难读取,因此我将顶层foobar重命名为“foobar checkout”,然后创建一个名为“foobar”的符号链接,链接到“foobar checkout/foobar”。这样我就可以打开“foobar/source.c”而不是“foobar/foobar/source.c”


这适用于我在shell中时,以及我第一次在emacs中打开文件时,但之后emacs将解析符号链接。因此,如果我打开source.c并按Ctrl+XCtrl+f打开一个新文件,它列出的路径是“foobar checkout/foobar/”而不是“foobar/”。有没有办法让emacs不解析符号链接,这样我就可以享受更短的路径

我刚刚在GNU Emacs 22.2.1上试用过,但它似乎无法解析我的符号链接。符号链接的解析是否可能不是普通的emacs行为,而是文件打开模块(如ffap.el)无意中引入的

无论如何,我都无法测试我的想法,但我突然想到,您可能会覆盖file-symlink-p,目前描述为:

file-symlink-p is a built-in function in `C source code'.

(file-symlink-p FILENAME)

Return non-nil if file FILENAME is the name of a symbolic link.
The value is the link target, as a string.
Otherwise it returns nil.

This function returns t when given the name of a symlink that
points to a nonexistent file.
如果将其修改为始终返回nil,则emacs可能无法解析符号链接:

(defun file-symlink-p (FILENAME)
    nil)

当然,这可能会破坏一些其他东西,但也许值得一试。

我刚刚在GNU Emacs 22.2.1上尝试过这一点,但它似乎无法解析我的符号链接。符号链接的解析是否可能不是普通的emacs行为,而是文件打开模块(如ffap.el)无意中引入的

无论如何,我都无法测试我的想法,但我突然想到,您可能会覆盖file-symlink-p,目前描述为:

file-symlink-p is a built-in function in `C source code'.

(file-symlink-p FILENAME)

Return non-nil if file FILENAME is the name of a symbolic link.
The value is the link target, as a string.
Otherwise it returns nil.

This function returns t when given the name of a symlink that
points to a nonexistent file.
如果将其修改为始终返回nil,则emacs可能无法解析符号链接:

(defun file-symlink-p (FILENAME)
    nil)

当然,这可能会破坏一些其他东西,但可能值得一试。

您可能想使用
目录缩写列表
或者
vc follow符号链接
您可能想使用
目录缩写列表
或者
vc follow符号链接
很可能这不是一种普通的emacs行为,我确实打开了ido模式和一百万其他东西,我将尝试使用普通配置并写回…很可能这不是普通的emacs行为,我确实打开了ido模式和一百万其他东西,我将尝试使用普通配置并写回。。。