Cider

Wait, do you want to choose a alias with cider?

code clojure cider

Another thing you may want/need is to use an alias when connecting cider. I know that cider can have that set up on your configuration. You can use .dir-locals.el to set up per project but I personally prefer to be able to choose when connecting.

(defun start-cider-repl-with-lein-profile ()
   (interactive)
   (letrec ((profile (read-string "Enter profile name: "))
          (lein-params (concat "with-profile +" profile " repl :headless :host localhost")))
     (message "lein-params set to: %s" lein-params)
     (set-variable 'cider-lein-parameters lein-params)
     (cider-jack-in '())))

 (defun start-cider-repl-with-cli-profile ()
   (interactive)
   (letrec ((profile (read-string "Enter profile name: "))
          (cli-params (concat "-A:" profile)))
     (message "cli-params set to: %s" cli-params)
     (set-variable 'cider-clojure-cli-aliases cli-params)
     (cider-jack-in '())))

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Wait, do you want to choose a alias with cider?

Running repl commands in cider (emacs)

code clojure emacs cider

Ok, I will admit.. this took a while. But I have found a nice way of doing this.

What is this? Well, let’s say that you have a command to start your server in user namespace. With this cool feature, now you can run this with a emacs command (or shortcut if you bind it).

The cool thing about this is that the command will run with the namespace from the repl and not the last ns that you loaded with cider =].

Here is a taste:

(defun le2m/cool-repl-command ()
 (interactive)
 (cider-interactive-eval
  (cider-insert-in-repl (format "(clojure.core/require 'a-namespace)
                                  (a-namespace/do-something
                                  (fn lambda-example [t] (:get-a-key (meta t))))") 't)))

  1. stackoverflow reference that started this

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Running repl commands in cider (emacs)

Fix incanters core.view in dwm

clojure cider dwm

Now, let’s face it. dwm is awesome. But sometimes, it needs adjustments. If you are using incanter and cannot see a plot with core.view function in a cider enviroment, all you have to do is export this variable into your enviroment before firing up cider.

export _JAVA_AWT_WM_NONREPARENTING=1

/comments ~lucasemmoreira/opinions@lists.sr.ht?Subject=Re: Fix incanters core.view in dwm