Guest Blog: Moving from Emacs to Visual Studio | Syncfusion Blogs
Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (172).NET Core  (29).NET MAUI  (192)Angular  (107)ASP.NET  (51)ASP.NET Core  (82)ASP.NET MVC  (89)Azure  (40)Black Friday Deal  (1)Blazor  (209)BoldSign  (12)DocIO  (24)Essential JS 2  (106)Essential Studio  (200)File Formats  (63)Flutter  (131)JavaScript  (219)Microsoft  (118)PDF  (80)Python  (1)React  (98)Streamlit  (1)Succinctly series  (131)Syncfusion  (882)TypeScript  (33)Uno Platform  (3)UWP  (4)Vue  (45)Webinar  (49)Windows Forms  (61)WinUI  (68)WPF  (157)Xamarin  (161)XlsIO  (35)Other CategoriesBarcode  (5)BI  (29)Bold BI  (8)Bold Reports  (2)Build conference  (8)Business intelligence  (55)Button  (4)C#  (146)Chart  (125)Cloud  (15)Company  (443)Dashboard  (8)Data Science  (3)Data Validation  (8)DataGrid  (62)Development  (613)Doc  (7)DockingManager  (1)eBook  (99)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (37)Extensions  (22)File Manager  (6)Gantt  (18)Gauge  (12)Git  (5)Grid  (31)HTML  (13)Installer  (2)Knockout  (2)Language  (1)LINQPad  (1)Linux  (2)M-Commerce  (1)Metro Studio  (11)Mobile  (488)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (41)Performance  (12)PHP  (2)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (12)Road Map  (12)Scheduler  (52)Security  (3)SfDataGrid  (9)Silverlight  (21)Sneak Peek  (31)Solution Services  (4)Spreadsheet  (11)SQL  (10)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (12)Tips and Tricks  (112)UI  (368)Uncategorized  (68)Unix  (2)User interface  (68)Visual State Manager  (2)Visual Studio  (30)Visual Studio Code  (17)Web  (577)What's new  (313)Windows 8  (19)Windows App  (2)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)

Guest Blog: Moving from Emacs to Visual Studio

(This guest blog was written by Nick Harrison, March 2017.)

In college, I did everything in UNIX. On UNIX, everything was centered around programming. Of course, you probably had to be a programmer to get anything done or at least appreciate it.  The big debate of the day was the merits of vi vs emacs. After much deliberation, I settled on emacs. Despite its power, vi was just a bit too cryptic for me. Emacs was very powerful, still quite cryptic, but had nearly endless options for customization.

You could start up emacs and stay there all day. It didn’t matter whether you wanted to run a command shell, query a database, read email, or even browse the web, there was no reason to leave emacs. Regardless of the type of file you were editing, there was a custom mode available to help with editing that file. Whether it was the password file, Fortran, lisp, C, C++, HTML, SQL, Eiffel, or something else, there was a language-specific editor mode ready to help with syntax highlighting, indention support, matching parenthesis, and more. If you weren’t doing actual “work,” you could get diversions with such distractions as Life, Towers of Hanoi, or Doctor. It had everything!

To make it even more enticing, emacs was available anywhere you wanted it to be. You could find it on any flavor of Unix; I used it on VAX/VMS, Data General, Windows, even Mac. Wherever you found yourself, emacs was there and pretty much worked the same way as anywhere else in all its cryptic glory.

As I left college, I took emacs with me everywhere I went. I stayed in Unix land with brief forays over to Windows. I brought emacs with me on these incursions and Perl, working to make this new land more Terre Familiar. You know the expression, “If you are good with a hammer, everything looks like I nail.”

Eventually I had to delve into the world of Visual Basic. I searched and found visual basic mode.el. This of course was the ultimate “square peg round hole” hack, but I kept going. Actually, I kept trying to ignore Visual Basic specifically and Windows in general. I tried to keep making Windows as Unix-like as I could and cast as many problems as possible as Perl scripts. I was pretty creative at times.


Then came DotNet. DotNet solved all the problems I ever saw with Visual Basic. VB.Net felt more like a “real language,” and C# felt natural and intuitive. It felt like the obvious heir apparent to C++. Even from its original version, the DotNet framework was fully flushed out Much more so than you would typically expect for an initial release. My reasons for clinging to the past were rapidly disappearing, and just in time. Stringing together my hacks and fitting everything into the molds of beloved, bygone days was beginning to fall short.

So in January 2002, I jumped on the DotNet bandwagon with the latest beta and the official .1.0 when it was released in February. I would like to say that I got with the program and never looked back, but old habits die hard. While I was testing the waters with Visual Studio, I also experimented with csharp-mode.el, but this flirtation was short lived. Despite everything that I knew about emacs, despite how familiar I was with emacs and all that it could do, Visual Studio was simply a better environment for editing DotNet code.

For many of my friends, I had ventured into heretical territory. Friends jokingly called me Saruman, a reference to how the wizard from Lord of the Rings turned on his friends to serve Sauron. It was quite the scandal.

Visual Studio from its earliest days knew all about editing C# code and VB.Net code. Support was pretty good for HTML and very good for CSS. There was some support for editing SQL, but even less for editing JavaScript. These deficiencies were annoying but would improve over time. In fact, it wasn’t always apparent how little support there was for JavaScript until future versions showed just how much better support could be.

Most of my favorite features from emacs show up in Visual Studio. Language sensitive editing modes. Visual Studio detects what you are editing and optimizes the editor accordingly. The editor behaves differently if you are editing HTML than if you are editing C#. When you are editing VB.Net, VB keywords are highlighted. When you edit C# code, C# keywords are highlighted. When you format code, it is formatted appropriately based on the current language. Regardless of the language you are using, the syntax and semantics of that language is used. This seems obvious today and is often taken for granted, but this was and is a big deal.

There are other great features that were first seen in emacs that are now firmly baked into Visual Studio. Many of these features you probably never thought of as originating from emacs. Incremental search is a subtle feature. It is so intuitive that is seems obvious and natural. We don’t even think about it. We expect incremental search and its close relative auto complete, search suggest drop down lists, etc. In Visual Studio, simply type Ctrl+I and start typing what you want to find. As you type, you are moved in the file to the first occurrence of what you have typed so far. You can quit typing as soon as you find what you are looking for. The time savings from this simple change adds up quickly.

Closely related to incremental search is IntelliSense. This is an even bigger time saver for developers. IntelliSense allows you to easily complete the word that you are typing, whether that word is the name of an object, a reference to a member of an object, or the parameters to a method. This means less typing for the developer. It also means that you don’t have to remember all the details. You don’t have to keep track of how these things are spelled or how they are cased. You just start typing the beginning of the name and then press Ctrl+Space to activate IntelliSense. This allows you to write code faster with less typing which means less opportunities for you to spell something wrong or worry about which letters are capitalized and which are not. It also makes it easier to learn about the objects you are working with and their members. All wins for the developer.

IntelliSense brings more to the table than simply listing out the members in the objects you are using. If a library is compiled with the /doc switch, any XML comments supplied in that library can be incorporated into the details exposed with IntelliSense, so if you create a library and add XML comments explaining the parameters to a method in one of your classes, the descriptions from these comments will be displayed to anyone using your library. This takes developer training to a whole new level and further boosts developer productivity. The documentation you include in your library is readily available to anyone using the library as they are using the classes and methods in your library.

Now, with Visual Studio 2017 and Roslyn, developer productivity is pushed to even higher levels. Using Roslyn, we can get real time analytics on our code as we type it. Anyone can write extensions using Roslyn to flag potentially problematic code as the code is being written. Not only can you flag code as being problematic, you can also provide a quick fix. The extension can rewrite the code to fix any problems found. Want to encourage developers to check if an IEnumerable has any elements matching some criteria instead of counting how many times some specified criteria are met? This can easily be caught and corrected in an extension. Want to encourage developers to use LINQ instead of a for each loop with an embedded if statement? This can be detected and corrected in an extension. Want to create a compile error if a method has too many parameters? You can easily create such an extension.

So yeah, I clung to the familiar past and resisted change for a long time, but in the end Visual Studio provides a compelling developer experience that is tough to beat.

Tags:

Share this post:

Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top