Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/cftbat/basic-emacs.html
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ <h2>Using Emacs with Clojure</h2>
<p class="BodyFirst">Next, I’ll explain how to use Emacs to efficiently develop a Clojure application. You’ll learn how to start a REPL process that’s connected to Emacs and how to work with Emacs windows. Then I’ll cover a cornucopia of useful key bindings for evaluating expressions, compiling files, and performing other handy tasks. Finally, I’ll show you how to handle Clojure errors and introduce some features of Paredit, an optional minor mode, which is useful for writing and editing code in Lisp-style languages.</p>
<p class="Body">If you want to start digging in to Clojure code, please do skip ahead! You can always return later.</p>
<h3>Fire Up Your REPL!</h3>
<p class="BodyFirst">As you learned in Chapter 1, a REPL allows you to interactively write and run Clojure code. The REPL is a running Clojure program that gives you a prompt and then reads your input, evaluates it, prints the result, and loops back to the prompt. In Chapter 1, you started the REPL in a terminal window with <code>lein repl</code>. In this section, you’ll start a REPL directly in Clojure.</p>
<p class="BodyFirst">As you learned in Chapter 1, a REPL allows you to interactively write and run Clojure code. The REPL is a running Clojure program that gives you a prompt and then reads your input, evaluates it, prints the result, and loops back to the prompt. In Chapter 1, you started the REPL in a terminal window with <code>lein repl</code>. In this section, you’ll start a REPL directly in Emacs.</p>
<p class="Body"><span>To connect Emacs to a REPL, you’ll use the Emacs package</span>CIDER, available at <em><a href="https://github.com/clojure-emacs/cider/">https://github.com/clojure-emacs/cider/</a></em>. If you followed the configuration instructions earlier in this chapter, you should already have it installed, but you can also install it by running <strong>M-x </strong><span class="LiteralBold">package-install</span><span>, entering </span><span class="LiteralBold">cider</span><span>, and pressing </span><span class="Keycap">enter</span><span>.</span></p>
<p class="Body"><span>CIDER allows you to start a REPL within Emacs and provides you with key bindings that allow you to interact with the REPL more efficiently. Go ahead and start a REPL session now. Using Emacs, open the file </span><em>clojure-noob/</em><em>src/clojure_noob/core.clj</em><span>, which you created in Chapter 1. </span><span>Next, use </span><strong>M-x </strong><span class="LiteralBold">cider-jack-in</span><span>. This starts the REPL and creates a new buffer where you can interact with it. After a short wait (it should be less than a minute), you should see something like Figure 2-8.</span></p>
<img src="/assets/images/cftbat/basic-emacs/cider-jack-in.png" />
Expand Down