Fix focus behavior in CIDER mode for Emacs

Today I’ve fine tuned my Emacs setup which hasn’t evolved for a while. Digging into emacs24 packages, testing rainbow-delimiters, customizing company-mode, etc. As a Clojure beginner, I’m discovering joy of programming lisp-languages within my favorite $EDITORas well.

Then I’ve played with CIDER, a Clojure IDE and REPL for Emacs. As expected you can benefit form REPL model directly, plus many additional features, such as stacktraces analysis. One of my favorite feature is to get shortcut (C-c C-d in my case) to display the documentation and signature of an input function.

Any reason to change buffer’s focus when displaying documentation?

The problem is that CIDER always decides to automatically move the focus to the attached buffer. This leads into boring keyboard combinations to switch back to the original buffer, even smart shortcuts such as C-<up> don’t satisfy myself. There are configuration options to annihilate this behavior when throwing an error or the REPL prompts, but I didn't find anything to avoid this when accessing the documentation.

And here comes the patch! If you’re annoyed by this behavior, feel free to patch your setup:

Of course, you may create your own variable to customize focus strategy, but I’ve never seen a very long documentation which could justify moving focus to another buffer.



Engineering Leader | Author on Decision-Making.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store