views:

202

answers:

4

What Visual Studio settings and .emacs macros improve the likelihood that code written on Windows (in visual studio) will still look good in Emacs (and vice versa)? I've recently taken to turning off tabs in emacs (so tabs are rendered via spaces) and this at least makes the code look the same (tho people who like certain tab sizes are out of luck). Is there a better way?

+2  A: 

Tab sizes is a purely personal preference, but each piece of code or project should specify which tab size it wants to use as a standard. That way, even if someone doesn't like your tabs sizes, they'll know you meant it to be that way and do the same in any fixes, and hopefully they shouldn't have a problem with that.

Douglas F Shearer
+3  A: 

Always use tabs for indenting only and nothing else, and there's no problem.

Anything involving aligning characters across lines (not indenting) should use spaces.

Just do that, then people can set their tab size to whatever they like, and everything will all be fine.

Peter Boughton
+1  A: 
paperhorse
+1  A: 

In addition to using spaces instead of tabs and making sure that the tab width is the same in both editing environments, I usually change emacs's (because I'm more familure with it) c/c++ modes to "bsd" style. This seems to more closely match visual studio's default style.

From my .emacs custom-set-variables list:

'(c-default-style (quote ((c-mode . "bsd") (c++-mode . "bsd") (java-mode . "jav
a") (other . "gnu"))))
ejgottl