nim-lang / nim-mode

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

eldoc causes problems when nimsuggest-mode is not enabled #208

Closed krux02 closed 5 years ago

krux02 commented 5 years ago

When eldoc is enabled globally, but nimsuggest-mode is not enabled, eldoc will start it anyway somehow. That should not be the case. Eldoc should check if nimsuggest is enabled, when it is not enabled, it should respect that.

This is the error message from the debugger, even though I never started nimsuggest, nor do I want nimsuggest to be active.

Debugger entered--Lisp error: (error "Server may raise an error. Use \"M-x epc:pop-to-last-server-pr
  signal(error ("Server may raise an error. Use \"M-x epc:pop-to-last-server-process-buffer RET\" to
  error("Server may raise an error. Use \"M-x epc:pop-to-last-server-process-buffer RET\" to see ful
  (cond ((string-match "^[ \n\015]*[0-9]+[ \n\015]*$" port-str) (setq port (string-to-number port-st
  (let ((port-str (save-current-buffer (set-buffer process-buffer) (buffer-string)))) (cond ((string
  (while cont (accept-process-output process 0 epc:accept-process-timeout t) (let ((port-str (save-c
  (let* ((uid (epc:uid)) (process-name (epc:server-process-name uid)) (process-buffer (get-buffer-cr
  epc:start-server("/home/arne/proj/nim/Nim/bin/nimsuggest" ("--refresh" "--epc" "/tmp/scratch.nim")
  (let ((mngr (epc:start-server server-prog server-args))) (epc:init-epc-layer mngr) mngr)          
  epc:start-epc("/home/arne/proj/nim/Nim/bin/nimsuggest" ("--refresh" "--epc" "/tmp/scratch.nim"))  
  (let ((new-epc (epc:start-epc nimsuggest-path (nimsuggest-get-options file)))) (nim-log "nimsugges
  (or (let ((old-epc (cdr (assoc file nimsuggest--epc-processes-alist)))) (if (eq 'run (epc:manager-
  (let ((file buffer-file-name)) (or (let ((old-epc (cdr (assoc file nimsuggest--epc-processes-alist
  nimsuggest--find-or-create-epc()                                                                  
  (epc:call-deferred (nimsuggest--find-or-create-epc) (prog1 method (nim-log "EPC-1 %S" (symbol-name
  (setq it (epc:call-deferred (nimsuggest--find-or-create-epc) (prog1 method (nim-log "EPC-1 %S" (sy
  (let (it) (setq it (epc:call-deferred (nimsuggest--find-or-create-epc) (prog1 method (nim-log "EPC
  (let ((temp-dirty-file (nimsuggest--save-buffer-temporarly)) (buf (current-buffer))) (let (it) (se
  (progn (let ((temp-dirty-file (nimsuggest--save-buffer-temporarly)) (buf (current-buffer))) (let (
  (if (nimsuggest-available-p) (progn (let ((temp-dirty-file (nimsuggest--save-buffer-temporarly)) (
  nimsuggest--call-epc(dus nimsuggest-eldoc--update)                                                
  (save-excursion (nimsuggest-eldoc--move) (nim-log "ELDOC-1") (nimsuggest--call-epc 'dus 'nimsugges
  nimsuggest-eldoc--call()                                                                          
  (if (nimsuggest-eldoc--same-try-p) nil (nimsuggest-eldoc--call))                                  
  (progn (if (nimsuggest-eldoc--same-try-p) nil (nimsuggest-eldoc--call)) (if (eq (line-number-at-po
  (if (nimsuggest-available-p) (progn (if (nimsuggest-eldoc--same-try-p) nil (nimsuggest-eldoc--call
  nimsuggest-eldoc--nimsuggest()                                                                    
  funcall(nimsuggest-eldoc--nimsuggest)                                                             
  (if (nim-inside-pragma-p) (nim-eldoc--pragma-at-point) (funcall nimsuggest-eldoc-function))       
  (progn (if (nim-inside-pragma-p) (nim-eldoc--pragma-at-point) (funcall nimsuggest-eldoc-function))
  (if (nim-eldoc--try-p) (progn (if (nim-inside-pragma-p) (nim-eldoc--pragma-at-point) (funcall nims
  nim-eldoc-function()                                                                              
  apply(nim-eldoc-function nil)                                                                     
  #f(advice-wrapper :before-until #f(compiled-function (&rest args) #<bytecode 0x11a8e0d>) nim-eldoc
  eldoc-print-current-symbol-info()                                                                 
  #f(compiled-function () #<bytecode 0x280fc7>)()                                                   
  apply(#f(compiled-function () #<bytecode 0x280fc7>) nil)                                          
  timer-event-handler([t 0 0 500000 nil #f(compiled-function () #<bytecode 0x280fc7>) nil idle 0])  

This is in the content of the epc buffer:

Error: unhandled exception: Cannot find Nim standard library: Nim compiler not in PATH [IOError]

Process epc:server:3 exited abnormally with code 1
yuutayamada commented 5 years ago

do you have minimum configuration to make this happens?

yuutayamada commented 5 years ago

never mind, I could reproduce.

krux02 commented 5 years ago

thanks