zzamboni.org

Solving Hangs in Emacs on Windows

One change I made that had a significant improvement (for me anyway) was to add the following to my .emacs file:

; try to improve slow performance on windows.(setq w32-get-true-file-attributes nil)

It seems this variable was changed to default to “true” relatively recently and is known to cause some slow-down problems around file access. I still get some random hangs now and then (probably due to my .emacs customisations) but it is much better now.

I have battled for a while with Emacs on Windows (I tried Vista and Win7 so far) hanging for a few seconds every once in a while, usually while typing or saving a file. I have finally found the solution, thanks to the all-knowing stackoverflow.com. It seems the w32-get-true-file-attributes variable changed its default value to ‘t in recent versions, and this seems to cause the problem.

After setting the variable to nil as shown above, the hangs have disappeared. It still takes a long time to open a file (I think the culprit here is font-lock-mode), but that’s a far less frequent operation, so it is tolerable.