Fork me on GitHub

@eggsyntax I've always used hooks to add key mappings or load other things into a layer once its loaded.. Not sure if that makes it any easier. You still need to know the right mode to hook into 🙂 For example, I use the following to set my own tab spacess for editing HTML code

(defun jr0cket-web-mode-indent-hook ()
    "Indent settings for languages in Web mode, markup=html, css=css, code=javascript/php/etc."
    (setq web-mode-markup-indent-offset 2)
    (setq web-mode-css-indent-offset  2)
    (setq web-mode-code-indent-offset 2))

  (add-hook 'web-mode-hook  'jr0cket-web-mode-indent-hook)


Ah, yeah, interesting, I've seen hooks but never tried to write any. Cool, I'll give it a shot, thanks @jr0cket!


@eggsyntax This example might be more relevant to what you were doing

(add-hook 'cider-repl-mode-hook
            '(lambda ()
               (define-key cider-repl-mode-map (kbd "<up>") 'cider-repl-previous-input)
               (define-key cider-repl-mode-map (kbd "<down>") 'cider-repl-next-input)))
There are many examples of hooks in my dotspacemacs/user-config section of my .spacemacs file. Just search for add-hook


Hey, that works! I guess that runs later than the lib code. Thanks @jr0cket, that's a big help! And actually I've had trouble with up/down for prev/next input, too, so it's a nice bonus that this makes those work too 🙂


Hooks run after a layer or mode is loaded into memory, so they should be the last thing to run. So in the previous example, hooks won't load until after the reply mode does.


Perfect 🙂


Wow, emacs just managed to crash my whole system (ubuntu 18.04). I'm impressed?


I've never had a crash of the OS from Spacemacs. I had Emacs hang on a process before, but very rarely. Are you sure it was Emacs?


No, I just figured out I was misinterpreting the role of files in /var/crash/. emacs did crash, but it may have been part of the broader system crash. I'm still learning how to figure out the causes of linux system crashes...

😀 4

I retract the above, it was totally wrong AFAICT. I apologize for my libel 😉


guys, can you help with refactror-nrepl? i have this in .lein/profiles.clj

{:user {:plugins [[refactor-nrepl "2.3.1"]
                  [cider/cider-nrepl "0.17.0-SNAPSHOT" :exclusions [org.clojure/tools.nrepl]]]}}
when run lein repl I always get this:
Error loading refactor-nrepl.middleware: Could not locate cider/nrepl/middleware/util/misc__init.class or cider/nrepl/middleware/util/misc.clj on classpath., compiling:(refactor_nrepl/middleware.clj:1:1)
Exception in thread "main" java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context, compiling:(/private/var/folders/dd/yjt452yn0zs1hs4_sd077rsm0000gn/T/form-init8768462867645520700.clj:1:8336)
	at clojure.lang.Compiler.analyzeSeq(
	at clojure.lang.Compiler.analyze(
	at clojure.lang.Compiler.analyze(
	at clojure.lang.Compiler$InvokeExpr.parse(
	at clojure.lang.Compiler.analyzeSeq(
	at clojure.lang.Compiler.analyze(
	at clojure.lang.AFn.applyToHelper(
	at clojure.lang.Var.applyTo(
	at clojure.main.main(
Caused by: java.lang.RuntimeException: Unable to resolve var: refactor-nrepl.middleware/wrap-refactor in this context
	at clojure.lang.Util.runtimeException(
	at clojure.lang.Compiler$TheVarExpr$Parser.parse(
	at clojure.lang.Compiler.analyzeSeq(


@rustam.gilaztdinov for current versions of spacemacs & cider, you shouldn't need to put either of those in your profiles; they should both be automatically loaded by CIDER. At least that's my understanding, and I don't have either of them in my profiles. There are def old tutorials floating around that tell you to add those, but to the best of my understanding they're outdated.


Hmm, although you may need [cider/cider-nrepl "0.17.0"] in your project's project.clj.


(in which case having it in your profiles instead should also work fine. So...I retract that part, but I think you def don't need to explicitly specify refactor-nrepl anywhere).


hmm, so I should add

:profiles {:dev {:dependencies [[cider/cider-nrepl "0.17.0"]]
                   :plugins [[refactor-nrepl "2.3.1"]]
in project.clj ?


this doesn't help(


may you share your env for work with refactor?


I don't have refactor-nrepl anywhere in my ~/.lein/profiles.clj or my project's project.clj. I have cider-nrepl in my project's project.clj.


The CIDER docs recommend you define cider-nrepl as a plugin rather than a dependency in your project.clj

:plugins [[cider/cider-nrepl "0.17.0"]]
By adding cider-nrepl as a dependency then that library will be included in the jar or uberjar you create when deploying. Not a big issue, but its more classes to load when your application first runs.


(as a dependency, not a plugin).


Here, I'll post both (but they're very, very messy 😉 ):


I'll PM them since I can't put a snippet in a thread.


@rustam.gilaztdinov if you use cider-jack-in from Spacemace then you can simply remove the ~/.lein/profiles.clj file, it is not needed. If you use cider-connect instead, then you will need a profiles file as defined in


For Leiningen, the ~/.lein/profies.clj would just contain

{:repl {:plugins [[cider/cider-nrepl "0.17.0"]]}}