misc stuff taken from emacswiki, etc