VisEmacs Frequently Asked Questions

part of Computing at At Net's End by Jeff Paquette

The Questions

  1. Why can't I compile VisEmacs?
  2. VisEmacs didn't register properly, doesn't appear in the Tools|Customize dialog.
  3. Emacs starts up, but doesn't open the file. Why not?
  4. I get a new frame for each file I open! How do I prevent this?
  5. Can I control VisualStudio from Emacs?
  6. Are there any more examples of using Perl to control Visual Studio?

The Answers

  1. Why can't I compile VisEmacs?

    If you are using VC++ v5.0, try copying the VisEmacs.001 file over the VisEmacs.dsp file. When using the VC++ 6.0 compiler, I converted the project file to the new format.

  2. VisEmacs didn't register properly, doesn't appear in the Tools|Customize dialog.

    If VisEmacs doesn't register, it won't appear in the Customize dialog. If it doesn't register, it's because of MFC, or one of the many versions of regsvr32.exe that are out there. Just download the source and recompile. That will fix this problem, and register the DLL.

  3. Emacs starts up, but doesn't open the file. Why not?

    You probably didn't configure gnuserv correctly. Add the following to your .emacs:

        
        (require 'gnuserv)
        (gnuserv-start)
        
        
  4. I get a new frame for each file I open! How do I prevent this?

    By default, gnuserv will load files into new frames. If you would rather have gnuserv load files into an existing frame, then evaluate the following in the chosen frame:

    (setq gnuserv-frame (selected-frame))

    Placing the above in your startup file, for example, will have gnuserv load files into the original Emacs frame. Note: one drawback of this approach is that if the frame associated with gnuserv is ever closed, gnuserv won't have a frame in which to place buffers.
    Taken from the NTEmacs FAQ.

  5. Can I control VisualStudio from Emacs?

    Since VisEmacs uses the gnuserv package to handle communication with emacs, it is not possible for emacs to communicate with VisEmacs. However, if you have perl installed, it is possible to control VisualStudio via it's Document Object Model.

    Here's an example that brings a running VisualStudio instance to the foreground when S-f7 is pressed in Emacs:

    (defun run-perl (&rest stmts)
    (call-process "perl" nil nil nil "-e" (apply 'concat stmts)))
    
    (defun switch-to-msdev ()
      (interactive)
      (save-some-buffers)
      (let ((val (run-perl "require Win32::OLE;"
    		       "my $app = Win32::OLE->GetActiveObject('MSDev.Application');"
                           "$app = Win32::OLE->new('MSDev.Application') if ! defined $app;"
    		       "exit 1 if ! defined $app;"
    		       ;; State 1 is Maximized, 2 is minimized, 3 is normal
    		       "$app->{'WindowState'} = 1 if $app->{'WindowState'} == 2;"
    		       "$app->{'Visible'}=1;"
    		       "$app->{'Active'}=1;"
    		       "exit 0;"
    		       )))
        (cond ((zerop val)
    	   (iconify-frame)
    	   t)
    	  ((= val 1)
    	   (error "MSDev not running"))
    	  (t
    	   (error "Failed to connect to MSDev")))))
    
    (global-set-key [S-f7] 'switch-to-msdev)
    
  6. Are there any more examples of using Perl to control Visual Studio?

    At the moment, no. But if you do develop any, I'd be happy to list them here so send them in!



Last modified: Tue Dec 3 11:48:33 EST 2002