Font Locking Required Namespaces

May 10, 2017

Description of the bug

This is a walkthrough of what I've done so far to diagnose the bug report for CIDER bug 1985. When we are loading dependencies, external or just other project namespaces, we are losing the font-locking.

(ns stuff.core
  (:require [stuff.other :as other]))

(other/function :foo) ;; is not font-locked

Moving Parts

Continue reading →

Lifecycle Of a Evaluation

April 30, 2017

Lifecycle of a request

I wanted to give a broad overview of the lifecycle of an eval request, from invocation to marking completed. As with any code walkthrough, ultimately every guide will elide details as the only true witness of what will happen is the code itself. That being said, I'm trying to thread a fine line of not drowning in details while still giving a fairly technical overview of the eval mechanism of CIDER.

This is a good system to serve as a walkthrough as this is largely what CIDER is: emacs lisp sending messages to your project code running in clojure code. There are lots of other features but at its core, any repl interaction will be this functionality. A good place to start is the message logging that happens when you invoke M-x nrepl-toggle-message-logging.

(-->
  id         "16"
  op         "eval"
  session    "42da1513-54f2-4a29-b4b1-603d07a18434"
  time-stamp "2017-04-30 11:20:56.916993414"
  code       "(+ 1 2)
"
  column     12
  file       "*cider-repl CLJS cljc-bug*"
  line       49
  ns         "cljs.user"
)
(<--
  id         "16"
  session    "42da1513-54f2-4a29-b4b1-603d07a18434"
  time-stamp "2017-04-30 11:20:56.975191155"
  ns         "cljs.user"
  value      "3"
)
(<--
  id         "16"
  session    "42da1513-54f2-4a29-b4b1-603d07a18434"
  time-stamp "2017-04-30 11:20:56.986582000"
  status     ("done")
)
(<--
  id                 "16"
  session            "42da1513-54f2-4a29-b4b1-603d07a18434"
  time-stamp         "2017-04-30 11:20:56.987795668"
  changed-namespaces (dict)
  repl-type          "cljs"
  status             ("state")
)
Continue reading →

Basic setup of cider-nrepl for hacking

April 27, 2017

Installation

Working with cider-nrepl is a little more difficult and a little less straightforward. The best way that I've found with it is to install it in your maven directory. When I'm developing on it, I run the shell command rm -rf ~/.m2/repository/cider/ && lein install.

Cider looks for the version that matches it's own:

(defvar cider-jack-in-lein-plugins nil
  "List of Leiningen plugins where elements are lists of artifact name and version.")
(put 'cider-jack-in-lein-plugins 'risky-local-variable t)
(cider-add-to-alist 'cider-jack-in-lein-plugins
                    "cider/cider-nrepl" (upcase cider-version))

Continue reading →

Basic setup of CIDER for hacking

April 26, 2017

Installation

Emacs normally downloads packages into a directory in ~/.emacs.d/ or somewhere else not super accessible. The first step to setting up a way to start hacking on CIDER is to have your own copy that you own. Fork it, and then add the following to your your init.el or equivalent, but substituting wherever you cloned it for ~/projects/cider:

;; load local version of cider
(add-to-list 'load-path "~/projects/cider")
(require 'cider)

Delete any residual CIDER code left over in your melpa directory so that you know there's only one copy of CIDER running and its a permanent one. (This, in prelude is located at ~/.emacs.d/elpa).

Continue reading →