notespace icon indicating copy to clipboard operation
notespace copied to clipboard

Notespace assumes any source files will live under `src` directory

Open jonadelson opened this issue 5 years ago • 3 comments

I was trying to make a mixed java/clojure project in which the java files would be under src/main/java and the clojure files would be under src/main/clojure and found that Notespace assumes that any namespaces would be in the src directory. I'm not sure if this is really an issue but was wondering if you recommended some workaround. Also, really love the library!

jonadelson avatar Dec 15 '20 21:12 jonadelson

Hi @jonadelson, thanks!

Following your comment, I now deployed a small change that allows configuring the source base path.

(notespace.api/update-config
  #(assoc % :source-base-path "src/main/clojure"))

should make it work in your case.

Does it seem to work?

daslu avatar Dec 16 '20 00:12 daslu

Thanks for such a quick response! It seems to work, but I did accidentally stumble on one issue.

Everything works fine if I run the following namespace by first evaluating the forms in the comment and then using the notespace/eval-this-notespace emacs command.

(comment
  (notespace.api/init-with-browser)
  (notespace.api/update-config
    #(assoc % :source-base-path "src/main/clojure"))
)

(+ 1 2)

However, the following seems to hang after evaluating the comment forms and running the notespace/eval-this-notespace emacs command.

(comment
  (notespace.api/init-with-browser)
  (notespace.api/update-config
    #(assoc % :source-base-path "src/main/clojure"))
)

(notespace.api/update-config
  #(assoc % :source-base-path "src/main/clojure"))

(+ 1 2)

I'm not sure if this is a legitimate problem or a misunderstanding of the library on my part. Thanks.

jonadelson avatar Dec 16 '20 01:12 jonadelson

Thanks @jonadelson !

In general, notespace API function calls are not recommended to be part of the notespace itself, but rather live inside comments (or be called from the REPL by some other method).

For some of the API functions, this may result in an infinite loop (for example, when the function is trying to evaluate the note that contains itself).

In the case of this function, I am not sure why this hangs. It seems like a good idea to understand that, so let us leave the issue open for now.

daslu avatar Dec 16 '20 20:12 daslu