Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved automatic tern-command' setting of tern' executable location. #930

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rswgnu
Copy link

@rswgnu rswgnu commented Sep 5, 2017

This is mainly for the case where npm has not installed the executable in a standard executable directory and the tern.el Emacs package has been installed via the Emacs package manager and needs to locate this executable.

mainly for the case where npm has not installed the executable in a standard
executable directory and the tern.el Emacs package has been installed via the
Emacs package manager and needs to locate this executable.
(not (executable-find "npm")))
(setq bin-file (or (executable-find "tern")
(expand-file-name "tern/bin/tern"
(file-name-directory (shell-command-to-string "npm -g ls --parseable tern"))))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just returns /home/marijn/prog/node/lib on my system (and tern isn't even installed there). What is it intended to do?

@rswgnu
Copy link
Author

rswgnu commented Sep 8, 2017 via email

@marijnh
Copy link
Member

marijnh commented Sep 8, 2017

where npm has not installed the executable in a standard executable directory

The fallback is already to just run tern though, and it seems start-process runs it in a way that uses the path, so what exactly does this add (except for the npm-based magic, which seems like it'll easily go wrong if you didn't actually use a global npm install for tern)?

@rswgnu
Copy link
Author

rswgnu commented Sep 8, 2017 via email

@othree othree added the emacs label Jul 5, 2018
@androclus
Copy link
Contributor

androclus commented Nov 7, 2018

I installed both node and tern globally (npm install -g tern) and yet the emacs tern backend still cannot find my tern-server automatically. I have to set it manually:

(setq tern-command '("/home/jas/.nvm/versions/node/v10.13.0/bin/tern"))

If I do not do this, tern does not "run out of the box" for precisely this use-case (which I would think the most common) that Bob describes:

  • node is not installed in a standard directory. (Many people use nvm, as do I)
  • tern.el installed via emacs package manager

Mari, I agree with Bob that this was definitely a stumbling block for me as a new user. It wasted at least a couple hours of my time (I've been working to get tern/emacs going for the 2nd day now -- this is not the only problem.) IMHO whenever software can work "out of the box" in at least the most common scenarios, we'll gain more happy users, instead of people who just get frustrated and leave.

Maybe Bob's code above doesn't work perfectly yet, but I think it is the right idea / direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants