cloned from https://bitbucket.org/hibbelig/dired