Monday, August 21, 2006

Emacs Tip: Making Emacs Work With Yap

As a followup to my previous post about the joys of the newest version of Emacs, AUCTeX and Preview-TeX on Windows, I now present how to make Emacs invokable by another application on Windows. It all has to do with the magic that happens when source-specials are enabled in AUCTeX

Here's the current scenario:
  1. Edit a LaTeX file with Emacs
  2. Run C-c C-c to compile
  3. Run C-c C-c to view
  4. Yap will load up with the DVI file in the spot that is currently being edited in Emacs
  5. Double-click in a spot in the DVI file in Yap and ... !?!
What follows are the instructions for turning that !?! into "jump back into Emacs at that spot in the LaTeX File", just as we want.

It all comes down to the problem that the implementation for Emacs' client-server architecture isn't complete on Windows. However, there is an external implementation, the one used in XEmacs, that works rather well.

This is hardly an automated task, so don't run through these instructions too quickly.
  1. Download gnuserve for Windows. It's near the bottom of the page. I used "newer and hopefully more compatible version".
  2. Unzip the file that was just downloaded.
  3. From the zip file, copy the executable files (*.exe) to the bin subdirectory folder and the Emacs Lisp files (*.el) to the site-lisp subdirectory of your Emacs folder.
  4. In your .emacs file, add the lines
(load "gnuserv")

If everything worked, you can fire up Emacs and enjoy some fantastic Emacs-Yap editing interaction

  • It seems that there may be an issue with running more than one instance of gnuserv. I'm looking into that.
  • It seems that the version of gnuserv that I'm recommending may be a bit outdated or has had it's development abandoned. However, I can't find a newer version. Hopefully there will be a development soon on this front.

No comments:

Post a Comment