4

In Emacs/Cider, how do I correctly add some clojure libraries that I want to try?

If I do it from the shell, I just start

$ lein try clj-time

But how do I do that from the Emacs/Cider?

Charles
  • 50,943
  • 13
  • 104
  • 142
Igor Chubin
  • 61,765
  • 13
  • 122
  • 144
  • The answer by @liwp below gives a reasonable answer to your question, as written. As such, I think it deserves to be accepted. You said you would update the question (but have not yet done so). In any case, moving the goal-posts, so to speak, isn't really fair to people who take the time to answer a question. – David J. Nov 17 '14 at 06:09
  • @DavidJames: David, what do you mean with "moving the goal-posts"? – Igor Chubin Nov 17 '14 at 09:44
  • From Wikipedia: "The figurative use alludes to the perceived unfairness in changing the goal one is trying to achieve after the process one is engaged in (e.g. a game of football) has already started." In short, you aren't being fair to liwp who gave a good answer to your question, as originally stated. In my opinion, if someone gives a good answer to a question as written, it should be accepted. If you aren't willing to do that, at least update your question. That way others can use it as a reference to help in the future. – David J. Nov 19 '14 at 03:32
  • 1
    @DavidJames: I didn't change the answer. My question was: "how can I try a new module when I'm already in cider", and the question is still that – Igor Chubin Nov 19 '14 at 07:54
  • If you don't like liwp's answer, then I'd suggest adding a clarification to your question (perhaps saying that you want to solve your problem without leaving Emacs at all -- which by the way, is not an obvious interpretation of your question as currently worded) *and* adding the best answer you've found so far, even if the 'best' answer is "This is not currently possible with `lein try`. Currently, this question is interesting but unresolved. – David J. Nov 19 '14 at 13:47
  • Have you looked at the source code of Cider? Have you tried writing a custom function to start a new REPL with the library you want and then automatically jack-in? I think this will help get a better answer to your question. – David J. Nov 19 '14 at 13:52
  • @DavidJames: I've tried to use Pomegranate, I think that was a good idea, but didn't complete it because Pomegranate doesn't support proxy server correctly (and I do need proxy in my environment). It's another topic of course, but I just want to clarify why my experiment stopped – Igor Chubin Nov 19 '14 at 14:52

1 Answers1

1

The easiest way is to run lein try clj-time on the command line and then connect to that repl from emacs with M-x cider (use localhost and the port number printed to the console when you started lein-try).

liwp
  • 6,746
  • 1
  • 27
  • 39
  • 1
    That is an obious solution, but that is not what I mean. I want to "try" different modules in an already running session without restarting it each time when I want to try another module. Anyway, thank you for the answer. I've got some interesting hints on the #clojure channel yesterday, but that is not a final answer. I will update my question soon. Once again, thank you for the answer – Igor Chubin Apr 16 '14 at 07:26
  • 1
    If you want to load new libraries into an already running repl you could try Pomegranate (https://github.com/cemerick/pomegranate). – liwp Apr 16 '14 at 10:49
  • Yes, I know this, I have got this answer yesterday on the #clojure channel, but there are other problem there. I will update my question – Igor Chubin Apr 16 '14 at 10:56