clojure-emacs / clomacs

Simplifies Emacs Lisp interaction with Clojure and vice versa.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

void variable clomacs--doc

Ninlives opened this issue · comments

every time when I eval (require 'clomacs) it shows
Debugger entered--Lisp error: (void-variable clomacs--doc)

Emacs version:24.5
OS:windows 10(does this matter?)

How did you install it (via MELPA or manually)? Is it the last version of clomacs? Could you paste full error trace please (M-x toggle-debug-on-error).

via MELPA, I guess it means the latest version? the full error trace is
Debugger entered--Lisp error: (void-variable clomacs--doc) #[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"]() funcall(#[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"]) mapc(funcall (#[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"])) do-after-load-evaluation("c:/Users/Eleven/.emacs.d/elpa/clomacs-20160513.153/clomacs.elc") require(clomacs) eval((require (quote clomacs)) nil) eval-last-sexp-1(nil) #[257 "�\204�\303�!\207 �\303�!\n)B\211A =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422004 "P"](nil) #[(&rest _it) "� !\211�\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2]() eval-sexp-fu-flash-doit-simple(#[(&rest _it) "� !\211�\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 19)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 19)) (quote #<buffer *scratch*>) args))) eval-sexp-fu-flash-doit(#[(&rest _it) "� !\211�\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 19)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 19)) (quote #<buffer *scratch*>) args))) esf-flash-doit(#[(&rest _it) "� !\211�\207" [ad--addoit-function eval-last-sexp-arg-internal ad-return-value] 2] (closure (t) (&rest args) (apply (quote esf-hl-highlight-bounds) (quote (1 . 19)) (quote eval-sexp-fu-flash) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-hl-unhighlight-bounds) (quote (1 . 19)) (quote #<buffer *scratch*>) args)) (closure (t) (&rest args) (apply (quote esf-flash-error-bounds) (quote (1 . 19)) (quote #<buffer *scratch*>) (quote eval-sexp-fu-flash-error) args))) ad-Advice-eval-last-sexp(#[257 "�\204�\303�!\207 �\303�!\n)B\211A =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422004 "P"] nil) apply(ad-Advice-eval-last-sexp #[257 "�\204�\303�!\207 �\303�!\n)B\211A =\204�\211A�\211@\207" [eval-expression-debug-on-error eval-last-sexp-fake-value debug-on-error eval-last-sexp-1] 4 2422004 "P"] nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)

Sorry for such a mess I don't know how to deal with it...

Looks like we clashed here with another third-party package. You can try to reproduce it with emacs -Q. From the other side, we can try to make Elisp interpreter happy. Please, try the last commit of clomacs.

Sorry but the latest commit report the same error on my emacs....
tried to start emacs -Q and just load the required packages, this is the error trace
Debugger entered--Lisp error: (void-variable clomacs--doc) #[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"]() funcall(#[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"]) mapc(funcall (#[0 "\302 \210\303� \304\305$\210\306\307\310\"\207" [clomacs--doc clojure\.repl/doc clomacs-highlight-initialize clomacs-defun :return-value :stdout defalias clomacs-doc #[257 "\300 \205�\301�!\207" [clomacs-get-connection clomacs--doc] 3 "\n\n(fn X)"]] 5 "\n\n(fn)"])) do-after-load-evaluation("c:/Users/Eleven/.emacs.d/elpa/clomacs-20160513.153/clomacs.elc") require(clomacs) eval((require (quote clomacs)) nil) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)

By the way, is it neccessary to start individual server for every library? I mean, I'm new to clojure so I 'm just asking, because starting a new server do take few seconds :-)

added (defvar clomacs--doc) at the beginning of the clomacs.el seems to solve the problem, don't know if this would cause other issues..

changed

(eval-after-load "clomacs"
  '(progn
     (clomacs-highlight-initialize)

     (defvar clomacs--doc)

     ;; Should be last `clomacs-defun'
     (clomacs-defun clomacs--doc
                    clojure.repl/doc
                    :return-value :stdout)

     (defun clomacs-doc (x)
       (if (clomacs-get-connection)
           (clomacs--doc x)))))

to

(eval-after-load "clomacs"
  (lambda()
     (clomacs-highlight-initialize)

     (defvar clomacs--doc)

     ;; Should be last `clomacs-defun'
     (clomacs-defun clomacs--doc
                    clojure.repl/doc
                    :return-value :stdout)

     (defun clomacs-doc (x)
       (if (clomacs-get-connection)
           (clomacs--doc x)))))

also works.

Maybe something wrong with the eval-after-load function call?

Ok I think I got it. I removed the clomacs.elc file and restart emacs, everything works fine. I think it is because the clomacs--doc is defined in a quoted list,so when the file was byte-compiled the information was lost. You may try to byte-compile your source file to see if you could reproduce the issue. Hope this will help.

Ok, let's unquote eval-after-load contents here to troubleshooting future installation problems.

By the way, is it neccessary to start individual server for every library? I mean, I'm new to clojure so I 'm just asking, because starting a new server do take few seconds :-)

The first version of clomacs behaves exactly in this way. I thought that clomacs user can use any nREPL server. This solution has some problems:

  1. You should have a way to load all required jar* dependencies. This means you should have a way to load com.cemerick/pomegranate. You can't do any assumptions about current nREPL process. So, I loaded all required libraries manually. That is definitely ugly (see this code: ). For more details see clomacs 0.0.1 version last commit: https://github.com/clojure-emacs/clomacs/tree/752bba96a434d721681a2448c8345b968273859e
  2. If you have to load different versions of libraries for different extensions (in that times I believed we'll have many of them :)) you will get a problem.
  3. If you terminate you experimental nREPL process, you will lose process associated with (probably stable) Emacs mixed Elisp-Clojure extension.

So, finally I've decided to be close to CIDER as much as possible and keep one nREPL with all associated Clojure/Java code for every extension.

I have no success with reproducing of this problem (so far), but can I consider the problem solved with last commit?

Hmm..weired, still have so much to learn about elisp.
I think the safest way is to add a declaration at the beginning.
Anyway, thanks for the quick response :)

Sorry, I guess I just forgot to remove the (defvar clomacs--doc) in my .emacs file when I test the code.
The quoted list doesn't matter, but byte-compile the file do have some influence. And add a declaration of clomacs--doc can still fix the issue.
Apologize for any confusion I may have made. And thanks for your answer to my question.

I still see this issue. I installed ejc-sql in spacemacs and it failed with a compilation error -- ejc-interaction.el:23:1 Error: Symbol's value as variable is void: clomacs--doc