Previous: , Up: Using MSVC command line tools from Emacs   [Contents][Index]

10.1.2.4 Edit with Emacs function for MSVC

You can also set up VC++ to import a file into Emacs for you, all ready for editing. In VC++, go to the Tools pull-down menu, and click on Customize.... In the Tools tab, click on Add. Use Browse to locate the emacsclientw.exe file in your Emacs bin directory, and select it. For arguments, use +$(CurLine) "$(FilePath)" and for the directory use the $(WkspDir) (the quotes around FilePath handle paths with spaces in them). Set the Menu Text to say "Em&acs". The +$(CurLine) will set point in Emacs to the same line as the cursor position in VC++. The ampersand in the word Em&acs allows you to select emacs from the keyboard. (E is already used for the OLE control test container.)

You should now be able to go to any source file in your project. Then, use the pull-down menu Tools->Emacs. The active file in your VC++ IDE should now be front and center in Emacs, all ready to edit as you wish. If you use keystrokes to work the menus, try Alt-T A to move the file into Emacs. Binding this tool to a keystroke will be left as an exercise for the student.

If you have the option of saving files before running tools, make sure this option is set. (I don’t see it on VC++ 4.0.)