1

I just installed Emacs Speaks Statistics, which is when this error started showing up. Uninstalling hasn't fixed it.

When I use C-x C-f, I can navigate normally, but when I actually press enter, Emacs seems to insert "/Application Data/Application Data/" after "~" in all paths, e.g. if I navigate to:

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

And press enter, I open:

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

Any idea what variables I can edit to fix this?

Byrne
  • 11
  • 1

4 Answers4

0

You might be able to change this behavior by using M-x setenv. For example:

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

If that works, you can add

(setenv "HOME" "c:/Documents and Settings/admin")

to your init file for a more permanent solution.

gbrener
  • 5,365
  • 2
  • 18
  • 20
0

Check your HOME variable. Maybe it points to c:/Documents and Settings/admin/Application Data

The function that expands file names is : expand-file-name

Jérôme Radix
  • 10,285
  • 4
  • 34
  • 40
0

This seems to be a botch-up between current and cached values related to $HOME. The problem is that the pattern used to match the home directory isn't the same any more.

At some point (setq filename (abbreviate-file-name (expand-file-name filename))) messes up the name.

Here's a work-around I whipped up and added to .emacs, _emacs, .emacs.el or Application Data.emacs.d\init.el to get the abbreviated-home-dir back in shape:

Don't forget: do not byte-compile your init file or you may be out-of-sync.

;;; 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)
0

Emacs changed the default location of home in recent releases -- the new default is what you're seeing. Explicitly set env var HOME to whatever you want and things will be OK.

Drew
  • 29,895
  • 7
  • 74
  • 104
  • I usually set `HOME` in the Environment Variables dialog in the Windows Control Panel so that it is the same as `UserProfile`. [Instructions for Windows XP](http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx). – Michael Hoffman Oct 28 '11 at 22:00