2015-12-02 14:23:39 +00:00
|
|
|
#+TITLE: Racket layer
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2019-05-07 08:53:56 +00:00
|
|
|
#+TAGS: general|layer|multi-paradigm|programming
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
[[file:img/racket.png]]
|
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2017-10-04 20:45:43 +00:00
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#install][Install]]
|
2018-01-04 06:34:23 +00:00
|
|
|
- [[#structuraly-safe-editing][Structuraly safe editing]]
|
2018-12-05 03:03:03 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#navigation][Navigation]]
|
|
|
|
- [[#documentation][Documentation]]
|
|
|
|
- [[#tests][Tests]]
|
|
|
|
- [[#repl][REPL]]
|
|
|
|
- [[#other-key-bindings][Other key bindings]]
|
2015-06-10 16:44:30 +00:00
|
|
|
|
|
|
|
* Description
|
|
|
|
Adds support for the [[http://racket-lang.org/][Racket]] programming language.
|
|
|
|
|
2017-10-04 20:45:43 +00:00
|
|
|
** Features:
|
2018-01-04 06:34:23 +00:00
|
|
|
- Syntax highlighting with =racket-mode=
|
|
|
|
- Test runner
|
|
|
|
- Interactive REPL
|
|
|
|
- Code navigation with =gtags=
|
|
|
|
- Structuraly safe editing using optional [[https://github.com/luxbock/evil-cleverparens][evil-cleverparens]]
|
2017-10-04 20:45:43 +00:00
|
|
|
|
2015-06-10 16:44:30 +00:00
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
|
|
|
add =racket= to the existing =dotspacemacs-configuration-layers= list in this
|
2016-07-27 03:30:52 +00:00
|
|
|
file. You will also need DrRacket installed. Alternatively, one can use the
|
2018-09-19 03:54:47 +00:00
|
|
|
“Minimal Racket” installation, and then run the following command.
|
2016-07-27 03:30:52 +00:00
|
|
|
|
|
|
|
#+BEGIN_SRC Bash
|
2018-09-19 03:54:47 +00:00
|
|
|
raco pkg install drracket
|
2016-07-27 03:30:52 +00:00
|
|
|
#+END_SRC
|
2015-06-10 16:44:30 +00:00
|
|
|
|
2018-01-04 06:34:23 +00:00
|
|
|
* Structuraly safe editing
|
2018-01-04 06:55:54 +00:00
|
|
|
This layer adds support for =evil-cleverparens= which allows to safely edit
|
2018-01-04 06:34:23 +00:00
|
|
|
lisp code by keeping the s-expressions balanced.
|
|
|
|
|
2018-01-04 06:55:54 +00:00
|
|
|
By default this mode is not activated. You can turn it on locally on the
|
2018-01-04 06:34:23 +00:00
|
|
|
active buffer with ~SPC m T s~ (=s= for safe).
|
|
|
|
|
|
|
|
To turn it on automatically for all =racket= buffers call the following
|
|
|
|
function in your =dotspacemacs/user-config= function:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-09-19 03:54:47 +00:00
|
|
|
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hook-racket-mode)
|
2018-01-04 06:34:23 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
or to enable it for all supported modes:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
2018-09-19 03:54:47 +00:00
|
|
|
(spacemacs/toggle-evil-safe-lisp-structural-editing-on-register-hooks)
|
2018-01-04 06:34:23 +00:00
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
When enabled the symbol =🆂= should be displayed in the mode-line.
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
* Key bindings
|
2015-06-10 16:44:30 +00:00
|
|
|
** Navigation
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-------------------------------------|
|
|
|
|
| ~SPC m g `~ | Return to previous location |
|
|
|
|
| ~SPC m g g~ | Go to definition of symbol at point |
|
|
|
|
| ~SPC m g m~ | Go to module at point |
|
|
|
|
| ~SPC m g r~ | Open require path |
|
|
|
|
|
|
|
|
** Documentation
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+---------------------------------------------------------------|
|
|
|
|
| ~SPC m h d~ | Describes the function at point in a =Racket Describe= buffer |
|
|
|
|
| ~SPC m h h~ | View documentation of the identifier or string at point. |
|
|
|
|
|
|
|
|
** Tests
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-----------------------------------|
|
|
|
|
| ~SPC m t b~ | Run tests of buffer |
|
|
|
|
| ~SPC m t B~ | Run tests of buffer with coverage |
|
|
|
|
|
|
|
|
** REPL
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+-----------------------------------------------------------------|
|
|
|
|
| ~SPC m s b~ | Send buffer to REPL |
|
|
|
|
| ~SPC m s B~ | Send buffer to REPL and switch to REPL buffer in =insert state= |
|
|
|
|
| ~SPC m s e~ | Send last sexp to REPL |
|
|
|
|
| ~SPC m s E~ | Send last sexp to REPL and switch to REPL in =insert state= |
|
|
|
|
| ~SPC m s f~ | Send function at point to REPL |
|
|
|
|
| ~SPC m s F~ | Send function at point and switch to REPL in =insert state= |
|
|
|
|
| ~SPC m s i~ | Start a REPL or switch to REPL buffer |
|
|
|
|
| ~SPC m s r~ | Send region to REPL |
|
|
|
|
| ~SPC m s R~ | Send region to REPL and switch to REPL in =insert state= |
|
|
|
|
| ~SPC m s s~ | Show and switch to REPL buffer |
|
|
|
|
|
|
|
|
** Other key bindings
|
|
|
|
|
2018-12-05 03:03:03 +00:00
|
|
|
| Key binding | Description |
|
2015-06-10 16:44:30 +00:00
|
|
|
|-------------+---------------------------------------------------------------------------------|
|
|
|
|
| ~SPC m i l~ | Insert lambda character |
|
|
|
|
| ~H-r~ | Run current file and open REPL (=H= is hyper, *may* be bound to command on OSX) |
|