Perfect? clojure environment

4,746
-1

Published on

Discovering the Clojure language is more effective when you have good tool support. I cover the setup of a really great (perfect?) clojure development environment using

Emacs 24
Clojure mode
Marmalade repository
Leiningen build tool
Autocomplete manual installation
Lightbox, the future of Clojure IDE's ?

Thank you.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,746
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
50
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

Perfect? clojure environment

  1. 1. ( P e rfe c t?E n v ir o n m e nt)C – means control key, M – means meta key
  2. 2. ClojureMadeSimple.co.uk Information covered in this presentation is also detailed on my website C – means control key, M – means meta key
  3. 3. slideshare.net/jr0cket This slide deck is available to follow along with on slideshare.net C – means control key, M – means meta key
  4. 4. Something simple to start with C – means control key, M – means meta key
  5. 5. C – means control key, M – means meta key
  6. 6. A taste of things to come C – means control key, M – means meta key
  7. 7. C – means control key, M – means meta key
  8. 8. Get Emacs (sorry vi people)C – means control key, M – means meta key
  9. 9. Download & Install EmacsLinuxsudo apt-add-repository ppa:cassou/emacssudo apt-get updatesudo apt-get install emacs-snapshotMac WindowsEmacsForMacOSX.com Use Cygwin? C – means control key, M – means meta key
  10. 10. In the meantime: Usual SuspectsNetbeansIntelliJEclipse C – means control key, M – means meta key
  11. 11. Configure emacs… you will have an .el of a time C – means control key, M – means meta key
  12. 12. Configs live in ~/.emacs.d folder~/.emacs.d folder created when Emacs first run~/.emacs.d/init.el main configuration file for Emacs You can define multiple .el config files as long as they are on the Emacs load path. init.el is the read first. C – means control key, M – means meta key
  13. 13. Give Emacs a Clojure injection… lots of starter-kits, only one for Clojure C – means control key, M – means meta key
  14. 14. Automatic Clojure install … get your Clojure fix quickly C – means control key, M – means meta key
  15. 15. Add the package repository;; Add Marmalade package archive for Emacs starter kit;; and tonnes of other packages to your .emacs.d/init.el(require package)(add-to-list package-archives ("marmalade" . "http://marmalade- repo.org/packages/")) C – means control key, M – means meta key
  16. 16. Specify package to load(when (not package-archive-contents) (package-refresh-contents))(defvar my-packages (starter-kit starter-kit-lisp starter-kit- eshell starter-kit- bindings clojure-mode clojure-test-mode M – means meta key C – means control key,
  17. 17. Didnt get all that typed?? Clone my Emacs Clojure Kickstart repository on github.com/jr0cket git clone https://jr0cket@github.com/ jr0cket/Emacs-clojure- kickstart.git ~/.emacs.dThe git clone command should all be on one line, but would not be as readable on the slide C – means control key, M – means meta key
  18. 18. Re-start Emacs… watch clojure and other goodies beautomatically downloaded and added. C – means control key, M – means meta key
  19. 19. In the meantime, CloojClojure IDE in Clojuregithub.com/arthuredelstein/clooj C – means control key, M – means meta key
  20. 20. github.com/arthuredelstein/clooj C – means control key, M – means meta key
  21. 21. Back to Emacs… keyboard on stun !!C – means control key, M – means meta key
  22. 22. Editing text......should be easy, right? C – means control key, M – means meta key
  23. 23. Using a mouse is bad for your health C – means control key, M – means meta key
  24. 24. C – means control key, M – means meta key
  25. 25. Moving along a line C – aGo to start of a line C – e Go to end of a lineC – means control key, M – means meta key
  26. 26. Searching for something... C – s Search forward C – r Search backwards C – means control key, M – means meta key
  27. 27. Select / Copy / Paste C – @Or to select, use the mouse, Luke C – means control key, M – means meta key
  28. 28. Select / Copy / Paste C – k cut line C – w cut selectedC – means control key, M – means meta key
  29. 29. Select / Copy / Paste C – yYank that text into your code C – means control key, M – means meta key
  30. 30. Undo / Redo C - _Go back change by changeC – means control key, M – means meta key
  31. 31. Undo / RedoC - ???Go forward change by change C – means control key, M – means meta key
  32. 32. Some core keyboard commands C – means control key, M – means meta key
  33. 33. C – gHit as many times as necessary to cancel a keyboard command C – means control key, M – means meta key
  34. 34. Getting help withkeyboard commands C – means control key, M – means meta key
  35. 35. Just the bindings, maam C – h bList all the current keyboard bindings configured in Emacs C – means control key, M – means meta key
  36. 36. Just the modes, maam C – h mModes can be either major or minor and many can be used together. C – means control key, M – means meta key
  37. 37. Function keys Help F1 – b F1 – mF1 function key is the same as help C - h C – means control key, M – means meta key
  38. 38. Funky stuffC – means control key, M – means meta key
  39. 39. Transpose characters C – tSwap the current character with the previous one - good for erratic typing C – means control key, M – means meta key
  40. 40. Coding Demo? – Super-size it! C – + C – -Make your text big for the people at the back of the room C – means control key, M – means meta key
  41. 41. Clojure project managementC – means control key, M – means meta key
  42. 42. Leiningen… more fun than mavenC – means control key, M – means meta key
  43. 43. le in in g e n Leiningen .o rglein new Create a new clojure projectlein deps Download all dependencieslein repl Start the interactive shell (repl)lein jack-in Start repl server C – means control key, M – means meta key
  44. 44. Create a new projectlein new my-projectcd my-projectlein deps C – means control key, M – means meta key
  45. 45. Open project in emacscd my-projectemacs project.clj C – means control key, M – means meta key
  46. 46. Default project definition C – means control key, M – means meta key
  47. 47. Add a REPL serverC – means control key, M – means meta key
  48. 48. Dev DependenciesAdd libraries only needed for developmentNot packaged when deployed C – means control key, M – means meta key
  49. 49. C – means control key, M – means meta key
  50. 50. Clojure projectmanagement in EmacsC – means control key, M – means meta key
  51. 51. Find file in project C – c fSelect one of the files available in the current Clojure project - the file doesnt have to be open in Emacs C – means control key, M – means meta key
  52. 52. Fire up the REPL M – xclojure- jack-inC – means control key, M – means meta key
  53. 53. Define your own Global short-cutOpen your .emacs.d/init.el file and add:(global-set-key (kbd "C-c C-j") clojure-jack- in)In Emacs, start the REPL with C – c C – j C – means control key, M – means meta key
  54. 54. More Cool short-cuts later… but its easy, right! C – means control key, M – means meta key
  55. 55. Navigating functions (s-expressions) C – means control key, M – means meta key
  56. 56. Jump around in functionsC – M – fC – M – bC – M – u C – means control key, M – means meta key
  57. 57. Jump between function definitionsC – M – HomeC – M – EndSkip through your code function by function C – means control key, M – means meta key
  58. 58. Jump between function definitions C – M – a C – M – eJump to the start or end of a function definintion C – means control key, M – means meta key
  59. 59. Keep balanced, use ParEditC – means control key, M – means meta key
  60. 60. ParEdit matches ( [ { ”Prevents unbalanced parents and quotesExample Cant delete either parens that surround characters (fubar) without first deleting all the characters Pull code into brackets Reorganise code around brackets C – means control key, M – means meta key
  61. 61. Pull code in M – )Pull the next block of code inside C – means control key, M – means meta key
  62. 62. Push code in M – (Push the next block of code outside ?????? C – means control key, M – means meta key
  63. 63. Clojure related commandsC-c TAB: Autocomplete symbol at pointC-x C-e: Eval the form under the pointC-c C-k: Compile the current buffer C-c C-l: Load current buffer and forcedependent namespaces to reloadM-.: Jump to the definition of a varC-c S-i: Inspect a valueC-c C-m: Macroexpand the call under the point C – means control key, M – means meta key
  64. 64. Auto-completeC – means control key, M – means meta key
  65. 65. The easy wayClone Sam Aarons Live Coding repositorygithub.com/overtone/emacs-live C – means control key, M – means meta key
  66. 66. The manual wayAdd the auto-complete package dependencies to ~/.emacs.d/init.elpopupDownload the Git repository https://github.com/m2ym/auto-completeM – x load-file autocomplete/etc/install.el C – means control key, M – means meta key
  67. 67. Other cool stuff to help you discover Clojure C – means control key, M – means meta key
  68. 68. ClojureAtlas.comC – means control key, M – means meta key
  69. 69. Light Table (On Kickstarter) C – means control key, M – means meta key
  70. 70. Th a n k yo u London Cl oj ur i ans @ r 0c ket jCl oj ur eMadeSi m e. c o pl . uk C – means control key, M – means meta key

×