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)