use locate-dominating-file instead of my stuff.