Notes /

How to Use Emacs, an Excellent Clojure Editor

These are my notes on the book Clojure for the Brave and True

I didnt use this chapter to get my Emacs editor set up since I just use Doom and am learning Emacs seperately by reading the book Mastering Emacs. Instead I installed Cider by uncommenting the clojure language in my init.el Doom configuration file. I also added (setq org-babel-clojure-backend 'cider) to my config.el file.

After that I was able to get the REPL up and running by running M-x cider-jack-in

A Cornucopia of Useful Key Bindings

ShortcutEffect
C-x C-ecider-eval-last-expression
C-c M-n M-nSet the namespace to the namespace listed at the top of the current file.
C-c C-kCompile the current file within the REPL session.
C-↑ / C-↓Cycle through the REPL history
C-enterAt the REPL prompt complete an incomplete command
C-c C-d C-dDisplay documentation for the symbol under point
M-. and M-,Navigate to source code for symbol under point and return to your original buffer.
C-c C-d C-aApropros search; find arbitrary text across function names and documentation.

How to Handle Errors

  • You can close the cider error buffer by pressing q
  • The stack trace can be filtered

Paredit

  • This is the minor-mode that lets Emacs automatically just
  • You can turn off the mode by running M-x paredit-mode
  • There are a whole bunch of paredit shortcuts that help you adjust parentheses, M-( surrounds an expression with parentheses, and C-→ and C-←, slurp and barf respectively

Next Chapter: Do Things: A Clojure Crash Course

Related Notes

Contact

Content is copyrighted 2019-2020 © D.S. Chapman. This site was built using GatsbyJS. Code for this website is open source and available on Github