nim-lang / nim-mode

An emacs major mode for the Nim programming language
137 stars 46 forks source link

Nimsuggest epc error "Nim compiler not in PATH" #225

Closed greenfork closed 5 years ago

greenfork commented 5 years ago

Conforming Bugs

Please tell us below:

And describe your problem:

Whenever I open an Emacs with nim file, I see this error:

deferred error : (error "Server may raise an error Use \"M-x epc:pop-to-last-server-process-buffer RET\" to see full traceback:
nimsuggest.nim(627)      handleCmdLine
Error: unhandled exception: Cannot find Nim standard library: Nim compiler not in PATH [IOError]

Process epc:server:2 exited abnormally with code 1

which is this line https://github.com/nim-lang/Nim/blob/devel/nimsuggest/nimsuggest.nim#L627

Executing nimsuggest filename.nim works fine, continuously outputs messages like

usage: sug|con|def|use|dus|chk|mod|highlight|outline|known file.nim[;dirtyfile.nim]:line:col
type 'quit' to quit
type 'debug' to toggle debug mode on/off
type 'terse' to toggle terse mode on/off

and executing

import os
findExe("nim")

correctly outputs my binary location.

The gist is that nimsuggest doesn't work for my Emacs buffers.

zedeus commented 5 years ago

Emacs uses it's own internal PATH variable, which may differ from your normal one. I had to fix a similar issue by doing this in my init file:

(setenv "PATH" (concat (getenv "PATH") ":/home/zed/.nimble/bin"))
(setq exec-path (append exec-path '("/home/zed/.nimble/bin")))
(setq nimsuggest-path "/home/zed/.nimble/bin/nimsuggest")
greenfork commented 5 years ago

@zestyr thank you so much, that solved the issue!