This page describes how to make emacs be Internet Explorer’s “View Source” application (when Source is selected from IE’s View menu).

For Windows XP

Install GnuServ

          ; Run gnuserv, for view source, unless it's already running
          (require 'gnuserv)
          (unless gnuserv-frame
              (setq gnuserv-frame (selected-frame)))

Create a batch file to run Emacs

The View Source option in IE works by searching for the named program and appending the HTML source file’s name to it. If it can’t find the file, it gives a “not found” error message and reverts to using Notepad. Since gnuclientw.exe requires extra command line options just to open a file (which is insane, but what can you do?), you need a batch file to act as intermediary.

Note: This presumes you’ve installed your emacs using the EmacsW32 installer, which makes Emacs 22 available for Windows well ahead of the game. If not, adjust your paths to suit in the following batch file.

Create the following file as C:\Program Files\Emacs\emacs.bat:

  @echo off
  "c:\Program Files\Emacs\EmacsW32\bin\gnuclientw.exe" -sqF %*

Update your registry

  1. Open regedit.exe
  2. Navigate to the key (“folder”) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer
  3. If you do not have it already, create a key under it (right click → New → Key) called “View Source Editor”.
  4. Open the new key you got and create another new key called “Editor Name” under it.
  5. In the (Default) string value on the right hand side in regedit, enter the following: C:\Program Files\Emacs\emacs.bat