I recently found out there’s an Emacs command M-x woman
that’s a pun on “w/o man
”, i.e. a way to read online help without using the usual man
command.
* * *
I tried to edit a 1.2 GB text file with Emacs the other day. I got an error saying that Emacs has a 500 MB file size limit on 32-bit systems. This was on a 32-bit Windows XP machine, so the warning was reasonable. I appreciated that it promptly said it could not open the file.
I tried again on my 64-bit Windows 7 machine and got the same message; I believe I’m running a 32-bit version of Emacs on my 64-bit PC.
I also tried opening the file with Emacs on a 64-bit Red Hat Enterprise Linux box with 16 GB of memory. This time I did not get a file size message. Instead, Emacs crashed.
The file opened quickly on Windows, even my 32-bit XP box, using Notepad++.
* * *
When I set up Emacs on Windows, I created an “Open with Emacs” context menu following the instructions here. That has worked well except for two problems.
- Every file is opened in a new instance of Emacs.
- It stopped working on one of my computers for reasons unknown.
I’ve been meaning to solve the first problem, and when the second happened I decided it was time. According to the Emacs documentation,
The recommended way to associate files is to associate them with
emacsclientw.exe
. In order for this to work when Emacs is not yet started, you will also need to set the environment variableALTERNATE_EDITOR
torunemacs.exe
. To open files in a running instance of Emacs, you will need to add the following to your init file:(server-start)
I had to tinker with that a little to make it work. I know I had to add the path to my Emacs bin
directory to my PATH
environment variable but I don’t remember what else I did.
The key thing to note is that you should associate files with emacsclientw.exe
rather than with runemacs.exe
. I used the instructions in this article to remove the association with the latter. Thanks to Mark for pointing out the article.
(The Windows “Open with” feature remains a mystery. The article above explains how to remove a program from the “Open with” list, and the directions worked for removing runemacs.exe
. But they did not work for removing other programs. I’m also unclear how you add something to the “Open with” list. If you right-click on a file and select “Open with -> Choose program …” the program you select may appear in the “Open with” list next time. Or not. This did add emacsclientw.exe
to the list.)
Related post:
Vignette #2 is embarrassing. I’ve also seen Emacs crash on loading a large file. It hasn’t been consistent, however.