Save 37% off PRO during our Black Friday Sale! »

The Evolution of the Clojure Tooling for Emacs

The Evolution of the Clojure Tooling for Emacs

Slides from my Clojure/conj 2014 talk

Efd2550fb5f3059d815e731ecd61b701?s=128

Bozhidar Batsov

November 20, 2014
Tweet

Transcript

  1. The Evolution of the Clojure tooling for Emacs narrated by

    Bozhidar I. Batsov
  2. Hello!

  3. @bbatsov

  4. Bug

  5. A (Dark) Knight of the Order of Emacs

  6. Why I am here?

  7. Bulgaria

  8. 2013 Other 24% LightTable 8% CCW 8% fireplace 10% Cursive

    3% CIDER 48% 2014 Other 13% LightTable 12% CCW 5% fireplace 14% Cursive 14% CIDER 42%
  9. –Nancy Pearcey “Competition is always a good thing. It forces

    us to do our best. A monopoly renders people complacent and satisfied with mediocrity.”
  10. The critics

  11. CIDER sucks big time!

  12. CIDER breaks on every update!

  13. CIDER has become bloated and slow!

  14. CIDER’s setup is overly complex!

  15. None
  16. CIDER is doing great!

  17. Near future Others 10% CIDER 90%

  18. Near future Cursive 25% Others 15% CIDER 60%

  19. A not so long time ago in a galaxy not

    far away…
  20. Java, PHP and .NET ruled the dev world

  21. Lisps were out of fashion

  22. 2007

  23. A gentleman & a scholar

  24. Clojure

  25. Biggest Clojure problem at launch?

  26. 0 Clojure dev environments

  27. Emacs was the last Lisp stronghold

  28. SLIME

  29. Superior Lisp Interaction Mode for Emacs

  30. SLIME Features • REPL • Interactive evaluation • Compilation notes

    • Code completion • Definition lookup • Documentation lookup • Apropos
  31. SLIME Features • Debugger • Value inspector • Tracing •

    Find usages • Macroexpansion • Scratchpad • Minibuffer code evaluation
  32. SLIME (Emacs Lisp) SWANK (Common Lisp) Clozure RPC LispWorks CMUCL

    ABCL SBCL Client Server Backends
  33. 2008

  34. clojure-mode & swank-clojure

  35. SLIME (Emacs Lisp) SWANK (Common Lisp) swank-clojure

  36. A star was born

  37. swank-clojure • Requires knowledge of swank (Common Lisp) • Bundles

    a frozen SLIME version • Subpar features (e.g. debugger, inspector, find usages) • Monolithic (no swank plugins)
  38. SLIME is a Common Lisp tool

  39. 2010

  40. Another esteemed gentleman & scholar

  41. nREPL

  42. A common foundation for Clojure dev tools

  43. • Load (compile) a Clojure file • Evaluate a Clojure

    form • Interrupt evaluation • Read from the standard input
  44. Extensible via middleware

  45. 2012

  46. nrepl.el

  47. nrepl.el (Emacs Lisp) nREPL (Clojure)

  48. A workhorse is retired

  49. nrepl.el • lacked many SLIME features • relied heavily on

    evaluation of inlined code • made assumptions about the environment • flawed bencode parser
  50. 2013

  51. Don’t settle for good. Demand great!

  52. –Phil Karlton “There are only two hard things in Computer

    Science: cache invalidation and naming things.”
  53. None
  54. Clojure Integrated Development Environment & REPL

  55. Clojure Interactive Development Environment Reimagined

  56. CIDER (Emacs Lisp) nREPL (Clojure) cider-nrepl

  57. (defun nrepl-jump-to-def (var) "Jump to the definition of the VAR

    at point." (let ((form (format "(let [ns-symbol '%s ns-var '%s ns-file (clojure.core/comp :file clojure.core/meta clojure.core/second clojure.core/first clojure.core/ns-publics) resource-str (clojure.core/comp clojure.core/str clojure.java.io/resource ns-file) file-str (clojure.core/comp clojure.core/str clojure.java.io/file ns-file)] (cond ((clojure.core/ns-aliases ns-symbol) ns-var) (let [resolved-ns ((clojure.core/ns-aliases ns-symbol) ns-var)] [(resource-str resolved-ns) (file-str resolved-ns) 1]) (find-ns ns-var) [(resource-str ns-var) (file-str ns-var) 1] (clojure.core/ns-resolve ns-symbol ns-var) ((clojure.core/juxt (clojure.core/comp clojure.core/str clojure.java.io/resource :file) (clojure.core/comp clojure.core/str clojure.java.io/file :file) :line) (clojure.core/meta (clojure.core/ns-resolve ns-symbol ns-var)))))" (nrepl-current-ns) var))) (nrepl-send-string form (nrepl-jump-to-def-handler (current-buffer)) nrepl-buffer-ns (nrepl-current-tooling-session)))) not portable
  58. (defun cider-jump-to-var (&optional var line) "Jump to the definition of

    VAR, optionally at a specific LINE. When called interactively, this operates on point, or falls back to a prompt." (interactive) (cider-ensure-op-supported "info") (cider-read-symbol-name "Symbol: " (lambda (var) (-if-let (info (cider-var-info var)) (cider--jump-to-loc-from-info info) (message "Symbol %s not resolved" var))))) portable
  59. CIDER Features • Interactive evaluation • Compilation notes • Code

    completion • Definition lookup • Documentation lookup • Apropos
  60. CIDER Features • Value inspector • Command selector • Tracing

    • Macroexpansion • Scratchpad • Minibuffer code evalution
  61. Bonus features

  62. Javadoc support

  63. JavaDoc Support

  64. C-c C-d d

  65. None
  66. Jump to Java definition

  67. JavaDoc Support

  68. M-.

  69. None
  70. Jump to resource

  71. None
  72. C-c M-.

  73. resources/conj/demo/resource.txt

  74. Sanity-preserving stacktraces

  75. None
  76. None
  77. None
  78. clojure.test integration

  79. C-c ,

  80. None
  81. None
  82. Namespace Browser

  83. None
  84. Classpath browser

  85. None
  86. Grimoire integration

  87. None
  88. C-c C-d g

  89. None
  90. • nREPL session manager • Smart ns reloading • ClojureScript

    support
  91. Extensions (are easy)

  92. • refactoring (clj-refactor + refactor-nrepl) • profiling (cider-profile + nrepl-refactor)

    • session tracking (cider-spy + cider-spy-nrepl)
  93. CIDER tastes better than SLIME

  94. What’s still missing?

  95. • Debugger • Find usages • A proper manual CIDER

    1.0
  96. Why CIDER?

  97. IDE

  98. None
  99. Emacs

  100. None
  101. None
  102. None
  103. None
  104. None
  105. Emacs users know how to build productive Lisp workflows

  106. • Emacs (ultimate Elisp dev env) • SLIME (and SLY)

    • Geiser • racket-mode • CIDER (obviously)
  107. • paredit • smartparens • rainbow-delimiters • rainbow-identifiers • sexp-fu

    • paxedit
  108. Community impact

  109. cider-nrepl https://github.com/clojure-emacs/cider-nrepl

  110. refactor-nrepl https://github.com/clojure-emacs/refactor-nrepl

  111. compliment https://github.com/alexander-yakushev/compliment

  112. cljs-tooling https://github.com/gtrak/cljs-tooling

  113. profile https://github.com/thunknyc/profile

  114. nREPL improvements

  115. Open development

  116. None
  117. None
  118. 85 contributors!

  119. Please, send more help!

  120. One more thing…

  121. CIDER 0.8 is out!

  122. Thanks!

  123. CIDER Demo / Q & A Unsession today @ 7

    pm
  124. Felina