cleverer path finding for erlang-mode