ChatGPT解决这个技术问题 Extra ChatGPT

Emacs in Windows

How do you run Emacs in Windows?

What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?


E
ESV

I use EmacsW32, it works great. EDIT: I now use regular GNU Emacs 24, see below.

See its EmacsWiki page for details.

To me, the biggest advantage is that:

it has a version of emacsclient that starts the Emacs server if no server is running (open all your files in the same Emacs window)

it includes several useful packages such as Nxml

it has a Windows installer or you can build it from sources

And concerning XEmacs, according to this post by Steve Yegge:

To summarize, I've argued that XEmacs has a much lower market share, poorer performance, more bugs, much lower stability, and at this point probably fewer features than GNU Emacs. When you add it all up, it's the weaker candidate by a large margin.

EDIT: I now use regular GNU Emacs 24. It also contains Nxml, can be installed or built from sources, and with this wrapper, the Emacs server starts if no server is running. Cheers!


I used EmacsW32 for maybe two years, but now I'm using regular GNU Emacs. It works just as well or better on Windows.
I having problems with running EmacsW32 on Vista, so I can't recommend it: superuser.com/questions/163289/…
@Christian Davén: yes, me too since Emacs 23. And since I found the small wrapper described here emacswiki.org/emacs/EmacsClient#toc2 (to start the server).
It also appears to be defunct - last unpatched update was back in 2009, while last patched update was late 2010.
C
Carl Seleborg

Note that GNU Emacs for Windows comes with two executables to start Emacs: "emacs.exe" and "runemacs.exe". The former keeps a DOS-Prompt window in the background, while the latter does not, so when if you choose that distribution and want to create a shortcut, be sure to launch "runemacs.exe".

Carl


The key difference between the two is that one is built as a GUI application and the other as a command-line app (which happens to start a GUI). Windows, unlike Unix, distinguishes between these two things.
c
cristobalito

Easiest way to find where the user init file is:

C-h v user-init-file

Easiest way to open it is (in the scratch buffer):

(find-file user-init-file)

and hit C-j to eval


M
Mike Stone

Well, I personally really like what I have been using since I started with Emacs, which is GNU Emacs. It looks like it is built for windows too. That link also answers your .emacs file question. Here is a place you can download it. You should probably get version 22.2 (the latest).

If this is your first time, I hope you enjoy it! I know I absolutely love emacs!


B
Brian Carlton

I run it under cygwin. That also gives me a Unix-ish environment for shelling out commands with meta-!


I wonder how similar it is to add Cygwin bin/ to Windows path variables? Getting Emacs' grep to work by using Cygwin find rather than Windows' find prompted me to add Cygwin too front of path variable.
m
mkasberg

I use a vanilla version of emacs. In my experience, this is very stable, simple, does everything I need, and doesn't add a bunch of bloat that I don't need. The .emacs file can be placed in C:\Users\YourName if the HOME environment variable is set. This is a great way to handle it because it works on a user basis and mimics emacs behavior on Linux. You can download the zip from any gnu software repository mirror in the emacs/windows folder. You want the file that is named emacs-xx.x-bin-i686-pc-mingw32.zip.

There are some great instructions for configuring emacs for windows here. Basically, "installation" boils down to:

Download emacs from a gnu mirror at emacs/windows/emacs-version-bin-i686-pc-mingw32.zip, and extract the zip to an appropriate folder. Preferably C:\emacs to avoid spaces in the filename. Set the HOME environment variable to C:\Users\username (or whatever you want). Make it a user-only variable (if it is username-specific). This is where your .emacs file goes. If you want a start menu or desktop shortcut, create a shortcut to bin/runemacs.exe. Add c:\emacs\emacs-xx.x\bin\ to your path (user or system), so that you can run it from the command line.


Since 24.4 (November 2014) the filename convention has been changed to: emacs-<XX>.<X>-bin-i686-pc-mingw32.zip. See "Official" binary of Emacs-24.4 for MS-Windows.
The link to this page here appears to be broken.
I updated the link to point to the wayback machine!
i
imriss

Also, you can consider emacs-w64 for 64bit windows systems:

emacs-w64: http://sourceforge.net/projects/emacsbinw64/


H
Henry

See http://www.gnu.org/software/emacs/windows/ntemacs.html. Section 2.1 describes where to get it, and section 3.5 describes where the .emacs file goes (by default, in your home directory, as specified by the HOME environment variable).


g
gerikson

I've run both GNU emacs and Xemacs on windows. I used to use it as my primary editor, email client etc, but not it's "just" an editor.

When I recently reinstalled to Vista I installed the latest GNU version. It works fine. So does Xemacs, but it does look like GNU have got their sh*t together so Xemacs isn't as compelling anymore.


b
boskom

I suggest you to use development version of GNU Emacs 23, which is pretty stable and to be released relatively soon. You can get weekly binary builds from the link below.

Latest GNU Emacs as a zip archive


Does that version have Git support?
Searching emacs directory I found lisp\vc-git.el Since I do not use git I cannot tell you how good it works, but definitely git support is present in Emacs 23 beta for windows Here is the direct link for download of Emacs 23 beta from gnu.org: alpha.gnu.org/gnu/emacs/pretest/windows
T
Tim Cooper

I have a portable version with .emacs configure ready, which setup org mode, I-do, etc. It also included org sample file. I think that is a better start point for new comers.

Basically run with runemacs.bat and everything is ready.

http://nd.edu/~gsong/portable_emacs.html


D
Darren Embry

I've encountered this problem, and discovered the fault (at least in my case) to be the existence of c:\site-lisp\site-start.el, a file that was created when EmacsW32 was installed, and which was not removed when I uninstalled it. (Vanilla GNU Emacs for Windows has c:\site-lisp in its load-path, and will try to load this file, which somehow winds up triggering that error.)

Solution: removing that whole directory (c:\site-lisp) worked for me, but you should just be able to remove the site-start.el file.


D
Drew

The best place to start, to get an MS Windows binary for GNU Emacs is ... GNU Emacs:

http://www.gnu.org/software/emacs/

(Oh, and how did I find that URL? From the Emacs manual, node Distribution. If you have access to Emacs anywhere, that's the place to go for such information.)

On that page you will see everything you need to know about obtaining Emacs. In particular, you will find a section called Obtaining/Downloading GNU Emacs, which links to a nearby GNU mirror. Clicking that link takes you to a page of links that download all Emacs releases since release 21.

More imporantly here, on that page of links you will also see a directory link named windows. Click that to get a page of links to Emacs binaries (executables) for MS Windows. That is the page you want.

Knowing the above information can help when you need to find the page again, if you haven't bookmarked it. But here is the final URL, directly: http://mirror.anl.gov/pub/gnu/emacs/windows/


A
Adam.at.Epsilon

When forced to use Windows, I ...

Download "Emacs for windows", and save it in some directory (henceforth referred to as EMACS_SOMEWHERE)

Drop a .cmd file in "Startup" to map, "My Documents" to H: drive with subst, or if "My Documents" resides on a remote server, I use the "Map Network Drive" thing in Explorer to have "My Documents" named H:. Then I create an environment variable named HOME in Windows and give it the name of "H:\". Now I can drop my .emacs file in "My Documents" and it will be read by emacs when it launches.

Then I create the H:\bin directory. Then I add "H:\bin" to my Windows "Path" environment variable.

Then I create a H:\bin\emacs.cmd file. It contains one line:

@call drive:\EMACS_SOMEWHERE\emacs-23.2\bin\emacsclientw.exe --alternate-editor=c:\programs\emacs-23.2\bin\runemacs.exe -n -c %*

This is a fair bit of work, but it will enable me to run the one and same emacs from either a windows command prompt or from a cygwin command prompt, provided that /cygdrive/h/bin is added to my cygwin PATH variable. Haven't used this setup for a while but as I recall, when I call the emacs.cmd with a new file over and over, they all end up being buffers in the one and same emacs session.


I used to use the following command in Windows to launch NTEmacs via Cygwin (thus inheriting my Cygwin environment variables), while keeping the same HOME directory that NTEmacs uses by default: C:\cygwin\bin\bash.exe --login -c "env HOME=\"`cygpath '%APPDATA%'`\" /cygdrive/c/emacs/emacs-23.2/bin/runemacs.exe"
L
Lorenzo Gatti

There was https://bitbucket.org/Haroogan/emacs-for-windows with the latest Emacs 25, but the whole page has been removed. The benefit of this build and the emacs-w64 above is that they come with jpg, png, tiff DLLs as well as lxml DLL, which is needed for the new eww web browser.


Who is Haroogan? Is this like an official source?
By no means an official source. He claims he get the tip of version 25 and builds that. The alternative is to build emacs yourself using the information from emacs-w64 at sourceforge.net/p/emacsbinw64/wiki/…. It worked for me, even using MSYS2 as my default shell now.
t
tbc0

I prefer to run Windows 10 + VcXsrv + Emacs 25 client in WSL. Emacs is my shell.


D
Daemin

To access the .emacs file for your profile the easiest way is to open up emacs. Then do C-x C-, type in ~USERNAME/.emacs (or you can use init.el or one of the other flavours). Type your stuff into the file and C-x C-s (I think) to save it.

The actual file is located (in Windows XP) in c:\Documents and Settings\USERNAME.emacs.d(whatever you named the file), or the equivalent spelling/location on your system.


l
ljs

You can download GNU Emacs NT from here direct. It works fine in windows, make sure you create a shortcut to the runemacs.exe file rather than the emacs.exe file so it doesn't show a command prompt before opening!

XEmacs is less stable than GNU Emacs, and a lot of extensions are specifically written for GNU. I would recommend GNU > X.

You can place the .emacs file in the root of the drive it's installed on. Not sure whether you can add it elsewhere too...


C
Community
J
Jeff

If You Mean Emacs as Latex Editor for Windows 7.

Emacs4LS (Emacs 4 Latex Support under Windows 7) for newcomer for Emacs. http://chunqishi.github.io/emacs4ls/

Easy Steps to Install. Plugins Built-In.