Latest News: Released version 1.58. It will be that for a long while. I do not change the EmacsW32 version number though I upload versions of Emacs+EmacsW32 based on the latest CVS Emacs.
Tip for editing here: ms windows file names and the name EmacsW32 upsets this wiki software. Put %%...%% around those things.
For more information, and for downloadable packages, look at the home page: http://ourcomments.org/Emacs/EmacsW32.html.
Go to the download page http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl or CategoryWThirtyTwo.
“Beta” versions are availabe here: http://ourcomments.org/Emacs/DL/EmacsW32/test/.
From EmacsW32 version 1.14 it includes the unix programs most commonly used by Emacs.
From the documentation for EmacsW32:
New installation packages based on the latest version of CVS Emacs are regularly uploaded. The date of the last upload is most often entered on CategoryWThirtyTwo but please see also the home page above. There is also a guide for building Emacs yourself from the developers CVS for Emacs, using MinGW. To make this really simple there is a cmd-script too to do that.
Note that you can download both patched and upatched versions of Emacs together with EmacsW32. From the download statistics for my web site I can see that nearly all who download prefer the patched versions.
EmacsW32 was before called Emacs Setup Utilities for MS Windows (the wiki page was WThirtyTwoInstallationKit). Thanks to DrewAdams for pointing out the need for a name and better documentation and to all others who have encouraged me in my work with this.
I may be the only person on this planet who thinks that it is too difficult to begin using Emacs on MS Windows. However I did find some things unnecessarily difficult.
First of all, there was no installation program of the type you normally get on MS Windows. To install Emacs you had to get some unpacking utilities that were not so easily found. (Or you could use some commercial utility program, but is not that a little bit against the mindset of Emacs?)
If you get past this trouble you find that some of the most commonly used keyboard keys for editing under MS Windows, like control-x and control-v, does not function at all in Emacs. And then you find that the menus do not seem to work unless you are using a mouse. Well, you are a keyboard user, for sure, otherwise you would not even think about the trouble of learning Emacs. So you are a bit disappointed about the menus. (OK, after a while you may discover that you can use F10 to get to the menus.)
Naturally you want to associate some files with Emacs to work comfortably in MS Windows. You do and find that it takes a lot of time to start edit any file. Seems like Notepad is a better alternative since you just do not have time to do anything in Emacs!
If you happen to get over this and do some work in Emacs you soon discover that you have trouble printing. If you are lucky you can find some tips and get over it. But do not bet on it! I could not (until I wrote my own hack to do it).
Then you may think you are ready, but you are not! Now you discover that you need some Unix programs to do the job. After some search you may find some that seems to do work for you. Ready? Oh no! There are those small things called “line endings” … - they are different on Unix and w32. So you hope that the maintainers of these utilities tries to take care of this. Hope is a good thing, but you may find they do not care much about this. Some of them say that “it is not my fault, it is MS Windows that mess things up”. Maybe, but it does not help you ;-)
And still it is easy - now. I hope. Just try EmacsW32 and the pre-built binaries for CVS Emacs. And read the documentation in EmacsW32 for how to get the Unix tools you need. There are some problems with those, but it has actually improved.
I built EmacsW32 in a way that I hoped would make it easy for other to use it. It is rather easy to make your own distribution package (but I am not aware of anyone that has done that yet) and it could also serve as just an easy installation. The following sites are among those that currently recommends or use EmacsW32:
The best place to ask questions about EmacsW32 or Emacs on MS Windows is probably the mailing list help-emacs-windows. You can also put suggestion and comments about EmacsW32 below.
The screen you get with EmacsW32 options when you start EmacsW?32 the first time looks weird, it has “nil” and “t” in some input fields which will not be intuitive to a new user. The “real” customize screen you get with an explicit
M-x customize-group <ret> emacsw32 <ret>
has proper on/off toggles and buttons to save the changes. I’d suggest that one be used for start instead, or maybe a special emacsw32-start customize group with just the most important options.
Thanks Per. I have changed nil/t to off/on, but I do not want to change the page right now. I think it gives a reasonable good overview over the settings that EmacsW32 can assist with. Also some users would like me to just turn on the things in the top section. Making it possible to turn them on with just one click is a middle way.
In the long run I would like to turn that section into something more generic, ie choose between w32 setup, mac setup, gnu/linux dito etc. (And of course then move it into another package…)
Is this pseudo-key added by EmacsW32? Searching for “site:gnu.org “language-change” emacs” shows no relevant results and all references to it that I can find seem to be about EmacsW32. It is bound to (ignore) by default and I would like to toggle the input method instead. The problem is that
(global-set-key (kbd "<language-change>") 'toggle-input-method) will mean that changing language toggles both input method and Windows language – not at all what I want! I could do something like (borrowed from http://dima-exe.ru/2007/4/win32-emacs-and-change-language for those who read Russian)
(defvar safe-language-change-flag nil) (defun safe-language-change () (interactive) (setq safe-language-change-flag (not safe-language-change-flag)) (when safe-language-change-flag (toggle-input-method) (???)) (global-set-key (kbd "< class="comment">;language-change>") 'safe-language-change)
Trouble is, what goes in place of ??? I want Emacs to send a language-change event to Windows, so it thinks Emacs is using English and makes Emacs call (safe-language-change) again to toggle the flag back. But how can I do this?
I have no idea how this works and I do not think the question is specific to EmacsW32. It sounds like there could be some bug here and it might be better if you ask on Emacs developers list.
Is there a possibility to release patched Emacs 22.2 (and to track v22.x branch) binaries? In the times of Emacs 21, CVS version was much more usable option. However arguably things are different now, it is probable that part of the users will want to use latest patched version 22 and not CVS 23.
It is a good question, but I have decided I do not have time to do that too. What I normally do is try to check if the patched version I upload is usable. However there has been a lot of small problems right now because of the big changes that have been done to CVS Emacs 23. It looks however like it is going to be ok now. I have just uploaded a new Emacs+EmacsW?32 binary from today. It looks very good to me.
I love that you switched META to the Windows key! It would be nice to bind CONTROL to something other than Ctrl. cua-mode sorta works, but I’d rather dedicate Ctrl just to Windows CUA stuff and use something else for emacs C- commands. CAPS LOCK or the Apps key seem like the best choices. I suspect this would take a patch to do. – Chiok
Yes, it would be a rather big job. Actually Emacs CUA mode works nicely without this change. Have you tried it?
I’ve installed latest EmacsW32 and have a problem: when emscsclient runs i receive an error in emacs stating: make-directory: Creating directory: invalid argument, c:/Documents and Settings/Администратор
my %HOME% variable points to other directory namely M:\MD\ (the listed is the default one on Russian Windows one and my .emacs loads from M:\MD quite OK)
Please file a bug report, use Help - Send Bug Report from the menus.
Oops! Not sure that it’s an emacs problem. But I have gmail as mail default email-client and when I try to send a bug report I receive “compose new email” window with subj and text but with no email address.
There is something wrong here. Please look up my email in the sources and contact me by mail – LennartBorgman
(question/comment by piyo) How is EmacsW32 different from Meadow (Multilingual Enhancement to GNU Emacs with Advantages Over Windows)? Is it mainly the add-on lisp files? Meadow has a Cygwin-like installer (setup.exe), and you can select elisp packages just like cygwin packages. Is it possible to make a EmacsW32 package for Meadow?
EmacsW32 is a bit more than add-on lisp files. It would however be easy to add the add-on lisp files to Meadow I guess. If you just want the lisp files then download the zip file with just EmacsW32.
For more information of what EmacsW32 is please see the home page (there is a link in the beginning of this page). Things you might be interested in is the gnuclient/server solution and the installation of this. Part of the latter is in the installer however. You may also be interested in the patches to the Emacs C sources.
For people interested, here the content for
C:\.emacs in to order to share both Emacs versions configuration files:
;; Bootstrap in %APPDATA% area (message (concat "Bootstrapping in " (getenv "APPDATA"))) (setenv "HOME" (getenv "APPDATA")) (load "~/.emacs")
Another way is to setup the registry: see MsWindowsDotEmacs. Beware that you cannot use environment variables like
APPDATA, so use the complete pathname. Moreover, if your administrators are doing a migration, you will have to update the registry entry by yourself.
Off course, you have to check Emacs version in
.emacs in order to avoid odd behaviour in 21.3 or 22.x versions. I use a vanilla version not the w32 version, so I just configure emacsw32 only in 22.x version:
(when (and (eq system-type 'windows-nt) (string= (substring emacs-version 0 3) "22.")) (setq pr-gs-command "c:\\gs\\gs8.51\\bin\\gswin32c.exe") (setq pr-gv-command "C:\\Program Files\\Ghostgum\\gsview\\gsview32.exe") (setq w32-print-menu-show-print nil) (setq w32-print-menu-show-ps-print nil) (setq htmlize-view-print-visible t) (setq emacsw32-style-frame-title t) (setq emacsw32-mode nil) ; Keep Emacs bindings (setq w32shell-cygwin-bin "C:\\cygwin\\bin") (setq w32shell-msys-bin "C:/msys/1.0/bin") (require 'emacsw32) (require 'w32-integ) (require 'w32shell) (w32shell-add-emacs) (w32shell-set-shell "msys") (require 'cmd-mode) (require 'w32-print))
(eq system-type 'windows-nt) is here because I use the same
.emacs on Windows, Linux, FreeBSD? and OSX.
I barely know LISP so I apologize if the style is bad. My English is not very good too. Sorry.
Is there an Elisp variable (or two) to check to determine if you are running a patched Emacs and, if so, what version?
Yes, but no particulary good way. I will add one. At the moment use (fboundp ‘w32-wh-keyboard-ll)
We use some in-house made lisp code to start an external program from Emacs and to interact with it through Emacs buffer. It basically goes through (start-process …) with some process filtering. Now what happens with the patched version, is that a DOS window starts with the external program running, and no output shows up in the assigned buffer. It doesn’t happen with an unpatched version. I use Emacs-22-CvsP070215-EmacsW32-1.39.exe resp. Emacs-22-CvsU070219-EmacsW32-1.39.exe. I tried to set w32-start-process-show-window to nil or t before (start-process..) but it doesn’t change anything in patched Emacs. Any ideas how to fix it lisp-wise?
This problem is solved. Thanks Konstantin for the help with testing this! – LennartBorgman
After installing recent versions (including the latest) of emacsw32 with patched emacs.exe, running ‘emacs -nw’ results in “A fatal error has occurred!” I have not debugged at all. However, a colleague says that the same sequence does not crash when using the latest emacsw32 distribution with your unpatched emacs.exe.
This has been solved in emacsw32 version 1.52.
Added better support for -e and ediff in version 1.03 of EmacsW32. See http://ourcomments.org/Emacs/EmacsW32.html for more details.
EmacsW32 is a great set of tools, making it much easier to get started with Emacs on Win32. Among other things, the *.cmd files included are quite helpful. A couple of small suggestions for them:
Unfortunately it still seems hard to fix this easily. The “shift” command does not change %*.
It no longer starts with that comment ;-)
Thanks for the feedback. Fixes will be in EmacsW32 1.39.
Choosing from the menu Help/More Manuals/Emacs Lisp Reference gives the error: Info-find-file: Info file elisp does not exist
I can’t reproduce this problem? Is there someone who still sees it?
There has been some requests for unpatched Emacs binaries for w32 in a zip file. Due to this I now also upload such files at the same time as I upload a setup program for the unpatched Emacs+EmacsW32. It is quite a bit larger than the installer though it contains less.
I realize that it may seem useful, but in fact I do not believe it is. If you take the unpatched version of Emacs+EmacsW32 and install just the Emacs part that is in effect the same as unzipping the Emacs file. There is also one little change to the Registry at [HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Emacs+EmacsW32_is1]. (This is the entry in Add/Remove Programs in the Control Panel. It may also be at HKCU.) Otherwise all that is happening is that the files for Emacs itself are unpacked.
I understand that some of the worries about using the installer is that it is hard to know exactly what it does. I have tried to describe this in EmacsW32 Installation Wizard.
See also CategoryWThirtyTwo for other possibilities to get precompiled binaries.
I just downloaded the zip file for Emacs 22.0.92 (CVS 2006-12-30). Everything is working, but the GNU Emacs logo in the splash screen and the tool bar icons are not in color! Otherwise the color support seems fine, as evidenced by
‘M-x list-faces-display’. What could be causing that?
That is how it is supposed to work. You have to download the image libraries yourself if you use the unpatched version. Please see the documentation that comes with Emacs.
I got some requests to include the Emacs C sources in the installer. (The elisp sources are already there of course.)
I do not want to do that because it makes the download a bit bigger. It is however easy to get the sources and arrange so that they will be opened when you want to look at them using the links in help. Just download the sources from my site, unpack them and set the variable
to the directory where the C sources subdirectory “src” has been unpacked.
The sources can be found in the http://ourcomments.org/Emacs/DL/EmacsW32/src/ folder. Choose the ~2MB files with a name corresponding to the name of the installer you used to install Emacs+EmacsW32. (I thought I had written this clearly in the readme-files, but it looks like I have erased that. I will put it back there.)
I setq frame-title-format in my .emacs, but this was getting clobbered by the emacsw32-style-frame-title which seemed to be setting my frame-title-format to nil after my .emacs was run. – DamyanPepper
Thanks Damyan, this has been resolved now in EmacsW32.
I recommend placing a warning in your instructions about old .emacs files. When I installed, I had an old .emacs file in the
C:/ directory that caused emacs to crash during the install procedure so that the install didn’t complete. After I changed the name of this file, the installation when smoothly and I am happy with the result.
I hit the problem too, wanting to keep both 21.3 and 22.214.171.124 on my 2k system.
The symptom is “Error (initialization): User has no home directory” and no .emacs file loaded.
A quick look at HOME env. var shows:
(getenv "HOME") -> "Š,ûw"
This problem has been solved in CVS Emacs from 2006-05-20. – LennartBorgman
After downloading Emacs-22-CvsP061205-EmacsW32-1.11.exe and installing, I get the following error when I double-click the Emacs icon:
“The requested Emacs remote server is not running”
This error pops up in a window-box titled “EmacsClient ERROR”. This leaves an “emacsclientw” process running as well.
I get a similar error when I run “emacsclient” from the command-line.
Emacs runs (and seems to run successfully) if I run “runemacs”, but it doesn’t allow newly opened files (outside of emacs) to use the already running emacs version (which is the whole point behind gnuserv, and emacsclient, I believe).
I’m familiar with the old gnuserv stuff, but I’m not that familiar with “emacsclient”. I don’t even know where to look.
I had this problem too. It appears that the problem is due to your %HOME% environment variable not being set, or being set incorrectly. EmacsW32 used to behave as if %HOME% pointed to C:\Documents and Settings\Username\Application Data\. It now behaves as if it were set to C:\Documents and Settings\Username\, but, and this is the important thing, emacsclient and emacsclientw can’t find your emacs if the environment variable is not actually set. I think the registry munging that happens when you install is supposed to take care of this, but it doesn’t actually do so.
This isn’t really a gnuclient vs. emacsclient issue; emacsclient on Unix doesn’t act like this.
Hi Stewart and Jason, I am sorry for this trouble. I did not notice it myself first. It was a missing initialization in my patched version of Emacsclient.
I think I had to explain some details here. Some history first. GnuClient did not automatically start Emacs from the beginning. I however found that so awful so I added this feature to the version of GnuClient that came with EmacsW32 before. Some weeks ago EmacsClient finally became available for MS Windows. This however also lacked the feature to start Emacs automatically so I added it to the patched version of Emacs before I removed GnuClient. Actually the patched EmacsClient should work for any platform, but the code is currently untested on other platforms. It was decided on the Emacs developers list that this feature should not be added now, see the archives there.
So at the moment EmacsClient that comes with the patched version of Emacs+EmacsW32 starts Emacs automatically, but the unpatched version of EmacsClient does not do that. I do not think the HOME environment variable is involved here, since when EmacsClient starts Emacs it also tells Emacs to start Emacs server (with the parameters given to EmacsClient of course).
Curently EmacsW32 is based on Emacs 22. Would it be possible to create Emacs-23 based version of EmacsW32, or at least unpatched version, if patched require too much time.
The latest version is from CVS Emacs 23.
At http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl you say that “There will be know unpatched binaries for the released version of Emacs 22.1 here”. What about patched binaries? Or can the latest EmacsW32 only work with Emacs 23?
At the moment I have no plan to build Emacs 22. However you can use the EmacsW32 only downloads.
Also, is it possible/safe/a good idea to have both old and new version of EmacsW32 installed at the same time?
No problems I hope.
According to http://www.emacswiki.org/cgi-bin/wiki/IciclesIssues, Icicles may have some problems with Emacs 23. – AlexeyRomanov
What Icicles problems are you referring to? I just searched IciclesIssues for “23”, and AFAICT all of the issues reported for Emacs 23 have been solved. I’m not making any guarantees, but I see no reported problems, at least. Let me know what problems you have in mind. Thx – DrewAdams
Downloaded Emacs-23-CvsP080321-EmacsW32-1.55.exe on 24 Mar 2008 and found that the file rebind.el is missing, yet required from c:/Program Files/Emacs/EmacsW32/lisp/emacsw32.el – JamesKingston?
Fixed in version 1.56
Just installed Emacs-23-CvsP080325-EmacsW32-1.56.exe (initially over a version 1.54 install, then uninstalled that and reinstalled in a different directory). After launching emacs and doing “Customize EmacsW32” I see everything as usual up to:
Add quick printing to File menu (htmlize-view-print-visible
without a closing parenthesis and nothing more. *Messages* buffer shows “format: Symbol’s value as variable is void: htmlize-view-print-visible”. --AlexeyRomanov
Hi Alexey, that is clearly a bug. Htmlize is no longer in the distribution. It has been replaced by htmlfontify. Fixed in 1.58
Hello, I just upgraded to the latest version of EmacsW32, GNU Emacs 126.96.36.199 (i386-mingw-nt5.1.2600) of 2008-06-12 on LENNART-69DE564 (patched), and now emacs is running extremely slowly. Is this a common issue? Thank you.
Yes. Emacs 23 is unstable and has not yet been optimized. It is very slow on some platforms. – DrewAdams
I’d been using 2008-06-12 on LENNART-69DE564 (patched) version of emacsW32 for a while, but changed back to 188.8.131.52 (installed it using ntemacs binary which i got from http://ntemacs.sourceforge.net) and that I now can play emacs as fast as usual. I tried to find old releases at EmacsW32 site but failed. Is there any place where I can download old releases of EmacsW32 patched version? – JoonhwanLee
The slowness is because of the new font backend. So it is just the screen update that is slow. I think it is good if people test this new font backend and report any problem. That will help to fix problems. (However the slowness is well known.)
I have also compiled with no optimizations at the moment. I can remove that and see if it helps a little bit.
If this is unbearable then I can fetch an old binary and place that on the download page. The problem with that is that the old Emacs instead will be more buggy.
The screen update is now much faster.
Greetings! The cursor in my compilation buffer no longer follows the build output (stubbornly stays at the top of the buffer) since I upgraded to GNU Emacs 184.108.40.206 (i386-mingw-nt5.1.2600) of 2008-06-12 on LENNART-69DE564 (patched). Has anyone else experienced this or can recommend a fix? Thanks! – AllanErskine?
I am not quite sure, but I believe this has been resolved in the latest CVS sources. Please try the latest installation package.
Thanks! The latest installation package fixes this problem (get it here folks: http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl) – AllanErskine?
Emacs 23 had a redisplay problem which would make scrolling very slow. Today I downloaded this version
“GNU Emacs 220.127.116.11 (i386-mingw-nt5.1.2600) of 2008-08-13 on LENNART-69DE564 (patched)”
and scrolling feels just like the 22. I’m moving to 23 again. Did you do something related to this, Lennart? Thanks anyway :)
Menu item File->visit new file should be able to create a new file, right? Because as it is (emacsw32-version 1.58), it balks at visiting non-existent files…
I can’t reproduce this. Can you give a precise recipe and file a bug report with it?
If you try to visit a new file from the File menu command and then select a path and filename, Emacs complains that it cannot find the file.
For a Windows user is very common to use C-z for undo and C-y for redo. Why did you implement only C-z and not C-y? I know, C-y is for paste (yank) but if I enable C-v to paste, C-y becomes useless. Am I right?
However if I go in “Customize EmacsW?32 …”, and then under the Rebind Keys subsection, if I try to activate the key bindings C-o C-f C-s and then Save the options I receive the message: “custom-variable-mark-to-save: Saving rebind-keys: Symbol’s function definition is void: edmacro-parse-keys” and the options are not saved.
Update: I found on this wiki the following comment for a customization. Maybe it can help. “If the above fails with “define-key: Symbol’s function definition is void: edmacro-parse-keys” you need to load the package defining edmacro with: (require ‘edmacro)” But I don’t know how to do this…
I’m using EmacsW32 on several machines and virtually the only problem I have with it is that it uses emacsclient instead of launching multiple instances of Emacs. Despite efficiency considerations, I prefer the latter, and would like to do that with EmacsW?32 as well.
That was a surprising request. How do you want to launch Emacs? (From what shortcuts etc?)
I just realised that it’s all a bit easier than I thought. I thought there were a few batch scripts involved, but the Shortcut (the only one installed for EmacsW32) simply launches $EMACSW32DIR/emacs/bin/emacsclientw.exe.
So everything I want is basically a shortcut to $EMACSW32DIR/emacs/bin/runemacs.exe and the respective “Send To” entries etc. I can probably set up the shortcut myself, but I’d like the other stuff too - would it be possible to add that to the installer?
Yes, you can change them yourself after installing EmacsW32. What is the reason for using Emacs this way? Is it perhaps a misunderstanding? Do you know it is quite easy to start a new Emacs instance from within EmacsW32 by doing “M-x emacs”?
“M-x emacs” is neat, thank you. The reason I don’t want to use EmacsClient is because it doesn’t fit my workflow. I’ve tried it, and I just couldn’t get used to it. Emacs is not my operating system or anything, it’s just my editor and I fire it up when needed and close it afterwards, as I do with all other programs. Therefore the added overhead of starting the server each time (especially with the “server starting” window in EmacsW?32) is undesired.
Would it be a problem to include an additional Emacs (without Client) shortcut etc. in the distribution, or have a choice during the installation? (if you point me to the wizard’s configuration file, I could try and create a patch for that) Setting up the shortcut is not really a problem, but the “Send To” link etc. might be.
The overhead when starting EmacsClient is very small. It is the same startup process as usual for Emacs with just the addition of starting the server too. I doubt that you can measure the overhead of the server starting window.
So the only thing I can see that can be problematic is that you have some kind of trouble starting emacs server. That could be a bug in Emacs. Could you please test if this takes long time for you? (Just start Emacs and then do “M-x server-mode” and see if that takes long time.)
Invoking “server-mode” happens in the fraction of a second. Maybe I just had the illusion that it takes longer because of the extra window (can I get rid of that? It not shown in vanilla Emacs). I’ll give up and use EmacsClient :)
No, you can’t get rid of this window. It is shown while Emacs is starting so you know what is happening. (Vanilla Emacs can’t be started through emacsclient.)
OK, hope this works fine for you. Using emacsclient is actually much faster than starting a new Emacs. The only thing to consider is that you close a buffer instead of the whole of Emacs. You can have emacsclient opening a new window (Emacs frame) if you want that. And I think there are solutions here on Emacs Wiki that lets you close the buffer with the frame.
Downloaded Emacs-23-CvsP080325-EmacsW32-1.56.exe on 25 Mar 2008 and found that (should be!) transient window “Waiting for Emacs server to start” is actually failing with message “ ERROR Timeout waiting for server”. Is it related to the fact that gnuserv.el is missing in packaging? – ThierryDaucourt?
Could you please try running emacs/bin/usethis.exe? If that does not help then check the shortcut you start Emacs from.
Trying to launch usethis.exe and then the shortcut to emacsclient -n, it is actually worse, as the GUI appears but blank windows that is frozen. I am forced to kill process via Task Manager – ThierryDaucourt?
Do you really mean the shortcut to emacsclient -n, not emacsclientw -n? This should just work without problem and I am a bit surprised that it does not work for you.
It might be that there are some old shortcuts left. The new EmacsClient for CVS Emacs 23 works a bit different from the old Emacs 22 one. Can you examine what the short cut runs?
While trying to get this to work could you please rename your .emacs so it does not get in the way.
Definitely, usethis.exe makes things worse as emacs is frozen
I wonder if there is something wrong with the “server” file. Could you please try moving that file out of the way?
I suppose you meant emacs\lisp\server.el and .elc files, that I moved away. Again, the emacs is frozen, I close the “server fail”, then kill cmdproxy.exe, and I have my emacs un-frozen. For me this is more related to cmdproxy.exe isn’t it ? Any way to debug that latter ? Because I just tested to launch “emacs.exe” and “emacs.exe --debug-init”, and those two command runs correctly as I can see in TaskManager? that no cmdproxy.exe is run. – ThierryDaucourt?
Hi I am having the same problem. I installed emacs 23 without EmacsW32 and it has the same problem also. I launched it with runemacs.exe. It gave me this error: The directory ~/.emacs.d/server is unsafe. – Juan Fonseca
Thierry, sorry for being unclear. I meand the file that you got the server-ensure-safe-dir message about.
Juan, do you mean that you have installed the unpatched version? If you use the unpatched version you must start Emacs first. EmacsClient can not start Emacs when you are using the unpatched version. But anyway, you got the same error as Thierry. Could you also try remove the file I told about above?
Maybe I should say I have not seen this problem myself.
server-ensure-safe-dir: The directory c:/Documents and Settings/user/Application Data/.emacs.d/server is unsafe
I still believe that cmdproxy.exe is guilty. How to debug it, and understand what it is blocked on?
Thanks Thierry. The only thing I can think of right now is this:
If this does not help then try emacs.exe -Q
Also tried emacs -q (or emacs -Q) in step 2, and did not get step 3,4,5, but still get the unsafe message.
Thanks. That emacs did not freeze when you used emacs -Q is a big step forward. Now we know that there is something in you emacs initialization files that causes the problem. Could you try to find out what?
I believe the unsafe message might be unrelated, but I am not sure.
Hi, going back to the waiting for server to start. I downloaded the unpatched emacs 23 zipped file and installed it. I have (server-start) in my .emacs files. When I lunch emacs with runemacs.exe, emacs.exe or emacsclient.exe I get the server error (described above). If I remove (server-start) from .emacs, the problem goes away when I run runemacs.exe or emacs.exe. This is the same problem that I see with emacs + emacsW32. I think that the problem is in emacs 23 server-start not emacsW32. Or maybe there is a problem in my system setup. Juan Fonseca.
“emacs -q” means no loading of ~/.emacs and default.el. As I have no ~/.emacs, the issue comes from default.el. default.el loads emacsw32. emacsw32.el loads a lot of things, and I have no idea which one to not load.
As I suspect cmdproxy to be the guilty, I did a find|grep that tells me that w32shell is the only one to use cmdproxy, this in function w32shell-set-shell. In the documentation of this function, SHELLNAME env variable may be understood to be set. I set it to cygwin. Running the shortcut “emacsclientw -n” still lead to an frozen emacs window that killing cmdproxy.exe makes it unfrozen.
Instead, I set SHELLNAME env variable to cmd. Same result.
Re-reading the documentation in w32shell, I will set SHELL instead of SHELLNAME. So I set SHELL env variable to cygwin.
First progress : emacs window is not frozen, I have still the “Waiting for Emacs server to start” that fails with “ERROR Timeout waiting for the server” and inside emacs I have Messages buffer with some errors :
An error has occurred while loading `~/.emacs’:
File error: Searching for program, no such file or directory, cygwin
To ensure normal operation, you should investigate and remove the cause of the error in your initialization file. Start Emacs with the
‘--debug-init’ option to view a complete error backtrace.
For information about GNU Emacs and the GNU system, type C-h C-a. server-ensure-safe-dir: The directory c:/Documents and Settings/user/Application Data/.emacs.d/server is unsafe
First remark, strange that not finding the ~/.emacs should cause an error in emacs ! I can also see that cygwin installation was not found while existing on my PC, but yes, not in the standard c:\Cygwin directory.
Anyway, I set now SHELL env variable to ‘cmd’ to see if this is different than setting it to ‘cygwin’. Now, the emacs window is not frozen, but emacsclientw.exe windows has still “Waiting for Emacs server to start” failing with “ERROR Timeout waiting for server”. Inside Emacs window, in Messages buffer, I have the “server-ensure-safe-dir: The directory c:/Documents and Settings/user/Application Data/.emacs.d/server is unsafe”, but more noticeable, is the output of Shell Configuration buffer
Warning! The SHELL environment variable uses cmd. You probably want to change it so that it uses cmdproxy.exe instead.
Warning! shell-file-name uses cmd. You probably want to change it so that it uses cmdproxy.exe instead.
Warning! shell-command-switch is “-c”. You should set this to “/c” when using a system shell.
Warning! w32-quote-process-args is t. You should set this to nil when using a system shell.
What I understand, is that by setting SHELL env variable to ‘cmd’, then ‘cmdproxy’ is not used. As I suspected it, not using cmdproxy make the things progress by not frozing. I still have Warnings above.
Again, cmdproxy.exe, by not using it, or by killing it, it looks better. How to debug that latter?
Hi again Thierry, thanks for trying to investigate this. I would be surprised if cmdproxy or cmd was involved here, but I am not sure. w32shell is a way to try to make it more easy to use different shells within Emacs. When you are using that you should not have to bother with the environment variable SHELL.
However this has nothing to do with starting Emacs. I am getting a bit lost here. I think we need to coordinate. Can you please help me by answering some questions?
Tentative 1 : no EmacsW32
Tentative 2 : no EmacsClient integration
Tentative 3 : no EmacsW32, no EmacsClient integration
My conclusions so far:
So I began to dig about the unsafe thing. The unsafe message is in function server-ensure-safe-dir of server.el file. Here is function:
(defun server-ensure-safe-dir (dir) "Make sure DIR is a directory with no race-condition issues. Creates the directory if necessary and makes sure: - there's no symlink involved - it's owned by us - it's not readable/writable by anybody else." (setq dir (directory-file-name dir)) (message "dir %s" dir) (let ((attrs (file-attributes dir))) (message "attrs %s" attrs) (unless attrs (letf (((default-file-modes) ?\700)) (make-directory dir t)) (setq attrs (file-attributes dir)) (message "attrs %s" attrs) ) ;; Check that it's safe for use. (message "nth 2 attrs %s" (nth 2 attrs)) (message "user id %s" (user-uid)) (message "system type %s" system-type) (message "file modes dir %s" (file-modes dir)) (unless (and (eq t (car attrs)) (eql (nth 2 attrs) (user-uid)) (or (eq system-type 'windows-nt) (zerop (logand ?\077 (file-modes dir))))) (error "The directory %s is unsafe" dir))))
All the non indented lines with message are from my own, to enable the debug after byte-compiling the file. Here is what I found:
I deleted .emacs.d/server directory, then run emacs.exe, and inside launched M-x server-mode. In Messages buffer I got the following extract:
attrs (t 1 -14706 513 (18414 17797) (18414 17797) (18414 17797) 0 drwxrwxrwx nil 34842 (7173 . 33003)) nth 2 attrs **-14706** user id **50830**
But from the command line:
$ ls -ld server/ drwxr-xr-x+ 2 my_user mkgroup-l-d 0 Mar 29 14:35 server/ $ id uid=**60830**(my_user) gid=10545(mkgroup-l-d) groups=0(root),544(Administrators),545(Users),10545(mkgroup-l-d)
I have added bold chars where is the mess: inside emacs my uid is 50830, but on command line, my uid is 60830. And emacs reading attributes of the server idrectory find that uid is -14706.
PS: I made my investigation above off-line, and pasting here, without having seen your last answer. I will investigate it later when time available. Thanks.
Hi again Thierry. I think there are some small misunderstandings. EmacsW32 is not that involved as you might think. Here are some important points:
But there is something interesting happening in server-ensure-safe-dir. It looks there like you are not the owner of the directory. Can you check this in Windows Explorer? What version of MS Windows are you running? Have you set the HOME environmental variable in Windows?
— I apologize for any misunderstanding. I make it very hard to only write fact, and to avoid any opinion/sentiment/judgment. I just want emacs to run on my PC, running Windows XP SP2 with last Emacs-23-CvsP080325-EmacsW32-1.56.exe, patched version.
My investigation about server-mode:
attrs (t 1 -14706 513 (18414 17797) (18414 17797) (18414 17797) 0 drwxrwxrwx nil 34842 (7173 . 33003)) nth 2 attrs **-14706** user id **50830**
Emacs when creating that directory makes me as the proprietary of the file. I can check that through Windows Explorer, but also via cygwin:
$ ls -ld server/ drwxr-xr-x+ 2 my_user mkgroup-l-d 0 Mar 29 14:35 server/ $ id uid=**60830**(my_user) gid=10545(mkgroup-l-d) groups=0(root),544(Administrators),545(Users),10545(mkgroup-l-d)
So ~/.emacs.d/server, belongs to me, and my id is 60830 from cygwin command line. But emacs, says that ~/.emacs.d/server is belonging to -14706 and also report that my id 50830.
That where I have not so much idea:
I think we are getting closer to a solution now, Thierry, because of your last report. It looks to me like there is a bug somewhere, but I am not sure where. I have sent a bug report to Emacs pretest for CVS Emacs 23.
Just to be sure some more questions:
We are discussing the bug with the id above on email@example.com and it would be good if you could join the discussion there.
As said, I did my test with on my PC, running Windows XP SP2 with last Emacs-23-CvsP080325-EmacsW32-1.56.exe, patched version. I redo the same test, with unpatched version Emacs-23-CvsU080325-EmacsW32-1.56.exe. I have the exact same results and outputs.
About checking user id through Windows Explorer, I do not know how to do it. I am only able to check that proprietary of file is “my_user” in full text, but I am not able to print any user id that is a number.
I could join the firstname.lastname@example.org, but I do not know how to… Yes that’s stupid, but I googled that email address, and I am unable to find the subscribe page of this mailing list.
Reading an archive of this mailing list, I can give some more information. Maybe my user id of 50830 is coming from the fact that my company has more than 100,000 employees, and that I try to run emacs on my work pc. And yes my id is belonging to a domain, so that’s perhaps why the 10000 is added. – ThierryDaucourt?
emacs-pretest was redirected to
emacs-devel, and it looks like someone got rid of the ability to subscribe to
emacs-pretest (not good, IMO). You can subscribe to
email@example.com, however. – DrewAdams
Thierry, yes, please follow Drew’s advice. The subject of the thread is “23.0.60; uid problems on w32”.
And your guess about the domain seems correct.
Hello – I am having the same issues as Thierry, with the culprit seemingly cmdproxy. I, too, have tried both patched and unpatched versions of Emacs-23-CvsP080325-EmacsW32-1.56.exe. I’m also having problems displaying the font face of customization buffers. Will do some more tinkering, as well as clean installs. Also found a correction of the server problem by calling M-x Server-start after killing cmdproxy, and thus the editing server capabilities are usable. -John
John, I have just uploaded a new unpatched version (and also a patched version). Could you please try the new binaries?
I downloaded and installed
Emacs-23-CvsP080819-EmacsW32-1.58.exe today (2008-08-19) and
cmdproxy.exe did not hang (executable is 30380 bytes, Properties page shows no file version information). Past revisions of
cmdproxy.exe would hang every time. Thanks for the fix :-)! OS is Microsoft Windows Vista SP1 32-bit. I still get the error message from server.el (”
server-ensure-safe-dir: The directory c:/Users/xxxxxxx/AppData/Roaming/.emacs.d/server is unsafe”). In my case, no domain server is involved. Will update if I find a resolution to the server-ensure-safe-dir problem and thank you for the update to
Update: In an attempt to further debug the
server-ensure-safe-dir error message I edited
%ProgramFiles%\Emacs\emacs\lisp\server.el to add the
(message ...) statements above from Thierry and then deleted
server.elc. Upon restarting Emacs, the
server-ensure-safe-dir error message did not appear! I tried undoing the changes to get the message back by first removing the
(message ...) statements; still no error message. I then byte-compiled the original
server.el file and the message still does not appear. A
dired listing shows changed file ownership:
... -rw-rw-rw- 1 mark None 52841 08-19 12:46 server.el -rw-rw-rw- 1 mark None 53048 08-19 12:45 server.el-messages -rw-rw-rw- 1 Administrators None 52841 08-19 12:44 server.el-orig -rw-rw-rw- 1 mark None 38215 08-19 12:48 server.elc -rw-rw-rw- 1 Administrators None 52841 2008-08-19 server.el~ -rw-rw-rw- 1 Administrators None 117691 2008-08-19 ses.el -rw-rw-rw- 1 Administrators None 90355 2008-08-19 ses.elc ...
server.elc is now strangely only visible using
dired in Emacs - it’s not visible from a
cmd.exe command line nor in Windows Explorer!
Thanks mark (I guess you are “mark” in the listing above?).
I looked at the code in
‘server-ensure-safe-dir’ and it looks to me like the test that gives the error is probably
(eql (nth 2 attrs) (user-uid))
but I do not understand why. Could you please show what dired shows for the file mentioned in the server-ensure-safe-dir message?
Could you also find out what
gives + what calling (user-uid) in server-ensure-safe-dir gives?
Is it possible for you to change owner for server.elc to Administrator? What happens if you do that?
Yes, I am the Mark in the file listing.
dired for the dir shown in the
server-ensure-safe-dir now shows (going down the path elements):
drwxrwxrwx 1 mark None 0 08-19 12:46 Roaming drwxrwxrwx 1 mark None 0 08-19 12:56 .emacs.d drwxrwxrwx 1 mark None 0 08-19 20:31 server -rw-rw-rw- 1 mark None 85 08-19 20:31 server
Unfortunately, I did not look at these values before I unintentionally fixed the problem.
Eval: (user-uid) returns
1002 (#o1752, #x3ea) from an interactive emacs session and similarly adding
(message ...) calls to
nth 2 attrs 1002 and
user id 1002.
I don’t know how to change the owner of
server.elc back to
Administrators because the emacs byte-compiler manages to create a file that the rest of the OS cannot “see”.
Mark, there is currently a discussion on Emacs devel that I think is about a problem similar to this. Maybe you want to join a while and give some information? The subject of the thread is “File Owner and Group ID on Windows”.
I’ll take a look at the emacs-devel thread. Here is some more information that I’ve found as well. To recreate the
server-ensure-safe-dir error, I’ve uninstalled and re-installed Emacs+EmacsW32 several more times. In my experiments, the problem only occurs if a) the installer is “Run as Administrator” and b) the installer is allowed to start Emacs directly (e.g. leave the checkbox enabled on the last screen to “Start Emacs with EmacsW32 Options Page”).
Install with Privs of: Installer Starts Emacs? Error? Administrators Yes Yes Administrators No No mark Yes No mark No No
C:\Program Files\ requires admin privileges in Vista and so the two conditions will be seen by many people. When the Installer does have Administrator privileges and is allowed to start Emacs, the started Emacs process runs with Administrator privileges too (in the first, special Emacs
Eval: (user-uid) returns the Administrator’s user-uid
1001 instead of the user-uid 1002 for the mark account).
dired shows Emacs creates an
C:\Users\mark\AppData\Roaming\.emacs.d\ directory owned by
Adminstrators (user-uid 1001) instead of by
mark (user-uid 1002). In the other three, non-error cases, Emacs runs with a user-uid matching the user and
.emacs.d gets created with ownership set to the user’s own user-uid.
One possible solution might be to modify the installer to launch Emacs with just the user’s privileges, instead of Administrator privileges, even if the installer is run as Admin. The quick workaround I’m using now on Vista is to uncheck the “Start Emacs with EmacsW32 Options Page” at the end of the install.
There are a couple of other Installer modifications that would be nice too. The installer returns the error message “Setup was unable to create the directory “
C:\Program Files\Emacs”. Error 5: Access is denied.” if it is not “Run as Administrator” under Vista. Can the Installer catch that Error 5 and request a privileges escalation when it tries to write to
C:\Program Files\ on Vista?
Second, one of the installer screens (third one) has static text with an outdated version number: “This setup program will install the Emacs developers CVS version *18.104.22.168* of Emacs. Please notice that this is not an official GNU release of Emacs!”.
I am just uploading a new installer to http://ourcomments.org/Emacs/DL/EmacsW32/test/. Can you please test that version?
I downloaded and did some quick tests this morning; will do more tonite. Installing with Admin privs and letting the installer start EmacsClient still gets the
server-ensure-safe-dir error message. Exiting Emacs and then starting it again works properly EmacsClient; only the initial start from the Installer hits the error message.
2010-01-25: I just installed EmacsW32 on a new Win7 system and ran into this problem. I ran the installer as Admin and took all default settings. (The option to create additional file associations fails on Win7 in any case.) Thanks to this discussion thread, I was able to fix the problem by fixing the ownership of /Users/xxxxx/AppData and its contents. – DanMuller
Thanks, I had nearly forgotten about this. I do not use Win7 myself. I do not know how to solve the problem with the privileges. The only solution I currently can see is to disable starting Emacs from the installer. Can anyone else see a better solution?
The problem is the ownership of the directory ~/.emacs.d/server when you also have “Administrators” rights on your account. Create the directory ~/.emacs.d/server and set the owner of this directory to your login name and the problem is gone. As I have a “Dutch” version of Windows 7 I don’t know the English terms exactly but here’s the procedure:
Click R-mouse on ~/.emacs.d/server and select “Properties” (last item in menu). From Properties select the Tab “Security” and then select the button “Advanced”. Then select the Tab “Owner” and change the owner from “Administrators (<your-pc-name>\Administrators)” into “<your-login-name> (<your-pc-name>\<your-login-name>”. Check the “Replace owner on subcontainers and objects” to ensure that subdirectories also have their ownership changed. Now the server code will accept this directory as secure because you are the owner.
Hope this helps for all you guys, it solved the problem for me anyway.
Previous versions of Windows created a taskbar button for each running program. Windows 7 lets you “pin” a running program to the taskbar, turning its button into a shortcut to start the program. When you start a program using a shortcut pinned to the taskbar, the shortcut’s appearance changes while the program is running, but no new taskbar button is displayed. If you start a program that is not pinned to the taskbar, a new taskbar button is created.
This doesn’t work with Emacs, however. To eliminate the console window, Emacs must be started with runemacs. However, if we pin runemacs.exe to the taskbar and use it to start Emacs, Windows recognizes that these are two different programs and, instead of highlighting the pinned icon, creates a new button for emacs.exe.
There is a trick that will fix it though. Run Emacs and pin it to the taskbar. Then right-click its taskbar button, right click emacs, click Properties and change, e.g., “C:\Program Files\Emacs\bin\emacs.exe” to “C:\Program Files\Emacs\bin\runemacs.exe”. Can anyone explain why this work?. --DenisHowe
Another “fix” would be to create a non-console version of emacs.exe.
I’m compiling a custom version for myself right now, but this is going to become a general issue for Windows emacs users soon. It would make sense to me to (1) stop supporting console emacs at all in EmacsW32, (2) provide two versions (e.g. emacs and emacsw?), or (3) patch emacs.exe to accept an option to allocate a console (or detect, if possible, if the parent is a console).
Thanks mkleehammer. I wonder if the situation is not even more complicated. With EmacsW32 you often start Emacs by running emacsclient.exe/emacsclientw.exe. So it is indeed two different programs.
Maybe you want to report the problem as a bug so this issue will not be forgotten? Then please send a message to firstname.lastname@example.org
Actually I think emacsclient won’t be a problem – the only issue is you need the main EXE to be able to be used to start the program. If you pin emacs.exe to the taskbar and use emacsclient to start the first instance, the taskbar would recognize the emacs.exe has been started and would highlight the pinned version appropriately.
I’d be happy to issue a bug report, but I’m not sure where to do so. Where is the appropriate bug tracker for this?
Just use the bug mail address for this report. You will get information back about the bug tracker. (Normally you should use the command in the menus to send bug reports, but in this case it is not needed since no information from your Emacs should be collected.)
There is another way. I submitted this to emacs-devel, but got no response, which I take to mean they’re not interested.
The fix is for all executables that want to stack their icons to set an Application Identifier, as documented at http://msdn.microsoft.com/en-us/library/dd378459.aspx. Just have runemacs.exe, emacsclientw.exe, and emacs.exe all call SetCurrentProcessExplicitAppUserModelID with “GNU.Emacs” during their startup. I’d be happy to write the code myself, but I’m not sure how to contribute a patch-patch.
I think the interest is there, it is just that few people are looking especially in w32 internal things. So if you can contribute it as patch that saves time for them. See http://ourcomments.org/Emacs/w32-build-emacs.html#patching for how to make a patch.
Please send the patch to Emacs devel as a bug report. Then it will not be forgotten that easily.
It turns out this is emacs bug #1849 . I updated that bug with the same information, and it appears it’ll be tested after the 23.1 branch is made.
Jason fixed this bug today. He happened to do that between my uploads of the patched and the unpatched version of EmacsW32. The bug should be fixed in the unpatched version.
Can someone more familiar with the release procedure confirm whether this is in 23.1 or not? A comment above seems to indicate it isn’t and I can’t make 23.1 stack icons, but I’d be surprised if something this important didn’t make it. Also, since emacsclientw gives me an error if I don’t have a file for it to edit, I can’t really pin it on the taskbar can I? Shouldn’t we also have the same fix in runemacs.exe?
It is not in the released 23.1. It will be in the next release.
At least for now, you have to set the application identifier in your shortcut yourself.
You can use the tool at http://code.google.com/p/win7appid/
Set the AppID? for your shortcut to runemacs.exe to be GNU.Emacs and it works for me on GNU Emacs 23.3.1 (i386-mingw-nt6.1.7601).
Hi, I think I found a bug in w32shell.el, in EmacsW32 version: “GNU Emacs 22.214.171.124 (i386-mingw-nt6.0.6002) of 2009-11-04 on LENNART-69DE564 (patched)”.
Symptoms: calling w32shell-remove-emacs result in an error (list expected).
Possible fix: this patch fixes the error for me, in the function “w32shell-remove-envpath”, at line 95
(defun w32shell-remove-envpath (path) (let ((paths path)) (unless (listp paths) (setq paths (list paths))) - (dolist (path path) + (dolist (path paths) (let ((envpath (replace-regexp-in-string "\\\\" "/" (getenv "PATH"))) (pos (w32shell-in-envpath path))) (while pos
Cheers! – SebastienRoccaSerra
Thanks Sebastien, applied to my sources.
I think there are several important things that just do not make it into the w32 version. There are just too few hands there I think. Contributors are welcome!
Do you plan to upload a new patched binary some time soon? If not, would it be better to try building from https://code.launchpad.net/~lennart-borgman/emacsw32-emacs/trunk or to apply patches to Emacs 23.3 sources?
Hi Alexey, I plan to upload new versions, but unfortunately the merging takes me quite a lot of time. There is a lot of things I want to go into Emacs, but I have no time to send the patches currently.
The code at launchpad is mostly what is currently used in the latest beta of EmacsW32+Emacs so you may want to try the latest beta.
Where can I find the beta version? It isn’t mentioned anywhere else on this page, or at http://ourcomments.org/Emacs/EmacsW32.html. Unless you mean “latest EmacsW?32+Emacs patched”, but it isn’t referred to as beta on that page either.
I just added info about where to download beta version.
I’m having some trouble setting the initial frame dimensions from my .emacs. If the “Emacs.geometry” registry key is present, this appears to override any calls to set-frame-size in the evaluation of .emacs. Worse, if that registry key is not present, the frame will briefly pop to the right size, but then snap back to the default 80x43 frame. (Note that I have set default-frame-alist and initial-frame-alist as well.)
I’ve tried attaching the set-frame-size to the ‘after-init-hook, but this runs too early as well, it appears. I have a sneaking suspicion I’m missing something obvious, but any help would be appreciated!
I do not think this has anything to do with EmacsW32. Could you please try an unpatched Emacs and send an Emacs bug report if you find the problem there. Otherwise come back here. (The best would be if you tried the weekly builds, see CategoryWThirtyTwo
Whoops, quite right. The problem goes away in the 24.0 series of binaries. I found the test versions of EmacsW?32 with this version, problem solved. Thanks!