Visual Studio 2010 and Emacs

I’ve posted about this issue before in previous versions of Visual Studio, which received a very helpful response. The newest version of Microsoft Visual Studio 2010 didn’t ship with emacs support. This was later remedied by Microsoft with an emulator. Great.

Don’t get me wrong; I’m very happy about the emacs support. I was happy enough, in fact, that I upgraded to the new Visual Studio. Even so, the emulator isn’t perfect. There are a lot of things broken. Notably, the expected behavior when pressing Enter or Tab.

Emacs doesn’t support auto-line indenting (at least out-of-the-box). Indenting happens depending on the language file loaded, any custom settings, etc. Microsoft emulated this behavior. When hitting Enter in VS2010, a newline appears and the cursor sits contently at the beginning of line point. I find this rather irritating!

To fix this, I had to settle on breaking a few other things (more on that later).

  1. Tools ->Options… -> Keyboard
  2. Under “Show commands containing:” type “EmacsBreakLineIndent”
  3. Click “Edit.EmacsBreakLineIndent”
  4. Select “Text Editor” under “Use new shortcut in:” (if not already selected)
  5. Highlight where it says “Press shortcut keys:”
  6. Press the Enter key on your keyboard
  7. Click “Assign” and “OK”

Done. That solves most formatting issues (in the code editor, there are issues editing HTML and Javascript).

Another annoyance is emacs keybindings with snippets. They don’t work. I haven’t figured this one out yet. If I do, I’ll be sure to post back.

Basically if you don’t already know, snippets are quick auto-fill type things that help compete common tasks. If you begin typing “for” and auto-complete shows a snippet icon, hit tab twice to see what it’s suppose to do. You can try it, at least, with default keybindings since it work work with emacs.

I’ll see if Microsoft Connect can shed some light on this issue and post back. (Vote here is you’re interested in getting this fixed.)

4 comments to Visual Studio 2010 and Emacs

  • I’m a little late getting here, thanks for documenting this. I’ve been kicking myself every time I forget and hit tab since it also wipes out the first few characters.

    • The new NTP is not good. My variant shows unasceesnry second search box, VERY unasceesnry big GOOOGLE label. And only small subset thumbnails of my favorite sites (yes, i know i can scroll… but i don’t want to, i want one click access).And also i noticed that chrome removed text box from Google search page results. It is also a bad idea, guys. User focuses on the page, INSIDE the page, and URL field is out of user focus. What you have done, you tried to extend user focus to whole browser window… but it won’t work. Not speaking of seacurity concerns (some sites would like to emulate such bahaviour in some way).Back to stable channel. I hope such changes will not go into stable.

  • I’m a little late getting here, thanks for documenting this. I’ve been kicking myself every time I forget and hit ‘tab’ since it also wipes out the first few characters.

  • Thanks for the post–the newline problem has been driving me nuts!

Leave a Reply