Fork me on GitHub
#cider
<
2024-01-02
>
borkdude12:01:26

why does cider-pprint-eval-last-sexp need clj-refactor to be installed (emacs)?

vemv12:01:54

Fairly sure it doesn't

borkdude12:01:24

I uninstalled clj-refactor.el for reasons and this stopped working

vemv12:01:18

Well, it's not the case, you could try removing .elc files, else feel free to create an issue

borkdude12:01:29

ok will do, thanks

vemv12:01:19

You can also use the *nrepl-log* to see whether it's a timeout, error, absence of request etc

borkdude12:01:50

I think something weird may be going on with .elc files as you were suggesting, now after a restart and installing clj-refactor, it's complaining about a missing clojure-mode-map variable

vemv12:01:46

Doesn't ring a bell. Although it's a good idea to check that clojure-mode is latest stable

borkdude12:01:53

Ah, perhaps my setup was loading clj-refactor before which loaded clojure-mode before it ran:

(define-key clojure-mode-map (kbd "M-.") #'find-definition)

borkdude12:01:42

something like that seems to be happening. When loading clojure-mode manually, I'm getting:

Symbol's function definition is void: cider-register-cljs-repl-type

vemv12:01:32

Maybe you can perform the define-key within a *-mode-hook?

borkdude12:01:55

Perhaps. Just adding (require 'cider) seemed to fixed this

👍 1
vemv12:01:03

Nice. If you start Emacs many times a day, require can be expensive

borkdude12:01:33

Ah I had this:

(defun my-clojure-mode-hook ()
  (clj-refactor-mode 1)
  (yas-minor-mode 1) ; for adding require/use/import statements
  ;; This choice of keybinding leaves cider-macroexpand-1 unbound
  (cljr-add-keybindings-with-prefix "C-c C-m"))
so I needed to comment out clj-refactor-mode

borkdude12:01:26

yeah I guess I should refactor my stuff to use use-package or so, never went through that trouble and accumulated years of junk in my emacs setup haha

emacs-spin 1
borkdude12:01:42

happy new year 🍺

vemv12:01:02

HNY! 🙌

borkdude13:01:51

It seems when I use cider-jack-in with clojure-cli my .dir-locals.el is sometimes not respected. I don't start the REPL from the top of the project, but inside one of the test files. Any hints/tips?

borkdude13:01:19

Even when I use cider-jack-in from the top of the project, I see:

[nREPL] Starting server via /opt/homebrew/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.0.0\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.44.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[cider.nrepl/cider-middleware\]\"\]\}\}\} -M:cider/nrepl
My .dir-locals.el has:
((clojure-mode
  (cider-clojure-cli-aliases . ":repl:test")))

borkdude13:01:48

After running this:

(defun my-reload-dir-locals-for-current-buffer ()
  "reload dir locals for the current buffer"
  (interactive)
  (let ((enable-local-variables :all))
    (hack-dir-local-variables-non-file-buffer)))
and jacking in again, it works. Maybe my .dir-locals.el isn't read somehow?

borkdude13:01:02

somehow now it works, but sometimes it doesn't. I guess it's Monday although it's Tuesday :)

vemv13:01:32

I'd suggest running M-: cider-clojure-cli-aliases and check its value CIDER does nothing special/specific with .dir-locals.el, most likely that mechanism didn't do its job for whatever reason

👍 1
practicalli-johnny20:01:10

If changes are made to a .dir-locals.el then the current buffer must be reloaded before calling cider-jack-in command. If switching to a buffer that was already opened, that buffer will not have the .dir-locals el changes until it has been reloaded (or reopened)

borkdude20:01:19

yeah I know that

borkdude20:01:44

but somehow it's not always picked up, even when I visit the project the first time. it does work when I run that reload function above

vemv21:01:00

You could advice-add cider-jack-in (and friends) such that it always runs your defun

💡 1