[emacs mode] Make sure tern-project-dir doesn't loop infinitely

Issue #176