Hot answers tagged

8

In my case it was using a few old packages. The easiest way was to just upgrade all the packages. I was using the default download from the book Clojure for the Brave and True. Steps (within Emacs): M-x list-packages will list all packages U will mark all packages to be updated x will perform all the updates. You need to ...


6

Yes. C-u C-x C-e eval-last-sexp-and-insert , evaluates the last sexp and inserts it at point. or: in the cider-eval menu : eval-last-sexp-and-pretty-print-comment insert the output as a comment in the following line like so: (def xx {:a "a" :b "b"}) ;; => #'ns-name.playground/xx (:a xx) ;; => "a" (:c xx "nothing") ;; => "nothing"


5

Commit 70971d0a918053d86e76e4ff8248b25a8646940e removed support for emacs 24.3 and below. This removed a file called cider-compat.el and replaced it with an emacs core file subr-x.el Supposedly this allowed the if-let macro to be from subr-x.el, with the thinking being that this file stayed the same from 24.4+ to 25+. It seems like the if-let macros did not ...


5

For anyone who is still stumbling onto this error, I just managed to fix mine. The problem arises when trying to update the packages that are found in the emacs configuration for the Clojure for the Brave and True book. My guess is that something in the customization files makes emacs compile the packages wrong. What I did: First of all, the config file ...


4

No (evil-mode) called non-interactively does not toggle. It unconditionally switches evil-mode on. You have to call (evil-mode -1) in your program to switch evil-mode off. See the doc of define-minor-mode: The toggle command takes one optional (prefix) argument. If called interactively with no argument it toggles the mode on or off. A positive prefix ...


3

Do you have clojure mode installed? Try M-x install-package clojure-mode if not and then run cider-jack-in.


3

C-M-x does the right thing in Clojure buffers for me after spawning a REPL. To look up what command is bound to it, use F1 k <key sequence> and you'd find out that it's cider-eval-defun-at-point.


3

The normal way to do this within a session is to record the actions as a keyboard macro, and then bind that macro to a key. You can also save the macro and binding to a file to use it across sessions. The details are provided in the Emacs manual.


2

there is an option to run all the tests in all the projects namespaces M-x cider-test-run-project-tests or C-c C-t C-p Here is the link to additional options for running tests http://cider.readthedocs.org/en/latest/extended_workflow/#running-tests


2

First follow these instructions on the Readme so that boot knows about CIDER. Boot users can configure the tool to include the middleware automatically in all of their projects using a ~/.boot/profile.boot file like so: (require 'boot.repl) (swap! boot.repl/*default-dependencies* concat '[[cider/cider-nrepl "0.9.1"]]) (swap! boot.repl/*default-...


2

Although this is not pristine elisp, the following should work. (defun my-cider-eval-paragraph () (interactive) (save-excursion (mark-paragraph) (command-execute 'cider-eval-region))) Note this is exactly what you wrote, except the macro is called saVe-excursion.


2

Sometimes we want to find something in our clojure codebase that isn't readily at point (point is the emacs term for the location of your cursor). What is at point is the default that the command will search for. What you are thinking of as "confirmation" is an opportunity to enter a different var to search for from that which is at point. This same ...


2

I don't use cider, but looking at some of the documentation it looks like: You can customize cider-prompt-for-symbol to set the default behavior for prompts. When calling cider-find-var you can use a prefix argument to invert the default prompt behavior. So it sounds like you could use M-x customize-option cider-prompt-for-symbol to change the default ...


2

You should be able to add cider--debug-mode to the evil-insert-state-modes list so that you automatically enter insert state when the debugger is triggered. I tried the following but it doesn't work. (add-to-list 'evil-insert-state-modes 'cider--debug-mode) I haven't dug into why this isn't working, but for the time being I'm using the cider--debug-mode-...


2

Projectile provides a projectile-toggle-between-implementation-and-test function with exactly this behavior. As stated in the docs, you can use C-c p t to "Toggle between an implementation file and its test file."


2

Here's an actual solution to the problem you've encountered: (defun my-cider-debug-setup () (evil-make-overriding-map cider--debug-mode-map 'normal) (evil-normalize-keymaps)) (add-hook 'cider--debug-mode-hook 'my-cider-debug-setup) It will make debug keys work with CIDER while not disabling Evil.


2

You have bound an imaginary command: reolad-and-eval-in-repl. Your command is named reload-and-eval-in-repl.


1

You can use with-out-str to capture the output into a string. user> (with-out-str (print "foo")) "foo" Knowing that you can take the cider-pprint-eval-last-sexp-to-comment function, copy/paste it and make a small change. (define-key cider-mode-map (kbd "C-c C-p") (lambda () (interactive) (let* ((insert-...


1

Try M-x cider-connect if you've already started a REPL via leiningen yourself. cider-jack-in tries to start a repl-server and connect to it. For some reason, this fails, maybe because of the already running REPL, so you might try cider-jack-in without starting a REPL manually first.


1

There is a detailed comparison of the different cljs repls to date in lambdaisland Borrowing from this rich and reputable source here is the bits of code you need to have configured for running weasel: Server (Clojure) (cljs.repl/repl (weasel.repl.websocket/repl-env :ip "0.0.0.0" :port 9001)) Client (ClojureScript) (ns main (:require [weasel.repl :as ...


1

Since you provide :file "ob-clojure-literate.png", when you execute the code block, Org will insert the result into the file, thus overwrite your image. I learnt about this by stepping through the function org-babel-execute-src-block. BTW, your advice function is working as expected, you can confirm that via the command org-babel-expand-src-block.


1

To get the result of the last sexp in a block use the following argument in the header: :results value pp. To evaluate using cider withing the code block, bind cider-eval-last-sexp within org in your .emacs as follows: (org-defkey org-mode-map "\C-x\C-e" 'cider-eval-last-sexp) further more for documenation use: (org-defkey org-mode-map "\C-c\C-d" 'cider-...


1

Working with old .emacs.d stuff is too tiring. I've started working with Prelude. It is developed by the maintainer of CIDER and clojure-mode.


1

It seems that your package archive metadata is corrupted. Try renaming your .emacs.d temporally and re-run with your init.el. mv ~/.emacs.d ~/.emacs.d-tmp; emacs -Q -l path/to/init.el I can setup successfully with your init.el pasted above (replacing last defvar with package-install).


1

Outside of Cider, there is toggle-test, which can switch between source and test buffers in a language agnostic way.


1

Just found out you can use set-key-for-mode. Seems to be just what I wanted. (evil-leader/set-key-for-mode 'clojure-mode "." 'cider-find-dwim "," 'cider-pop-back "<SPC>j" 'cider-jack-in "<SPC&...


1

Have you tried the already defined shortcut? C-c M-e It evaluates the form preceding point and outputs to REPL buffer. See other cider mode shortcuts here.


1

Just wanted to post an updated version for the answer. You can find all the necessary info about Boot CIDER repl setup here https://github.com/boot-clj/boot/wiki/Cider-REPL . It provides multiple ways to set it up. An important thing to note is boot parameters setup. To make Cider behave as expected. (setq cider-boot-parameters "repl -s wait") Also each ...


1

lispy provides a vi-like experience for LISP dialects, including Clojure. It integrates with CIDER. You can eval the current Clojure expression with e. For instance, starting with this code, with point represented by |, and CIDER already running: |(defn sqr [x] (* x x)) (filter odd? (map sqr [1 2 3 4 5])) e: #'user/sqr je: (1 9 25) fe: (1 4 9 16 25) fe:...


1

Unfortunately there is not a way to do this currently in cider. One would have to write a custom command to evaluate clojure.tests/run-all-tests (or clojure.tests/run-tests with a list of namespaces as arguments).


Only top voted, non community-wiki answers of a minimum length are eligible