Fix: off-by-one while fontifying REPL's output
[geiser.git] / README.org
blob674d06834b71fbff5cf52eff13f7e7ec56b6b63b
1 * Overview
3   Geiser is a generic Emacs/Scheme interaction mode, featuring an
4   enhanced REPL and a set of minor modes improving Emacs' basic scheme
5   major mode. The main functionalities provided are:
7     - Evaluation of forms in the namespace of the current module.
8     - Macro expansion.
9     - File/module loading.
10     - Namespace-aware identifier completion (including local bindings,
11       names visible in the current module, and module names).
12     - Autodoc: the echo area shows information about the signature of
13       the procedure/macro around point automatically.
14     - Jump to definition of identifier at point.
15     - Access to documentation (including docstrings when the
16       implementation provides it).
17     - Listings of identifiers exported by a given module.
18     - Listings of callers/callees of procedures.
19     - Rudimentary support for debugging (list of
20       evaluation/compilation error in an Emacs' compilation-mode
21       buffer).
22     - Support for inline images in schemes, such as Racket, that treat
23       them as first order values.
25    NOTE: if you're not in a hurry, [[http://www.nongnu.org/geiser/][Geiser's website]] contains a much
26    nicer manual.
28 * Requirements
30     Geiser needs Emacs 23.2 or better, and at least one of the
31     supported scheme implementations:
32       - Guile 2.2 or better.
33       - PLT Racket 6.0 or better.
34       - Chicken 4.8.0 or better.
35       - MIT/GNU Scheme 9.1.1 or better.
36       - Chibi 0.7.3 or better.
37       - Chez 9.4 or better.
39 * Installation
41   The easiest way is to use MELPA, and just type
42   =M-x package-install RET geiser= inside emacs.
44   Geiser can be used either directly from its uninstalled source tree
45   or byte-compiled and installed after performing the standard
46   configure/make/make install dance.  See the INSTALL file for more details.
48 ** Chicken 5 Addendum
49     These steps are necessary to fully support Chicken Scheme, but are
50     not required for any other scheme.
52     - Install the necessary support eggs:
54 #+BEGIN_EXAMPLE
55      $ chicken-install -s apropos srfi-18 srfi-1
56 #+END_EXAMPLE
59 ** Chicken 4 Addendum
60     These steps are necessary to fully support Chicken Scheme, but are
61     not required for any other scheme.
63     - Install the necessary support eggs:
65 #+BEGIN_EXAMPLE
66      $ chicken-install -s apropos chicken-doc
67 #+END_EXAMPLE
69     - Update the Chicken documentation database:
71 #+BEGIN_EXAMPLE
72      $ cd `csi -p '(chicken-home)'`
73      $ curl http://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx
74 #+END_EXAMPLE
76 * Basic configuration
78   The loading invocations above install all supported Scheme
79   implementations. You can list explicitly the ones that you want by
80   setting the variable =geiser-active-implementations= *before* loading
81   geiser.el. For instance:
83 #+BEGIN_SRC elisp
84     (setq geiser-active-implementations '(chicken guile))
85 #+END_SRC
87   On opening a scheme file, Geiser will try to guess its Scheme,
88   defaulting to the first in the list. Use =C-c C-s= to select the
89   implementation by hand (on a per file basis).
91   Check the geiser customization group for some options with:
93 #+BEGIN_EXAMPLE
94       M-x customize-group RET geiser RET
95 #+END_EXAMPLE
97   In particular, customize =geiser-<impl>-binary=, which should point
98   to an executable in your path.
100   To start a REPL, =M-x geiser=.
102 ** Completion with company-mode
104     Geiser offers identifier and module name completion, bound to
105     =M-TAB= and =M-`= respectively. Only names visible in the current
106     module are offered.
108     While that is cool and all, things are even better: if you have
109     [[http://company-mode.github.io/][company mode]] installed, Geiser's completion will use it. Just
110     require company-mode and, from then on, any new scheme buffer or
111     REPL will use it.
113 * Quick key reference
115 ** In Scheme buffers:
117    |-------------+--------------------------------------------------|
118    | C-c C-s     | Specify Scheme implementation for buffer         |
119    | C-c C-z     | Switch to REPL                                   |
120    | C-c C-a     | Switch to REPL and current module                |
121    |             |                                                  |
122    |-------------+--------------------------------------------------|
123    | M-.         | Go to definition of identifier at point          |
124    | M-,         | Go back to where M-. was last invoked            |
125    | C-c C-e m   | Ask for a module and open its file               |
126    | C-c C-e C-l | Add a given directory to Scheme's load path      |
127    | C-c C-e [   | Toggle between () and [] for current form        |
128    |             |                                                  |
129    |-------------+--------------------------------------------------|
130    | C-M-x       | Eval definition around point                     |
131    | C-c C-c     | Eval definition around point                     |
132    | C-c M-e     | Eval definition around point and switch to REPL  |
133    | C-x C-e     | Eval sexp before point                           |
134    | C-c C-r     | Eval region                                      |
135    | C-c M-r     | Eval region and switch to REPL                   |
136    | C-c C-b     | Eval buffer                                      |
137    | C-c M-b     | Eval buffer and switch to REPL                   |
138    |             |                                                  |
139    |-------------+--------------------------------------------------|
140    | C-c C-m x   | Macro-expand definition around point             |
141    | C-c C-m e   | Macro-expand sexp before point                   |
142    | C-c C-m r   | Macro-expand region                              |
143    |             |                                                  |
144    |-------------+--------------------------------------------------|
145    | C-c C-k     | Compile and load current buffer                  |
146    | C-c C-l     | Load scheme file                                 |
147    | C-u C-c C-k | Compile and load current buffer, restarting REPL |
148    |             |                                                  |
149    |-------------+--------------------------------------------------|
150    | C-c C-d d   | See documentation for identifier at point        |
151    | C-c C-d s   | See short documentation for identifier at point  |
152    | C-c C-d i   | Look up manual for identifier at point           |
153    | C-c C-d m   | See a list of a module's exported identifiers    |
154    | C-c C-d a   | Toggle autodoc mode                              |
155    |             |                                                  |
156    |-------------+--------------------------------------------------|
157    | C-c <       | Show callers of procedure at point               |
158    | C-c >       | Show callees of procedure at point               |
159    |             |                                                  |
160    |-------------+--------------------------------------------------|
161    | M-TAB       | Complete identifier at point                     |
162    | M-`, C-.    | Complete module name at point                    |
163    | TAB         | Complete identifier at point or indent           |
164    |             | (If geiser-mode-smart-tab-p is t)                |
165    |-------------+--------------------------------------------------|
167 ** In the REPL
169     |-------------+----------------------------------------------------|
170     | C-c C-z     | Start Scheme REPL, or jump to previous buffer      |
171     | C-c M-o     | Clear scheme output                                |
172     | C-c C-q     | Kill Scheme process                                |
173     | C-c C-l     | Load scheme file                                   |
174     | C-c C-k     | Nuke REPL: use it if the REPL becomes unresponsive |
175     |             |                                                    |
176     |-------------+----------------------------------------------------|
177     | M-.         | Edit identifier at point                           |
178     | TAB, M-TAB  | Complete identifier at point                       |
179     | M-`, C-.    | Complete module name at point                      |
180     | M-p, M-n    | Prompt history, matching current prefix            |
181     |             |                                                    |
182     |-------------+----------------------------------------------------|
183     | C-c C-m     | Set current module                                 |
184     | C-c C-i     | Import module into current namespace               |
185     | C-c C-r     | Add a given directory to scheme's load path        |
186     |             |                                                    |
187     |-------------+----------------------------------------------------|
188     | C-c C-d C-d | See documentation for symbol at point              |
189     | C-c C-d C-m | See documentation for module                       |
190     | C-c C-d C-a | Toggle autodoc mode                                |
191     |-------------+----------------------------------------------------|
193 ** In the documentation browser:
195     |----------+----------------------------------------------|
196     | f        | Next page                                    |
197     | b        | Previous page                                |
198     |          |                                              |
199     |----------+----------------------------------------------|
200     | TAB, n   | Next link                                    |
201     | S-TAB, p | Previous link                                |
202     | N        | Next section                                 |
203     | P        | Previous section                             |
204     |          |                                              |
205     |----------+----------------------------------------------|
206     | k        | Kill current page and go to previous or next |
207     | g, r     | Refresh page                                 |
208     | c        | Clear browsing history                       |
209     |          |                                              |
210     |----------+----------------------------------------------|
211     | ., M-.   | Edit identifier at point                     |
212     | z        | Switch to REPL                               |
213     |          |                                              |
214     |----------+----------------------------------------------|
215     | q        | Bury buffer                                  |
216     |----------+----------------------------------------------|
218 ** In backtrace (evaluation/compile result) buffers:
220     - =M-g n=, =M-g p=, =C-x `= for error navigation.
221     - =q= to bury buffer.