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
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions emacs/tern.el
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,17 @@
(let* ((script-file (or load-file-name
(and (boundp 'bytecomp-filename) bytecomp-filename)
buffer-file-name))
(bin-file (expand-file-name "../bin/tern" (file-name-directory (file-truename script-file)))))
(if (file-exists-p bin-file)
(bin-file (and script-file (expand-file-name "../bin/tern" (file-name-directory (file-truename script-file))))))
(unless (or (and bin-file (file-executable-p bin-file))
(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?

(if (and bin-file (file-executable-p bin-file))
(if (eq system-type 'windows-nt) (list "node" bin-file) (list bin-file))
(list "tern")))
"The command to be run to start the Tern server. Should be a
list of strings, giving the binary name and arguments.")
"The command to be run to start the Tern server.
Should be a list of strings, giving the binary name and arguments.")

(defun tern-start-server (c)
(let* ((default-directory (tern-project-dir))
Expand Down