VisEmacs Frequently Asked Questions

VisEmacs Frequently Asked Questions


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?


  2. 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.

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


  4. 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.

  5. Emacs starts up, but doesn't open the file. Why not?
  6. You probably didn't configure gnuserv correctly. Add the following
    to your .emacs:

        (require 'gnuserv)
        (gnuserv-start)
        

  7. I get a new frame for each file I open! How do I prevent this?
  8. 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.

  9. Can I control VisualStudio from Emacs?
  10. 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)
    

  11. 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!