cider

prnc 2025-03-23T15:34:31.137879Z

👋 I’m trying out mise (https://mise.jdx.dev/) for a bunch of things, e.g. setting java version per project—does anyone know how to get it to work w/ Emacs + CIDER for cider-jack-in-clj etc.?

prnc 2025-03-23T15:35:30.403289Z

I’m running mise in a terminal outsider of emacs—one of the things that mise seems to to in this case is to set JAVA_HOME, which is fine if I start the REPL from the terminal and connect or start emacs from the terminal

prnc 2025-03-23T15:36:07.845079Z

I’ve not found a great way to get that picked up semi-automatically form within running emacs session

prnc 2025-03-23T15:37:13.611929Z

I can ofc: • echo $JAVA_HOME | pbcopy • and in emacs (setenv "JAVA_HOME" …) which seems to work but wondering if anyone knows / can think of a better way?

prnc 2025-03-23T15:37:46.328199Z

(BTW there seems to be mise emacs package but doesn’t seem to work or need to dig deeper to try to actually understand it 🤷)

codeasone 2025-03-28T10:47:07.710739Z

I've been using mise with Emacs under Linux (run at startup via emacs --daemon) for a while now without issues. By way of example, here's the stack for one of the projects I'm working on, using Emacs for all of the various dev(ops) workflows:

awscli 2.14.5
clojure 1.11.1.1273
java temurin-17.0.9+9
nodejs 18.16.0
terraform 1.5.4
babashka 1.12.196
A couple of observations/tips that may or may not be relevant to the particular issues you've been having: Ensure you are including: eval "$(/usr/bin/mise activate zsh --shims)" at the end of your .zshrc (or equivalent). And are you using exec-path-from-shell package in Emacs? Here's what I have configured:
(use-package exec-path-from-shell
  :ensure t
  :demand t
  :custom (exec-path-from-shell-variables
           '(...
             "JAVA_HOME"
             "JAVA_OPTS"
             "PATH"
             ...
             ))

  :config
  (exec-path-from-shell-initialize))
That will probably help things along. Finally, in case it's relevant to the specifics above, I launch Emacs throughout the day via the following desktop entry:
[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/usr/bin/bash --login -c "cd /usr/local/bin && emacsclient --alternate-editor= --create-frame"
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs
Keywords=Text;Editor;
I don't use any dedicated mise packages within my Emacs config and everything just works as one would expect given the .tool-versions specification of the project I happen to be working on.

prnc 2025-03-29T18:09:10.690379Z

@codeasone thanks a lot for detailing your setup, will try out mise again tomorrow with your pointers, maybe will have better luck 😉

Krishnansh Agarwal 2025-03-23T18:32:36.438559Z

I have a doubt, so I am in a project, and I have a namespsace cson.cson which is src/cson/cson.clj and a namespace cson.parse which is src/cson/parse.clj but the namespace in nRepl is user shall I need to switch it? switch it to waht? how can I use functions of the namespace in cson.cson and cson.parse in the repl?

Krishnansh Agarwal 2025-03-23T19:13:42.412649Z

again I get a similar error, I inserted line 15 in repl, but when I evaluate it, I get error

Harold 2025-03-23T20:10:39.294569Z

C-c M-n M-n runs the command cider-repl-set-ns (found in cider-mode-map), which
is an interactive native-compiled Lisp function in 'cider-repl.el'.

It is bound to C-c M-n n and C-c M-n M-n.

(cider-repl-set-ns NS)

Switch the namespace of the REPL buffer to NS.
If called from a cljc buffer act on both the Clojure and ClojureScript REPL
if there are more than one REPL present.  If invoked in a REPL buffer the
command will prompt for the name of the namespace to switch to.

Harold 2025-03-23T20:11:26.743959Z

You could also try:

user> (in-ns 'main)
#namespace[main]
main> 

Harold 2025-03-23T20:12:13.055269Z

The vars live in namespaces, and in order to access them you need to either be in the namespace they're in, or refer to them by their namespace. hth

✅ 1
Krishnansh Agarwal 2025-03-24T05:01:14.163259Z

So basically I have to load the namespace in the nRepl

Krishnansh Agarwal 2025-03-24T05:01:30.697589Z

so if I have 3 namespaces, and I want to test their functions, I have to always load them before trying them out

yuhan 2025-03-24T05:31:50.652159Z

You could also try using "rich comment forms" directly in the source file and evaluating them there without touching the REPL buffer

Krishnansh Agarwal 2025-03-24T07:28:35.072869Z

I see, okay