# EmacsW32

EmacsW32 is no longer available, see CategoryWThirtyTwo for alternatives.

Tip for editing here: ms windows file names and the name EmacsW32 upsets this wiki software. Put %%...%% around those things.

Hi - I can’t download any of the files at http://ourcomments.org/cgi-bin/emacsw32-dl-latest.pl It says: “403 Forbidden You don’t have permission to access ___ on this server”. Does anyone have a way of contacting the webmaster of that page?

## Latest Important News About EmacsW32

“Beta” versions are availabe here: http://ourcomments.org/Emacs/DL/EmacsW32/test/.

### 2006-12-15 Nxhtml/Nxml Modes Included

NxhtmlMode (and previously also NxmlMode, but this is now in Emacs itself) are distributed together with EmacsW32 from EmacsW32 version 1.18.

### 2006-11-30 Unix Programs Included

From EmacsW32 version 1.14 it includes the unix programs most commonly used by Emacs.

## EmacsW32 - Enhancements for Emacs W32 Users

From the documentation for EmacsW32:

EmacsW32 tries to make it easier for an MS Windows user to get used to Emacs. It consists of two parts:
• EmacsW32 is a collection of Emacs lisp modules and MS Windows programs. It can make the keyboard and other things in Emacs function more like they do usually in MS Windows programs.
• EmacsW32 Install Wizard is what you use to install and setup EmacsW32 on MS Windows. They can also be used to install Emacs itself. Note that you can even easily build your own installation program.

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 unpatched 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.

## Background: The Whys

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.

## Some Other Sites that Use or Recommend EmacsW32

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:

Please enter enter your suggestions and comments on the setup utilities below. However if you find an Emacs or XEmacs bug then report this to the Emacs developers. Please see EmacsBugs or XEmacsBugs

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 Customize EmacsW32 startup screen

The screen you get with EmacsW32 options when you start EmacsW32 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…)

### How can &lt;language-change&gt; be bound to (toggle-input-method)?

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 "&lt;language-change&gt;") '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 "&lt class="comment">;language-change&gt;") '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.

### Patched Emacs 22.2 + EmacsW32

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+EmacsW32 binary from today. It looks very good to me.

### A different CONTROL Key

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?

### Directory problem

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.

### Sharing .emacs file

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 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-set-shell "msys")
(require 'cmd-mode)
(require 'w32-print))

The (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.

## Resolved and Included

### How to see if Emacs+EmacsW32 is patched?

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)

### starting external programs with start-process in patched Emacs

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

### patched emacs crashes with -nw option

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.

### Support for -e and ediff from CMD.EXE

Added better support for -e and ediff in version 1.03 of EmacsW32. See http://ourcomments.org/Emacs/EmacsW32.html for more details.

### Minor *.cmd bugs

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:

• elc.bat is a for loop that iterates over %1; from context, I believe the intent is to iterate over %*

Thanks, fixed.

• as written, the e.cmd support for turning backslashes into slashes has no effect because while the characters are changed in %args%, the actual final emacsclient invocation still uses %*

True. Fixed.

• as written, e.cmd launches emacsclient and doesn’t wait; this is good and feels appropriate for a command line tool that launches a GUI app. But, there are times when a version that waits is appropriate. For example, when wanting to set e.cmd as your EDITOR. Personally, I’ve created a copy of e.cmd – emacsw.cmd – that doesn’t pass the -n option to emacsclient. But, with the fix for the preceding item, it becomes quite reasonable to consider having e.cmd recognize an additional option (-w?) to wait?

Unfortunately it still seems hard to fix this easily. The “shift” command does not change %*.

• e.cmd starts with a comment claiming it’s named emacs.cmd, and suggests renaming it to e.cmd. Perhaps at one time it was named emacs.cmd?

It no longer starts with that comment ;-)

thanks, stephan();

Thanks for the feedback. Fixes will be in EmacsW32 1.39.

### Missing Elisp manual?

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?

### Emacs binaries as a zip file

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.

### Black & white graphics

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.

### Want Emacs C sources

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

    find-function-C-source-directory

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.)

### frame-title-format issue

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.

### Old .emacs files

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.0.50.1 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"

#### Resolved in CVS Emacs

This problem has been solved in CVS Emacs from 2006-05-20. – LennartBorgman

### EmacsClient ERROR

“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.

Thanks.

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).

#### Resolution Confirmed

I’ve got the newest Emacs+EmacsW32 with EmacsClient and everything works great. Thanks. --StewartBryson

### Emacs 23 Builds

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.

### Emacs 22 builds

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

### Missing rebind.el

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.elJamesKingston

Fixed in version 1.56

### htmlize-view-print-visible

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

### CVS Emacs 23 is still slow on screen updates

Hello, I just upgraded to the latest version of EmacsW32, GNU Emacs 23.0.60.1 (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 22.1.50.1 (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.

### Cursor stays on top in compilation buffers

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 23.0.60.1 (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

### Slow redisplay

Emacs 23 had a redisplay problem which would make scrolling very slow. Today I downloaded this version

“GNU Emacs 23.0.60.1 (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 😊

– hsuh

No, I did not do anything. JasonRumney and others did the work, I just waited (having quite a bit to do with nXhtml and not enough knowledge at all about the display code to help with it). 😊

## Unconfirmed or waiting for feedback

### Visit new file problem

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.

### C-y as redo

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?

### Emacs specific options cannot be saved

If I go in Options/Customize EmacsW32/Set all to EmacsW32 style! and then I click on Save button to save the new settings everything seems ok.

However if I go in “Customize EmacsW32 …”, 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.

Thanks.

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…

### Using EmacsW32 without emacsclient

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 EmacsW32 as well.

1. What is the best way to change this when EmacsW32 is already installed?
2. Would it be possible to include an option in the installer to not use emacsclient at all?

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 EmacsW32) 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.

## Current Problems

### "Waiting for Emacs server to start" fails

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.

• rename .emacs in @.emacs (to not get read)
• uninstall Emacs+EmacsW32 through control panel
• delete Program Files\Emacs
• reboot
• go through installer for full install, all users (no tweaking, only next-next-next) and wait for the 20 seconds
• launch through shortcut (that actually calls for emacsclientw.exe with a ‘w’)
• got message : server-ensure-safe-dir: The directory c:/Documents and Settings/user/Application Data/.emacs.d/server is unsafe
• now, no more freeze of emacs window
• still get the message “Waiting for Emacs server to start” that fails with “ERROR Timeout waiting for server”
• close emacs windows
• launch emacs/bin/usethis.exe
• And… emacs window is frozen (blank, no toolbar, no answer to C-x C-c or click on X upper right. I also have the the message “Waiting for Emacs server to start” that fails with “ERROR Timeout waiting for server”
• I close the window about server not started (that has the effect to kill emacsclientw.exe), but windows is stil frozen
• I kill cmdproxy.exe that is child process of emacs.exe
• And then the emacs window is no more frozen. Well, that unfrozed the things, but this is not usable…

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.

• un-install of Emacs+EmacsW32
• reboot
• delete of DocumentsAndSettings\user\ApplicationData\.emacs.d\server and %HOME%\.emacs.d\auto-save-list
• delete Program Files\Emacs directory
• install of Emacs-23-CvsP080325-EmacsW32-1.56.exe (no tweaking, all default options)
• Launch GNU Emacs through shortcut (actually emacsclientw -n )
• emacs window is frozen, and together there is a window with error message : “Waiting for Emacs server to start ERROR Timeout waiting for server”
• I click on close button of this later dialog. Emacs is still frozen.
• kill of cmdproxy.exe
• Emacs window is unfrozen
• I then have a look in Messages buffer and get :

server-ensure-safe-dir: The directory c:/Documents and Settings/user/Application Data/.emacs.d/server is unsafe

• I am able to check that "C:\Documents and Settings\to26992\Application Data\.emacs.d\server" directory has been created. Also "C:\Home\to26992\.emacs.d\auto-save-list" has been created.

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:

• Delete that server file above again
• Start emacs by just running emacs.exe from the command window
• In emacs do M-x server-mode

If this does not help then try emacs.exe -Q

• Deleted the .emacs.d directories
• Launch emacs.exe from command window
• emacs window is frozen
• kill cmdproxy.exe
• emacs window is unfrozen
• in emacs, done M-x server-mode
• got the message “server-ensure-safe-dir: The directory ~/.emacs.d/server is unsafe”

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.

### "Waiting for Emacs server to start" is ownership problem on ~/.emacs.d/server

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.

W.K.R. Reutefleut

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

#### Other Fixes

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 emacs-pretest-bug@gnu.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 [1]. 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).

MichaelHoffman

### Bug in w32shell.el

Hi, I think I found a bug in w32shell.el, in EmacsW32 version: “GNU Emacs 23.1.50.1 (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!

### Next version

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 EmacsW32+Emacs patched”, but it isn’t referred to as beta on that page either.