Steal nice ido hacks from timcharper

from here: https://gist.github.com/timcharper/493269 via emacswiki