The Problem

At CIM Software Testing we have for along time pondered moving to Visual Studio 2012, but now 2013 came out so that is the next target.

With a new Visual Studio comes a new hunt for a way to make it usable for people like me who are emacs-impaired and cant help hitting Ctrl+N and Ctrl+P all the time, which normally means that new documents are created and printed on end.

Visual Studio 2005 contained some emacs keybindings which were ok for moving about a document, but the copy/paste (kill/yank in emacs lingo) was HORRIBLE!?!?!? it tried to implement a kill-ring but that did not work at all, and usually i ended up opening the document in emacs and doing the actual copy/pasting - but i lived with that setup for many years.

With Visual Studio 2008 and 2010 the emacs bindings got split into a separate package, and with 2012 they disappeared completely - and apparently never to return.

So i need some way to use emacs keybindings with visual studio, at first i pondered writing a Visual Studio extension which would connect to a socket emacs listened on, and emacs would then talk to VS to get information about the open documents, and get intellisense (auto-complete) information.

But writing VS "packages" are really hard i found out, i thought it would be easy now that Microsoft has adopted .net for almost everything but there is still a LOT of COM monsters lurking in there.


And i though writing the emacs elisp part of the equation would be hard.


The Solution

So my current solution is to use the standard VS commands and map them to the relevant Emacs keys.

So far it feels very basic and i haven't used it that long yet (we haven't made the switch to VS 2013 completely yet), but i think i can live with it. At least as long as i can jump into Emacs when the need arises using Alt+E.

The most prominently missing thing is selection support, i haven't found a way to make the VS editor do selection marking the same way that emacs does it (using Ctrl+Space to mark the start of the selection) - i maybe end up having to write a bit of VS package after all to get that working.

So we have to use "hold-down-shift" selecting - and you just cannot do that while you are using emacs keybindings to move the cursor.

The keys i currently have mapped are:

VS Command Keyboard binding
Edit.CharRight Ctrl+F
Edit.CharLeft Ctrl+B
Edit.DeleteToEOL Ctrl+K
Edit.DocumentEnd Shift+Alt+<
Edit.DocumentStart Alt+>
Edit.LineDown Ctrl+N
Edit.LineStart Ctrl+A
Edit.LineEnd Ctrl+E
Edit.LineUp Ctrl+P
Edit.DeleteToEOL Ctrl+K
Edit.DeleteToEOL Ctrl+K
View.NextError Alt+N
View.PreviousError Alt+P
Edit.WordNext Alt+F
Edit.PageDown Ctrl+V
Edit.PageUp Alt+V
Edit.Cut Ctrl+W
Edit.Paste Ctrl+Y
Edit.Copy Alt+W
File.SaveSelectedItems Ctrl+X, Ctrl+S
Edit.Undo Ctrl+Shift+-
Edit.LineEnd Ctrl+E
Edit.FormatDocument Tab
File.Close Ctrl+X, K
File.OpenFile Ctrl+X, Ctrl+F
View.CommandWindow Alt+X
Edit.BreakLine Ctrl+O
Edit.IncrementalSearch Ctrl+S
Edit.ReverseIncrementalSearch Ctrl+R
Edit.GoTo Alt+G
Edit.SelectionCancel Ctrl+G
Tools.ExternalCommand1 Alt+E

I had to remove the following keybindings to get it to work:

VS Command Keyboard binding
File.SaveSelectedItems Ctrl+X, Ctrl+W
Edit.BreakLine Shift+Enter
Edit.ViewWhiteSpace Ctrl+R, Ctrl+W
Edit.DocumentStart Alt+A

Some of commands do not map correctly from emacs, e.g. TAB has been mapped to FormatDocument, it was the best match as i hit TAB all the time when i write code in emacs to indent the line i am on without moving the cursor position. It works, but VS cant indent unless the entire document is "correct" according to the coding rules for the document (e.g. C#), emacs is better here in my oppinion since you can use TAB to find out where you are missing a end } character in your code - VS just looks a you with a blank face, waiting for you to fix the code.

Why emcas?

Emcas is the name i have given to this journey to make me spend even more time inside Visual Studio. When i started using emacs i often started it directly from the commandline and my fingers would sometimes hit emcas instead if i went too fast.


You can download it by using Bazaar and pointing it here:, install by using TOOLS -> Import and export settings...


After being hacked because i apparently had an old MoinMoin installation i have now switched to statically generated pages using my own hand-coded python script.


  1. published 2011-10-11

My G502 finally gave up so i had to find a new phone (apparently life without a phone is impossible). I went with Sony Ericsson for the second time, a Mini Pro with Android 2.3.

The best thing is definitely the keyboard, i never got the hang of T9, now i can type at a pretty good speed and i do not dread writing text messages, i have tried both the Android virtual keyboard and the iPhone keyboard on friend's phones and i hate both. I am actually writing this on the phone right now.

I use Emacs! I want tactile feedback!

The phone is a bit big and heavy, and the battery drains too fast. But that seems to be a problem with all modern phones, they all suffer from iPhone envy.

The worst thing is all the crap-ware that Ericsson puts on the phone. Mcafee virus scanner, PopCon games to name just a few. All in trial versions of course.

If you could just remove this stuff i could accept it, but much of it is "burned in" and not removeable without root'ing your device. Actually the PopCon games thingy has a service running in the background on the phone at all times - no way to know what it is doing and what kind of data is is stealing.

I think this is a scary scenario, if our phones will now be as bloated as a windows pc when we buy them. And since there is no explanation about what the different programs do, it is impossible to know what they do unless you accept their license agreement thingy, and sometimes it is not even apparent after that. I am a fairly technical guy who should be capable of coping, but i can not imagine how "normal people" will feel when there are all sorts of crap-ware installed on the phone.

I would also like to see some ball-part-figure about how much money the companies are paying Sony Ericsson to put it on the phones, they have to decide whether to provide an inferior user experience and risk loosing future customers, or if they want to line their pockets right now.

But the keyboard is nice ;)

[Error: Macro 'Comments' doesn't exist]

[Error: Macro 'AddComment' doesn't exist]

CategoryBlog CategoryReview


  1. published 2010-12-03 10:15:36

Just a quick post to let you know about a new site i stumbled upon recently when i had to search the web for an exception message i got from a customer:

Ugyldigt højt erstatningstegn (0xDC48). Et højt erstatningstegn skal have en værdi fra området (0xD800 - 0xDBFF).
}}} ass hosting_thumb.JPG

If you do not understand danish you should still pay attention, because it might be you who have a danish customer who reports that the listed exception was thrown.

If you do understand danish you can try to decode the translated string (which is really hard), if you do not understand danish you are pretty much fucked.

This has been the state of affairs for many years on microsoft's platform, despite all their developers, developers, developers talk. I mean, how do you search for such a string?

Until now you were fucked, but i just found which will translate your useless localised error message to the english equivalent, and now you can google for it!

It looks like it is completely machine generated, but who cares, it does exactly what it says.



  1. published 2010-05-04

Sharp wishes: `nameof`

Hi again, after over half a year of silence i think i am finally ready to write something again. The thing is: i have been writing a lot of C# lately as part of my job.

When you work some years with a language you start to envision certain improvements to the langauge which would make your life much easier. I plan to write these findings here as i find the time to do so.

The first thing i wish to tackle is the "lack of" a nameof operator, this is actually something which is lacking in Java and C++ too, but i find that it is more needed in C# because you deal with a lot of strings there, not to say that it would not be a huge boon in any language.

What this new operator tries to tackle is a problem most C# developers have faced: you have a class with a number of properties, these properties can be updated which, in turn, makes the object instance emit a PropertyChanged event for that particular property.

The problem comes when you want to write code which reacts to this property change for a particular property:

{{{#!highlight csharp
private void object_PropertyChanged ( object sender, PropertyChangedEventArgs args )
if ( args.PropertyName == "NumberOfSamples" )
// Do stuff

This works ok at the beginning, but you are actually introducing dynamic/runtime programming into your statically compiled program. What happens if NumberOfSamples changes name to NumberOfActualSamples ? Your code will be broken but you will not see it on compile time, only on runtime.

Sometimes people, including myself, handle this by introducing an inner public class called Properties which contain several public const strings with the property names:

{{{#!highlight csharp
public class MyClass
public class Properties
public const string NumberOfSamples = "NumberOfActualSamples";

{{{#!highlight csharp
private int m_numberOfSamples;
public int NumberOfSamples
return m_numberOfSamples;
if ( m_numberOfSamples != value )
m_numberOfSamples = value;

{{{#!highlight csharp
OnPropertyChanged ( Properties.NumberOfSamples );

This is actually quite a nice way to write code, you even get the added benefit of being able to search your code for places where a particular property is used from inside visual studio by using the built-in "Find all references" command.

But please notice that this is a violation of the DRY (Don't Repeayt Yourself) principle, that all hackers hold so dear.

A further complication is that this does not work for interfaces where inner classes are not allowed.

So what to do?

My proposal is to add a "nameof" operator, which takes the name of an identifier and returns it's name as a string. The "OnPropertyChanged" part of the code above would then look like:

{{{#!highlight csharp
OnPropertyChanged ( nameof(NumberOfSamples) );

This syntax looks pretty easy to me, nameof works pretty much the same as typeof.

Of course you would have to make a few adjustments to be able to do things like:

I am sure you can think of more.

This is just a proposal, please report back with comments.

CategoryBlog CategorySharpWishes


  1. published 2009-09-13

For a long time my primary animosity against windows has been the lack of a standard packaging system like on Linux, where keeping your system up to date is a simple process that does not require you to run 10 different programs with 10 different interfaces and rebooting 10 times.

In the past this has made my blood boil several times, two years ago it even got so bad i had to blog about it

Several months ago i created a program that will hopefully make this less painful in the future, and now i think it is time to tell the world.

You might have noticed the Vaca link on the top of this page which has been here for some months now too, it will lead you to my "repository" of Vaca sources.

Ok, let's back down a bit, what exactly is Vaca?

Well it is a simple "download and install program" which uses rss feeds to query when programs come in new versions. It simply downloads the newest version of a program's installer and executes it with the proper parameters to install without bothering you with the "next,next,next,next,finish" nonsense.

The reason for using Vaca is "obviously" to make it even easier for projects and bloggers to publish new versions of their software, they simple slap a vaca tag in their rss feed and Vaca will eat it all up.

Now, back to the Vaca link at the top of this page. It will lead you to a repository i keep of Vaca rss feeds (called sources). This is more a proof of concept than anything else, if Vaca takes off i know that i wont be happy with maintaining a list of thousands of software up-to-date. I don't scale well :)

I think that is enough talk, give it a whirl and tell me what you think. And if you start publishing any Vaca sources, incorporate Vaca in your product (please do!) or some other cool thing, please let me know!

If this gets enough leverage i will have to set up a bigger Vaca source site somewhere where admins will be able to edit the site without me having to be the weak link.

Happy Hacking!



  1. published 2009-04-13
Today i found the time to create a small utility i have been needing for some time.

I use emacs's rcirc client to talk on irc and on Debian i use the libnotify library's notify-send command to notify me when someone talks to me, as described here.

So now i have created a windows utility to do this: WinNotify which is just a simple command line utility to make windows popup one of those balloon notification dealies.

I am sure it can be applied to other things - please do!