为什么W32 Emacs会插入/应用程序数据/应用程序数据;当我使用C-x C-f时,是否将其放入以~/开头的文件路径?

为什么W32 Emacs会插入/应用程序数据/应用程序数据;当我使用C-x C-f时,是否将其放入以~/开头的文件路径?,emacs,dot-emacs,emacsw32,Emacs,Dot Emacs,Emacsw32,我刚刚安装了Emacs Speaks Statistics,这就是这个错误开始出现的时候。卸载还没有修复它 当我使用C-x C-f时,我可以正常导航,但当我实际按enter键时,Emacs似乎会在所有路径的“~”之后插入“/应用程序数据/应用程序数据/”,例如,如果我导航到: c:/Documents and Settings/admin/My Documents/sig.html 然后按enter键,我打开: ~/Application Data/Application Data/My Doc

我刚刚安装了Emacs Speaks Statistics,这就是这个错误开始出现的时候。卸载还没有修复它

当我使用C-x C-f时,我可以正常导航,但当我实际按enter键时,Emacs似乎会在所有路径的“~”之后插入“/应用程序数据/应用程序数据/”,例如,如果我导航到:

c:/Documents and Settings/admin/My Documents/sig.html

然后按enter键,我打开:

~/Application Data/Application Data/My Documents/sig.html


知道我可以编辑哪些变量来解决这个问题吗?

检查您的主变量。可能它指向
c:/Documents and Settings/admin/Application Data


扩展文件名的函数是:
expand file name

这似乎是与$HOME相关的当前值和缓存值之间的错误。 问题是用于匹配主目录的模式 已经不一样了

在某个时候 (setq文件名) (缩写文件名) (展开文件名(文件名))) 把名字弄乱了

这里有一个我快速编写并添加到.emacs、_emacs、.emacs.el或 Application Data.emacs.d\init.el 要使缩写的home dir恢复形状,请执行以下操作:

别忘了:不要编译初始化文件,否则可能会失去同步

;;; files.el mistakenly initializes abbreviated-home-dir just once
;;; not realizing that its value should change when HOME is redefined.
;;; Thus abbreviated-home-dir is "^c:/Documents and settings/USER/Application Data\\(/\\|\\'\\)"
;;; when it should, now, be "^c:/Documents and settings/USER\\(/\\|\\'\\)"
;;; Then when you try to open "^c:/Documents and settings/USER/Application Data/"
;;; The name is abbreviated to "~", but expanded back to "c:/Documents and settings/USER/"
;;; losing part of the name ("Application Data/")
;;; 
;;; Rather than explicitly re-initialize abbreviated-home-dir, it should be set to nil
;;; (setq abbreviated-home-dir "$foo") ;; Impossible pattern match.
;;; This causes the filepath to never match, and ~ is never abbreviated.
;;;
;;; We _could_ explicitly initialize it:
;;; (setq abbreviated-home-dir "^c:/Documents and settings/badgerb\\(/\\|\\'\\)")
;;; But this is a bad idea.  It is _highly_ dependent on the workings of files.el, and it
;;; seems better to me to just clear the value and let files.el re-initialize it.
(setq abbreviated-home-dir nil)

Emacs在最近的版本中更改了home的默认位置——新的默认位置就是您看到的。显式地将env var
HOME
设置为您想要的任何值,一切都会好起来。

您可以使用
M-x setenv
更改此行为。例如:

M-x setenv <RET> HOME <RET> c:/Documents and Settings/admin

我通常在Windows控制面板的环境变量对话框中设置
HOME
,使其与
UserProfile
相同。
(setenv "HOME" "c:/Documents and Settings/admin")