forked from slime/slime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathslime.texi
3525 lines (2821 loc) · 113 KB
/
slime.texi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\input texinfo
@c %**start of header
@setfilename slime.info
@documentencoding UTF-8
@codequoteundirected on
@codequotebacktick on
@dircategory Emacs
@direntry
* SLIME: (slime). Superior Lisp Interaction Mode for Emacs.
@end direntry
@c %**end of header
@set EDITION 2.30
@set UPDATED @today{}
@set TITLE SLIME User Manual
@settitle @value{TITLE}, version @value{EDITION}
@copying
Written by Luke Gorrie and others.
This file has been placed in the public domain.
@end copying
@titlepage
@title @value{TITLE}
@titlefont{version @value{EDITION}}
@sp 2
@center @image{slime-small}
@sp 4
@subtitle Compiled: @value{UPDATED}
@page
@insertcopying
@end titlepage
@c Macros
@macro SLIME
@acronym{SLIME}
@end macro
@macro SLDB
@acronym{SLDB}
@end macro
@macro REPL
@acronym{REPL}
@end macro
@macro Git
@acronym{Git}
@end macro
@macro kbditem{key, command}
@item \key\
@itemx M-x \command\
@kindex \key\
@findex \command\
@c
@end macro
@macro kbditempair{key1, key2, command1, command2}
@item \key1\, M-x \command1\
@itemx \key2\, M-x \command2\
@kindex \key1\
@kindex \key2\
@findex \command1\
@findex \command2\
@c
@end macro
@macro cmditem{command}
@item M-x \command\
@findex \command\
@c
@end macro
@macro kbdanchorc{key, command, comment}
@anchor{\command\}
@item \key\
@code{\command\}
@i{\comment\}@*
@end macro
@macro fcnindex{name}
@item \name\
@xref{\name\}.
@end macro
@c Merge the variable and concept indices because both are rather short
@synindex cp vr
@c @setchapternewpage off
@c @shortcontents
@contents
@ifnottex
@node Top
@top SLIME
@SLIME{} is the ``Superior Lisp Interaction Mode for Emacs''. This is
the manual for version @value{EDITION}. (Last updated @value{UPDATED})
@insertcopying
@end ifnottex
@menu
* Introduction::
* Getting started::
* SLIME mode::
* Debugger::
* Misc::
* Customization::
* Tips and Tricks::
* Contributed Packages::
* Credits::
* Key Index::
* Command Index::
* Variable Index::
@detailmenu
--- The Detailed Node Listing ---
Getting started
* Platforms::
* Downloading::
* Installation::
* Running::
* Setup Tuning::
Downloading @SLIME{}
* Git::
* Git Incantations::
Setup Tuning
* Basic customization::
* Multiple Lisps::
* Loading Swank faster::
Using @SLIME{} mode
* User-interface conventions::
* Evaluation::
* Compilation::
* Completion::
* Finding definitions::
* Documentation::
* Cross-reference::
* Macro-expansion::
* Disassembly::
* Recovery::
* Inspector::
* Profiling::
* Other::
* Semantic indentation::
* Reader conditionals::
User-interface conventions
* Temporary buffers::
* Inferior-lisp::
* Multithreading::
* Key bindings::
SLDB: the @SLIME{} debugger
* Examining frames::
* Restarts::
* Frame Navigation::
* Stepping::
* Miscellaneous::
Misc
* slime-selector::
* slime-macroexpansion-minor-mode::
* Multiple connections::
Customization
* Emacs-side customization::
* Lisp-side::
Emacs-side
* Hooks::
Lisp-side (Swank)
* Communication style::
* Other configurables::
Tips and Tricks
* Connecting to a remote lisp::
* Global IO Redirection::
* Auto-SLIME::
Connecting to a remote lisp
* Setting up the lisp image::
* Setting up Emacs::
* Setting up pathname translations::
Contributed Packages
* Loading Contribs::
* REPL::
* slime-mrepl::
* inferior-slime-mode::
* Compound Completion::
* Fuzzy Completion::
* slime-autodoc-mode::
* ASDF::
* Banner::
* Editing Commands::
* Fancy Inspector::
* Presentations::
* Typeout frames::
* TRAMP::
* Documentation Links::
* Xref and Class Browser::
* Highlight Edits::
* Scratch Buffer::
* SLIME Trace Dialog::
* slime-sprof::
* slime-fancy::
* Quicklisp::
REPL: the ``top level''
* REPL commands::
* Input Navigation::
* Shortcuts::
@end detailmenu
@end menu
@c -----------------------
@node Introduction
@chapter Introduction
@SLIME{} is the ``Superior Lisp Interaction Mode for Emacs.''
@SLIME{} extends Emacs with support for interactive programming in
Common Lisp. The features are centered around @code{slime-mode}, an
Emacs minor-mode that complements the standard @code{lisp-mode}. While
@code{lisp-mode} supports editing Lisp source files, @code{slime-mode}
adds support for interacting with a running Common Lisp process for
compilation, debugging, documentation lookup, and so on.
The @code{slime-mode} programming environment follows the example of
Emacs's native Emacs Lisp environment. We have also included good
ideas from similar systems (such as @acronym{ILISP}) and some new
ideas of our own.
@SLIME{} is constructed from two parts: a user-interface written in
Emacs Lisp, and a supporting server program written in Common
Lisp. The two sides are connected together with a socket and
communicate using an @acronym{RPC}-like protocol.
The Lisp server is primarily written in portable Common Lisp. The
required implementation-specific functionality is specified by a
well-defined interface and implemented separately for each Lisp
implementation. This makes @SLIME{} readily portable.
@c -----------------------
@node Getting started
@chapter Getting started
This chapter tells you how to get @SLIME{} up and running.
@menu
* Platforms::
* Downloading::
* Installation::
* Running::
* Setup Tuning::
@end menu
@c -----------------------
@node Platforms
@section Supported Platforms
@SLIME{} supports a wide range of operating systems and Lisp
implementations. @SLIME{} runs on Unix systems, Mac OSX, and Microsoft
Windows. GNU Emacs versions 24.3 and above are supported. @emph{XEmacs is
not supported anymore}.
The supported Lisp implementations, roughly ordered from the
best-supported, are:
@itemize @bullet
@item
CMU Common Lisp (@acronym{CMUCL}), 19d or newer
@item
Steel Bank Common Lisp (@acronym{SBCL}), 1.0 or newer
@item
Clozure Common Lisp (@acronym{CCL}), version 1.3 or newer
@item
LispWorks, version 4.3 or newer
@item
Allegro Common Lisp (@acronym{ACL}), version 6 or newer
@item
@acronym{CLISP}, version 2.35 or newer
@item
Armed Bear Common Lisp (@acronym{ABCL})
@item
Corman Common Lisp, version 2.51 or newer with the
patches from @url{http://www.grumblesmurf.org/lisp/corman-patches})
@item
Scieneer Common Lisp (@acronym{SCL}), version 1.2.7 or newer
@item
Embedded Common Lisp (@acronym{ECL})
@end itemize
Most features work uniformly across implementations, but some are
prone to variation. These include the precision of placing
compiler-note annotations, @acronym{XREF} support, and fancy debugger
commands (like ``restart frame'').
@c -----------------------
@node Downloading
@section Downloading SLIME
You can choose between using a released version of @SLIME{} or
accessing our @Git{} repository directly. You can download the latest
released version from our website:
@url{http://github.com/slime/slime/}
We recommend that users who participate in the @code{slime-devel}
mailing list use the @Git{} version of the code.
@menu
* Git::
* Git Incantations::
@end menu
@c -----------------------
@node Git
@subsection Downloading from Git
@SLIME{} is available from the @Git{} repository on
@file{github.com}. You have the option to use either the very latest
code or the tagged @code{FAIRLY-STABLE} snapshot.
The latest version tends to have more features and fewer bugs than the
@code{FAIRLY-STABLE} version, but it can be unstable during times of
major surgery. As a rule-of-thumb recommendation we suggest that if
you follow the @code{slime-devel} mailing list then you're better off
with the latest version (we'll send a note when it's undergoing major
hacking). If you don't follow the mailing list you won't know the
status of the latest code, so tracking @code{FAIRLY-STABLE} or using a
released version is the safe option.
If you download from @Git{} then remember to @code{git pull}
occasionally. Improvements are continually being committed, and the
@code{FAIRLY-STABLE} tag is moved forward from time to time.
@c -----------------------
@node Git Incantations
@subsection Git incantations
To download the very latest @SLIME{} you first configure
your @code{GitROOT} and login to the repository.
@example
git clone https://github.com/slime/slime.git
@end example
You might substitute @code{https} for @code{http} if you're having
problems with that protocol.
If you want to hack on @SLIME{}, use Github's @emph{fork} functionality
and submit a @emph{pull request}. Be sure to first read the
@uref{https://github.com/slime/slime/blob/master/CONTRIBUTING.md,,CONTRIBUTING.md} file first.
@c -----------------------
@node Installation
@section Installation
The easiest way to install and keep @SLIME{} up-to-date is using
Emacs's built-in package manager. @SLIME{} is available from the
@uref{http://melpa.org,,MELPA} repository. After
@uref{http://melpa.org/#/getting-started,,setting up the MELPA repository},
@SLIME{} can be installed via @kbd{M-x package-install RET slime RET}.
You should then define your default Lisp in your @file{.emacs} as follows:
@example
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
@end example
At this point, you should be ready to start @ref{Running,,running SLIME}.
This is the minimal configuration with the fewest frills. If the
basic setup is working, you can try additional modules (@ref{Loading
Contribs}).
@subsection Installing from Git
If you'd rather install @SLIME{} directly from its
@uref{https://github.com/slime/slime,,git repository}, you will need
to add a few extra lines in your @file{.emacs}:
@vindex inferior-lisp-program
@vindex load-path
@example
;; @emph{Setup load-path, autoloads and your lisp system}
;; @emph{Not needed if you install SLIME via MELPA}
(add-to-list 'load-path "~/dir/to/cloned/slime")
(require 'slime-autoloads)
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
@end example
You may optionally byte-compile @SLIME{} using @code{make compile
contrib-compile}.
@c -----------------------
@node Running
@section Running SLIME
@SLIME{} is started with the Emacs command @kbd{M-x slime}. This uses
the @code{inferior-lisp} package to start a Lisp process, loads and
starts the Lisp-side server (known as ``Swank''), and establishes a
socket connection between Emacs and Lisp. Finally a @REPL{} buffer is
created where you can enter Lisp expressions for evaluation.
At this point @SLIME{} is up and running and you can start exploring.
@node Setup Tuning
@section Setup Tuning
This section explains ways to perform basic extensions to @SLIME{}, and
how to configure @SLIME{} for multiple Lisp systems and how to reduce
@SLIME{}'s startup time.
Please proceed with this section only if your basic setup works. If
you are happy with the basic setup, skip this section.
For contrib modules @pxref{Loading Contribs}.
@menu
* Basic customization::
* Multiple Lisps::
* Loading Swank faster::
@end menu
@node Basic customization
@subsection Basic customization
Once you have the basic no-frills setup working, you can enhance your
@SLIME{} installation with bundled extensions:
@example
;; @emph{Setup load-path, autoloads and your lisp system}
(add-to-list 'load-path "~/dir/to/cloned/slime")
(require 'slime-autoloads)
@end example
See @pxref{Loading Contribs} for more information on @SLIME{}'s
contrib system.
To customize a particular binding in one of @SLIME{}'s keymaps, you
can add one of the following to your init file:
@example
(add-hook 'slime-load-hook
(lambda ()
(define-key slime-prefix-map (kbd "M-h") 'slime-documentation-lookup)))
@end example
The former technique works only for @SLIME{}'s core keymaps, not it's
contribs'. For those you can use the latter form which works for any
Emacs library. See also @pxref{Customization} for more advanced
configuration options.
@node Multiple Lisps
@subsection Multiple Lisps
By default, the command @kbd{M-x slime} starts the program specified
with @code{inferior-lisp-program}. If you invoke @kbd{M-x slime} with
a prefix argument, Emacs prompts for the program which should be
started instead. If you need that frequently or if the command
involves long filenames it's more convenient to set the
@code{slime-lisp-implementations} variable in your @file{.emacs}. For
example here we define two programs:
@vindex slime-lisp-implementations
@lisp
(setq slime-lisp-implementations
'((cmucl ("cmucl" "-quiet"))
(sbcl ("/opt/sbcl/bin/sbcl") :coding-system utf-8-unix)))
@end lisp
@vindex slime-default-lisp
This variable holds a list of programs and if you invoke @SLIME{} with
a negative prefix argument, @kbd{M-- M-x slime}, you can select a
program from that list. When called without a prefix, either the name
specified in @code{slime-default-lisp}, or the first item of the list will be used.
The elements of the list should look like
@lisp
(NAME (PROGRAM PROGRAM-ARGS...) &key CODING-SYSTEM INIT INIT-FUNCTION ENV)
@end lisp
@table @code
@item NAME
is a symbol and is used to identify the program.
@item PROGRAM
is the filename of the program. Note that the filename can contain
spaces.
@item PROGRAM-ARGS
is a list of command line arguments.
@item CODING-SYSTEM
the coding system for the connection. (@pxref{slime-net-coding-system})x
@item INIT
should be a function which takes two arguments: a filename and a
character encoding. The function should return a Lisp expression as a
string which instructs Lisp to start the Swank server and to write the
port number to the file. At startup, @SLIME{} starts the Lisp process
and sends the result of this function to Lisp's standard input. As
default, @code{slime-init-command} is used. An example is shown in
@ref{init-example,,Loading Swank faster}.
@item INIT-FUNCTION
should be a function which takes no arguments. It is called after
the connection is established. (See also @ref{slime-connected-hook}.)
@item ENV
specifies a list of environment variables for the subprocess. E.g.
@lisp
(sbcl-cvs ("/home/me/sbcl-cvs/src/runtime/sbcl"
"--core" "/home/me/sbcl-cvs/output/sbcl.core")
:env ("SBCL_HOME=/home/me/sbcl-cvs/contrib/"))
@end lisp
initializes @code{SBCL_HOME} in the subprocess.
@end table
@node Loading Swank faster
@subsection Loading Swank faster
For SBCL, we recommend that you create a custom core file with socket
support and @acronym{POSIX} bindings included because those modules
take the most time to load. To create such a core, execute the
following steps:
@example
shell$ sbcl
* (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf))
* (save-lisp-and-die "sbcl.core-for-slime")
@end example
After that, add something like this to your @file{.emacs}:
@lisp
(setq slime-lisp-implementations
'((sbcl ("sbcl" "--core" "sbcl.core-for-slime"))))
@end lisp
For maximum startup speed you can include the Swank server directly in
a core file. The disadvantage of this approach is that the setup is a
bit more involved and that you need to create a new core file when you
want to update @SLIME{} or @acronym{SBCL}. The steps to execute are:
@example
shell$ sbcl
* (load ".../slime/swank-loader.lisp")
* (swank-loader:dump-image "sbcl.core-with-swank")
@end example
@noindent
Then add this to your @file{.emacs}:
@anchor{init-example}
@lisp
(setq slime-lisp-implementations
'((sbcl ("sbcl" "--core" "sbcl.core-with-swank")
:init (lambda (port-file _)
(format "(swank:start-server %S)\n" port-file)))))
@end lisp
@noindent
Similar setups should also work for other Lisp implementations.
@node SLIME mode
@chapter Using Slime mode
@SLIME{}'s commands are provided via @code{slime-mode}, a minor-mode
used in conjunction with Emacs's @code{lisp-mode}. This chapter
describes the @code{slime-mode} and its relatives.
@menu
* User-interface conventions::
* Evaluation::
* Compilation::
* Completion::
* Finding definitions::
* Documentation::
* Cross-reference::
* Macro-expansion::
* Disassembly::
* Recovery::
* Inspector::
* Profiling::
* Other::
* Semantic indentation::
* Reader conditionals::
@end menu
@c -----------------------
@node User-interface conventions
@section User-interface conventions
To use @SLIME{} comfortably it is important to understand a few
``global'' user-interface characteristics. The most important
principles are described in this section.
@menu
* Temporary buffers::
* Inferior-lisp::
* Multithreading::
* Key bindings::
@end menu
@c -----------------------
@node Temporary buffers
@subsection Temporary buffers
Some @SLIME{} commands create temporary buffers to display their
results. Although these buffers usually have their own special-purpose
major-modes, certain conventions are observed throughout.
Temporary buffers can be dismissed by pressing @kbd{q}. This kills the
buffer and restores the window configuration as it was before the
buffer was displayed. Temporary buffers can also be killed with the
usual commands like @code{kill-buffer}, in which case the previous
window configuration won't be restored.
Pressing @kbd{RET} is supposed to ``do the most obvious useful
thing.'' For instance, in an apropos buffer this prints a full
description of the symbol at point, and in an @acronym{XREF} buffer it
displays the source code for the reference at point. This convention
is inherited from Emacs's own buffers for apropos listings,
compilation results, etc.
Temporary buffers containing Lisp symbols use @code{slime-mode} in
addition to any special mode of their own. This makes the usual
@SLIME{} commands available for describing symbols, looking up
function definitions, and so on.
@vindex slime-description-autofocus
Initial focus of those ``description'' buffers depends on the variable
@code{slime-description-autofocus}. If @code{nil} (the default),
description buffers do not receive focus automatically, and vice
versa.
@c -----------------------
@node Inferior-lisp
@subsection @code{*inferior-lisp*} buffer
@SLIME{} internally uses the @code{comint} package to start Lisp
processes. This has a few user-visible consequences, some good and
some not-so-terribly. To avoid confusion it is useful to understand
the interactions.
The buffer @code{*inferior-lisp*} contains the Lisp process's own
top-level. This direct access to Lisp is useful for troubleshooting,
and some degree of @SLIME{} integration is available using the
inferior-slime-mode. Many people load the better integrated @SLIME{}
@REPL{} contrib module (@pxref{REPL}) and ignore
the @code{*inferior-lisp*} buffer. (@pxref{Loading Contribs} for
information on how to enable the REPL.)
@c -----------------------
@node Multithreading
@subsection Multithreading
If the Lisp system supports multithreading, SLIME spawns a new thread
for each request, e.g., @kbd{C-x C-e} creates a new thread to evaluate
the expression. An exception to this rule are requests from the
@REPL{}: all commands entered in the @REPL{} buffer are evaluated in a
dedicated @REPL{} thread.
Some complications arise with multithreading and special variables.
Non-global special bindings are thread-local, e.g., changing the value
of a let bound special variable in one thread has no effect on the
binding of the variables with the same name in other threads. This
makes it sometimes difficult to change the printer or reader behaviour
for new threads. The variable
@code{swank:*default-worker-thread-bindings*} was introduced for such
situations: instead of modifying the global value of a variable, add a
binding the @code{swank:*default-worker-thread-bindings*}. E.g., with
the following code, new threads will read floating point values as
doubles by default:
@example
(push '(*read-default-float-format* . double-float)
swank:*default-worker-thread-bindings*).
@end example
@node Key bindings
@subsection Key bindings
In general we try to make our key bindings fit with the overall Emacs
style. We also have the following somewhat unusual convention of our
own: when entering a three-key sequence, the final key can be pressed
either with control or unmodified. For example, the
@code{slime-describe-symbol} command is bound to @kbd{C-c C-d d}, but
it also works to type @kbd{C-c C-d C-d}. We're simply binding both key
sequences because some people like to hold control for all three keys
and others don't, and with the two-key prefix we're not afraid of
running out of keys.
There is one exception to this rule, just to trip you up. We never
bind @kbd{C-h} anywhere in a key sequence, so @kbd{C-c C-d C-h}
doesn't do the same thing as @kbd{C-c C-d h}. This is because Emacs
has a built-in default so that typing a prefix followed by @kbd{C-h}
will display all bindings starting with that prefix, so @kbd{C-c C-d
C-h} will actually list the bindings for all documentation commands.
This feature is just a bit too useful to clobber!
@quotation
@i{``Are you deliberately spiting Emacs's brilliant online help facilities? The gods will be angry!''}
@end quotation
@noindent This is a brilliant piece of advice. The Emacs online help facilities
are your most immediate, up-to-date and complete resource for keybinding
information. They are your friends:
@table @kbd
@kbdanchorc{C-h k <key>, describe-key, ``What does this key do?''}
Describes current function bound to @kbd{<key>} for focus buffer.
@kbdanchorc{C-h b, describe-bindings, ``Exactly what bindings are available?''}
Lists the current key-bindings for the focus buffer.
@kbdanchorc{C-h m, describe-mode, ``Tell me all about this mode''}
Shows all the available major mode keys, then the minor mode keys, for
the modes of the focus buffer.
@kbdanchorc{C-h l, view-lossage, ``Woah@comma{} what key chord did I just do?''}
Shows you the literal sequence of keys you've pressed in order.
@c <key> is breaks links PDF, despite that it's not l it's C-h
@c @kbdanchorc{ <key> l, , ``What starts with?''}
@c Lists all keybindings that begin with @code{<key>} for the focus buffer mode.
@end table
@emph{Note:} In this documentation the designation @kbd{C-h} is a
@dfn{canonical key} which might actually mean Ctrl-h, or F1, or
whatever you have @code{help-command} bound to in your
@code{.emacs}. Here is a common situation:
@example
(global-set-key [f1] 'help-command)
(global-set-key "\C-h" 'delete-backward-char)
@end example
@noindent In this situation everywhere you see @kbd{C-h} in the
documentation you would substitute @kbd{F1}.
You can assign or change default key bindings globally using the
@code{global-set-key} function in your @file{~/.emacs} file like this:
@example
(global-set-key "\C-c s" 'slime-selector)
@end example
@noindent
which binds @kbd{C-c s} to the function @code{slime-selector}.
Alternatively, if you want to assign or change a key binding in just a
particular slime mode, you can use the @code{define-key} function
in your @file{~/.emacs} file like this:
@example
(define-key slime-repl-mode-map (kbd "C-c ;")
'slime-insert-balanced-comments)
@end example
@noindent
which binds @kbd{C-c ;} to the function
@code{slime-insert-balanced-comments} in the REPL buffer.
@c -----------------------
@node Evaluation
@section Evaluation commands
These commands each evaluate a Common Lisp expression in a different
way. Usually they mimic commands for evaluating Emacs Lisp code. By
default they show their results in the echo area, but a prefix
argument causes the results to be inserted in the current buffer.
@table @kbd
@kbditem{C-x C-e, slime-eval-last-expression}
Evaluate the expression before point and show the result in the echo
area.
@kbditem{C-M-x, slime-eval-defun}
Evaluate the current toplevel form and show the result in the echo
area. `C-M-x' treats `defvar' expressions specially. Normally,
evaluating a `defvar' expression does nothing if the variable it
defines already has a value. But `C-M-x' unconditionally resets the
variable to the initial value specified in the `defvar' expression.
This special feature is convenient for debugging Lisp programs.
@end table
If @kbd{C-M-x} or @kbd{C-x C-e} is given a numeric argument, it
inserts the value into the current buffer, rather than displaying it
in the echo area.
@table @kbd
@kbditem{C-c :, slime-interactive-eval}
Evaluate an expression read from the minibuffer.
@kbditem{C-c C-r, slime-eval-region}
Evaluate the region.
@kbditem{C-c C-p, slime-pprint-eval-last-expression}
Evaluate the expression before point and pretty-print the result in a
fresh buffer.
@kbditem{C-c E, slime-edit-value}
Edit the value of a setf-able form in a new buffer @file{*Edit <form>*}.
The value is inserted into a temporary buffer for editing and then set
in Lisp when committed with @kbd{C-c C-c}.
@kbditem{C-c C-u, slime-undefine-function}
Undefine the function, with @code{fmakunbound}, for the symbol at
point.
@end table
@c -----------------------
@node Compilation
@section Compilation commands
@cindex Compilation
@SLIME{} has fancy commands for compiling functions, files, and
packages. The fancy part is that notes and warnings offered by the
Lisp compiler are intercepted and annotated directly onto the
corresponding expressions in the Lisp source buffer. (Give it a try to
see what this means.)
@table @kbd
@cindex Compiling Functions
@kbditem{C-c C-c, slime-compile-defun}
Compile the top-level form at point. The region blinks shortly to
give some feedback which part was chosen.
With (positive) prefix argument the form is compiled with maximal
debug settings (@kbd{C-u C-c C-c}). With negative prefix argument it is compiled for
speed (@kbd{M-- C-c C-c}). If a numeric argument is passed set debug or speed settings
to it depending on its sign.
The code for the region is executed after compilation. In principle,
the command writes the region to a file, compiles that file, and loads
the resulting code.
@kbditem{C-c C-k, slime-compile-and-load-file}
Compile and load the current buffer's source file. If the compilation
step fails, the file is not loaded. It's not always easy to tell
whether the compilation failed: occasionally you may end up in the
debugger during the load step.
With (positive) prefix argument the file is compiled with maximal
debug settings (@kbd{C-u C-c C-k}). With negative prefix argument it is compiled for
speed (@kbd{M-- C-c C-k}). If a numeric argument is passed set debug or speed settings
to it depending on its sign.
@kbditem{C-c M-k, slime-compile-file}
Compile (but don't load) the current buffer's source file.
@kbditem{C-c C-l, slime-load-file}
Load a Lisp file. This command uses the Common Lisp LOAD function.
@cmditem{slime-compile-region}
Compile the selected region.
@end table
The annotations are indicated as underlining on source forms. The
compiler message associated with an annotation can be read either by
placing the mouse over the text or with the selection commands below.
@table @kbd
@kbditem{M-n, slime-next-note}
Move the point to the next compiler note and displays the note.
@kbditem{M-p, slime-previous-note}
Move the point to the previous compiler note and displays the note.
@kbditem{C-c M-c, slime-remove-notes}
Remove all annotations from the buffer.
@kbditem{C-x `, next-error}
Visit the next-error message. This is not actually a @SLIME{} command
but @SLIME{} creates a hidden buffer so that most of the Compilation
mode commands (@inforef{Compilation Mode,, emacs}) work similarly for
Lisp as for batch compilers.
@end table
@node Completion
@section Completion commands
@cindex Completion
@cindex Symbol Completion
Completion commands are used to complete a symbol or form based on
what is already present at point. Classical completion assumes an
exact prefix and gives choices only where branches may occur. Fuzzy
completion tries harder.
@table @kbd
@kbditem{M-TAB,slime-complete-symbol}
@c @itemx ESC TAB
@c @itemx C-M-i
Complete the symbol at point. Note that three styles of completion are
available in @SLIME{}; the default is similar to normal Emacs
completion (@pxref{slime-completion-at-point-functions}).
@end table
@c -----------------------
@node Finding definitions
@section Finding definitions (``Meta-Point'' commands).
@cindex Meta-dot
@cindex TAGS
The familiar @kbd{M-.} command is provided. For generic functions this
command finds all methods, and with some systems it does other fancy
things (like tracing structure accessors to their @code{DEFSTRUCT}
definition).
@table @kbd
@kbditem{M-., slime-edit-definition}
Go to the definition of the symbol at point.
@item M-,
@itemx M-*
@itemx M-x slime-pop-find-definition-stack
@kindex M-,
@findex slime-pop-find-definition-stack
Go back to the point where @kbd{M-.} was invoked. This gives multi-level
backtracking when @kbd{M-.} has been used several times.
@kbditem{C-x 4 ., slime-edit-definition-other-window}
Like @code{slime-edit-definition} but switches to the other window to
edit the definition in.
@kbditem{C-x 5 ., slime-edit-definition-other-frame}
Like @code{slime-edit-definition} but opens another frame to edit the
definition in.
@cmditem{slime-edit-definition-with-etags}
Use an ETAGS table to find definition at point.
@end table
@c -----------------------
@node Documentation
@section Documentation commands
@SLIME{}'s online documentation commands follow the example of Emacs
Lisp. The commands all share the common prefix @kbd{C-c C-d} and allow
the final key to be modified or unmodified (@pxref{Key bindings}.)
@table @kbd
@kbditem{SPC, slime-space}
The space key inserts a space, but also looks up and displays the
argument list for the function at point, if there is one.
@kbditem{C-c C-d d, slime-describe-symbol}
Describe the symbol at point.
@kbditem{C-c C-d f, slime-describe-function}
Describe the function at point.
@kbditem{C-c C-d A, slime-apropos}
Perform an apropos search on Lisp symbol names for a regular expression
match and display their documentation strings. By default the external
symbols of all packages are searched. With a prefix argument you can choose a
specific package and whether to include unexported symbols.
@kbditem{C-c C-d z, slime-apropos-all}