nim-lang / nim-mode

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

Error running nimsuggest on startup #251

Closed bbbscarter closed 10 months ago

bbbscarter commented 10 months ago

Conforming Bugs

Please tell us below:

And describe your problem:

Running nimsuggest-mode immediately throws the following error:

Debugger entered--Lisp error: (invalid-function ((lambda nil (lwarn 'nim :debug "nimsuggest-mode started"))))
  ((lambda nil (lwarn 'nim :debug "nimsuggest-mode started")))((lambda nil (lwarn 'nim :debug "nimsuggest-mode started")))
  nim-log("nimsuggest-mode started")
  nimsuggest-ensure()
  nimsuggest-mode(t)

This doesn't happen when the functions are re-evaluated locally. As such, I think this is because nim-log and nim-log-err aren't byte-compiling properly. Re-defining them as below fixes the problem, and simplifies them somewhat:

(cl-defun nim-log (&rest msg-and-rest)
   (apply #'lwarn 'nim :debug msg-and-rest))

(cl-defun nim-log-err (&rest msg-and-rest)
   (apply #'lwarn 'nim :error msg-and-rest))