sly.info (139569B)
1 This is sly.info, produced by makeinfo version 6.7 from sly.texi. 2 3 Written for SLIME Luke Gorrie and others, rewritten by João Távora for 4 SLY. 5 6 This file has been placed in the public domain. 7 INFO-DIR-SECTION Emacs 8 START-INFO-DIR-ENTRY 9 * SLY: (sly). Common-Lisp IDE 10 END-INFO-DIR-ENTRY 11 12 13 File: sly.info, Node: Top, Next: Introduction, Up: (dir) 14 15 SLY 16 *** 17 18 SLY is a Common Lisp IDE for Emacs. This is the manual for version 19 1.0.42. (Last updated April 20, 2022) 20 21 Written for SLIME Luke Gorrie and others, rewritten by João Távora 22 for SLY. 23 24 This file has been placed in the public domain. 25 26 * Menu: 27 28 * Introduction:: 29 * Getting started:: 30 * A SLY tour for SLIME users:: 31 * Working with source files:: 32 * Common functionality:: 33 * The REPL and other special buffers:: 34 * Customization:: 35 * Tips and Tricks:: 36 * Extensions:: 37 * Credits:: 38 * Key Index:: 39 * Command Index:: 40 * Variable Index:: 41 42 -- The Detailed Node Listing -- 43 44 Getting started 45 46 * Platforms:: 47 * Downloading:: 48 * Basic setup:: 49 * Running:: 50 * Basic customization:: 51 * Multiple Lisps:: 52 53 Working with source files 54 55 * Evaluation:: 56 * Compilation:: 57 * Autodoc:: 58 * Semantic indentation:: 59 * Reader conditionals:: 60 * Macro-expansion:: 61 62 Common functionality 63 64 * Finding definitions:: 65 * Cross-referencing:: 66 * Completion:: 67 * Interactive objects:: 68 * Documentation:: 69 * Multiple connections:: 70 * Disassembly:: 71 * Recovery:: 72 * Temporary buffers:: 73 * Multi-threading:: 74 75 The REPL and other special buffers 76 77 * REPL:: 78 * Inspector:: 79 * Debugger:: 80 * Trace Dialog:: 81 * Stickers:: 82 83 The REPL: the "top level" 84 85 * REPL commands:: 86 * REPL output:: 87 * REPL backreferences:: 88 89 The SLY-DB Debugger 90 91 * Examining frames:: 92 * Restarts:: 93 * Frame Navigation:: 94 * Miscellaneous:: 95 96 Customization 97 98 * Emacs-side:: 99 * Lisp-side customization:: 100 101 Emacs-side 102 103 * Keybindings:: 104 * Keymaps:: 105 * Defcustom variables:: 106 * Hooks:: 107 108 Lisp-side (Slynk) 109 110 * Communication style:: 111 * Other configurables:: 112 113 Tips and Tricks 114 115 * Connecting to a remote Lisp:: 116 * Loading Slynk faster:: 117 * Auto-SLY:: 118 * REPLs and game loops:: 119 * Controlling SLY from outside Emacs:: 120 121 Connecting to a remote Lisp 122 123 * Setting up the Lisp image:: 124 * Setting up Emacs:: 125 * Setting up pathname translations:: 126 127 Extensions 128 129 * Loading and unloading:: 130 * More contribs:: 131 132 More contribs 133 134 * TRAMP Support:: 135 * Scratch Buffer:: 136 137 138 139 File: sly.info, Node: Introduction, Next: Getting started, Prev: Top, Up: Top 140 141 1 Introduction 142 ************** 143 144 SLY is Sylvester the Cat's Common Lisp IDE. It extends Emacs with 145 support for interactive programming in Common Lisp. 146 147 The features are centered around an Emacs minor-mode called 148 'sly-mode', which complements the standard major-mode 'lisp-mode' for 149 editing Lisp source files. 'sly-mode' adds support for interacting with 150 a running Common Lisp process for compilation, debugging, documentation 151 lookup, and so on. 152 153 SLY attempts to follow the example of Emacs's own native Emacs-Lisp 154 environment. Many of the keybindings and interface concepts used to 155 interact with Emacs's Elisp machine are reused in SLY to interact with 156 the underlying Common Lisp run-times. Emacs makes requests to these 157 processes, asking them to compile files or code snippets; deliver 158 introspection information various objects; or invoke commands or 159 debugging restarts. 160 161 Internally, SLY's user-interface, written in Emacs Lisp, is connected 162 via sockets to one or more instances of a server program called "Slynk" 163 that is running in the Lisp processes. 164 165 The two sides communicate using a Remote Procedure Call (RPC) 166 protocol. The Lisp-side server is primarily written in portable Common 167 Lisp. However, because some non-standard functionality is provided 168 differently by each Lisp implementation (SBCL, CMUCL, Allegro, etc...) 169 the Lisp-side server is again split into two parts - portable and 170 non-portable implementation - which communicate using a well-defined 171 interface. Each Lisp implementation provides a separate implementation 172 of that interface, making SLY as a whole readily portable. 173 174 SLY is a direct fork of SLIME, the "Superior Lisp Interaction Mode 175 for Emacs", which itself derived from previous Emacs programs such as 176 SLIM and ILISP. If you already know SLIME, SLY's closeness to it is 177 immediately apparent. However, where SLIME has traditionally focused on 178 the stability of its core functionality, SLY aims for a richer feature 179 set, a more consistent user interface, and an experience generally 180 closer to Emacs' own. 181 182 To understand the differences between the two projects read SLY's 183 NEWS.md file. For a hand-on approach to these differences you might 184 want to *note A SLY tour for SLIME users::. 185 186 187 File: sly.info, Node: Getting started, Next: A SLY tour for SLIME users, Prev: Introduction, Up: Top 188 189 2 Getting started 190 ***************** 191 192 This chapter tells you how to get SLY up and running. 193 194 * Menu: 195 196 * Platforms:: 197 * Downloading:: 198 * Basic setup:: 199 * Running:: 200 * Basic customization:: 201 * Multiple Lisps:: 202 203 204 File: sly.info, Node: Platforms, Next: Downloading, Up: Getting started 205 206 2.1 Supported Platforms 207 ======================= 208 209 SLY supports a wide range of operating systems and Lisp implementations. 210 SLY runs on Unix systems, Mac OSX, and Microsoft Windows. GNU Emacs 211 versions 24.4 and above are supported. _XEmacs or Emacs 23 are notably 212 not supported_. 213 214 The supported Lisp implementations, roughly ordered from the 215 best-supported, are: 216 217 * CMU Common Lisp (CMUCL), 19d or newer 218 * Steel Bank Common Lisp (SBCL), 1.0 or newer 219 * Clozure Common Lisp (CCL), version 1.3 or newer 220 * LispWorks, version 4.3 or newer 221 * Allegro Common Lisp (ACL), version 6 or newer 222 * CLISP, version 2.35 or newer 223 * Armed Bear Common Lisp (ABCL) 224 * Scieneer Common Lisp (SCL), version 1.2.7 or newer 225 * Embedded Common Lisp (ECL) 226 * ManKai Common Lisp (MKCL) 227 * Clasp 228 229 Most features work uniformly across implementations, but some are 230 prone to variation. These include the precision of placing 231 compiler-note annotations, XREF support, and fancy debugger commands 232 (like "restart frame"). 233 234 235 File: sly.info, Node: Downloading, Next: Basic setup, Prev: Platforms, Up: Getting started 236 237 2.2 Downloading SLY 238 =================== 239 240 By far the easiest method for getting SLY up and running is using Emacs’ 241 package system configured to the popular MELPA repository. This snippet 242 of code should already be in your configuration: 243 244 (add-to-list 'package-archives 245 '("melpa" . "https://melpa.org/packages/")) 246 (package-initialize) 247 248 You should now be able to issue the command 'M-x package-install', 249 choose 'sly' and have it be downloaded and installed automatically. If 250 you don’t find it in the list, ensure you run 'M-x 251 package-refresh-contents' first. 252 253 In other situations, such as when developing SLY itself, you can 254 access the Git repository directly: 255 256 git clone https://github.com/joaotavora/sly.git 257 258 If you want to hack on SLY, use Github's _fork_ functionality and 259 submit a _pull request_. Be sure to first read the CONTRIBUTING.md file 260 first. 261 262 263 File: sly.info, Node: Basic setup, Next: Running, Prev: Downloading, Up: Getting started 264 265 2.3 Basic setup 266 =============== 267 268 If you installed SLY from MELPA, it is quite possible that you don’t 269 need any more configuration, provided that SLY can find a suitable Lisp 270 executable in your 'PATH' environment variable. 271 272 Otherwise, you need to tell it where a Lisp program can be found, so 273 customize the variable 'inferior-lisp-program' (*note Defcustom 274 variables::) or add a line like this one to your '~/.emacs' or 275 '~/.emacs.d/init.el' (*note Emacs Init File::). 276 277 (setq inferior-lisp-program "/opt/sbcl/bin/sbcl") 278 279 After evaluating this, you should be able to execute 'M-x sly' and be 280 greeted with a REPL. 281 282 If you cloned from the Git repository, you’ll have to add a couple of 283 more lines to your initialization file configuration: 284 285 (add-to-list 'load-path "~/dir/to/cloned/sly") 286 (require 'sly-autoloads) 287 288 289 File: sly.info, Node: Running, Next: Basic customization, Prev: Basic setup, Up: Getting started 290 291 2.4 Running SLY 292 =============== 293 294 SLY can either ask Emacs to start its own Lisp subprocesss or connect to 295 a running process on a local or remote machine. 296 297 The first alternative is more common for local development and is 298 started via 'M-x sly'. The "inferior" Lisp process thus started is told 299 to load the Lisp-side server known as "Slynk" and then a socket 300 connection is established between Emacs and Lisp. Finally a REPL buffer 301 is created where you can enter Lisp expressions for evaluation. 302 303 The second alternative uses 'M-x sly-connect'. This assumes that 304 that a Slynk server is running on some local or remote host, and 305 listening on a given port. 'M-x sly-connect' prompts the user for these 306 values, and upon connection the REPL is established. 307 308 309 File: sly.info, Node: Basic customization, Next: Multiple Lisps, Prev: Running, Up: Getting started 310 311 2.5 Basic customization 312 ======================= 313 314 A big part of Emacs, and Emacs’s extensions, are its near-infinite 315 customization possibilities. SLY is no exception, because it runs on 316 both Emacs and the Lisp process, there are layers of Emacs-side 317 customization and Lisp-side customization. But don’t be put off by 318 this! SLY tries hard to provide sensible defaults that don’t "hide" any 319 fanciness beneath layers of complicated code, so that even a setup with 320 no customization at all exposes SLY’s most important functionality. 321 322 Emacs-side customization is usually done via Emacs-lisp code snippets 323 added to the user’s initialization file, usually '$HOME/.emacs' or 324 '$HOME/.emacs.d/init.el' (*note Emacs Init File::). 325 326 90% of Emacs-lisp customization happens in either "keymaps" or 327 "hooks" (*note Emacs-side::). Still on the Emacs side, there is also a 328 separate interface, appropriately called 'customize' (or sometimes just 329 'custom'), that uses a nicer UI with mouse-clickable buttons to set some 330 special variables. See *Note Defcustom variables::. 331 332 Lisp-side customization is done exclusively via Common Lisp code 333 snippets added to the user’s '$HOME/.slynkrc' file. See *Note Lisp-side 334 customization::. 335 336 As a preview, take this simple example of a frequently customized 337 part of SLY: its keyboard shortcuts, known as "keybindings". In the 338 following snippet 'M-h' is added to 'sly-prefix-map' thus yielding 'C-c 339 M-h' as a shortcut to the 'sly-documentation-lookup' command. 340 341 (eval-after-load 'sly 342 `(define-key sly-prefix-map (kbd "M-h") 'sly-documentation-lookup)) 343 344 345 File: sly.info, Node: Multiple Lisps, Prev: Basic customization, Up: Getting started 346 347 2.6 Multiple Lisps 348 ================== 349 350 By default, the command 'M-x sly' starts the program specified with 351 'inferior-lisp-program', a variable that you can customize (*note 352 Defcustom variables::). However, if you invoke 'M-x sly' with a _prefix 353 argument_, meaning you type 'C-u M-x sly' then Emacs prompts for the 354 program which should be started instead. 355 356 If you need to do this frequently or if the command involves long 357 filenames it's more convenient to set the 'sly-lisp-implementations' 358 variable in your initialization file (*note Emacs Init File::). For 359 example here we define two programs: 360 361 (setq sly-lisp-implementations 362 '((cmucl ("cmucl" "-quiet")) 363 (sbcl ("/opt/sbcl/bin/sbcl") :coding-system utf-8-unix))) 364 365 Now, if you invoke SLY with a _negative_ prefix argument, 'M-- M-x 366 sly', you can select a program from that list. When called without a 367 prefix, either the name specified in 'sly-default-lisp', or the first 368 item of the list will be used. The elements of the list should look 369 like 370 371 (NAME (PROGRAM PROGRAM-ARGS...) &key CODING-SYSTEM INIT INIT-FUNCTION ENV) 372 373 'NAME' 374 is a symbol and is used to identify the program. 375 'PROGRAM' 376 is the filename of the program. Note that the filename can contain 377 spaces. 378 'PROGRAM-ARGS' 379 is a list of command line arguments. 380 'CODING-SYSTEM' 381 the coding system for the connection. (*note 382 sly-net-coding-system::)x 383 'INIT' 384 should be a function which takes two arguments: a filename and a 385 character encoding. The function should return a Lisp expression 386 as a string which instructs Lisp to start the Slynk server and to 387 write the port number to the file. At startup, SLY starts the Lisp 388 process and sends the result of this function to Lisp's standard 389 input. As default, 'sly-init-command' is used. An example is 390 shown in *note Loading Slynk faster: init-example. 391 'INIT-FUNCTION' 392 should be a function which takes no arguments. It is called after 393 the connection is established. (See also *note 394 sly-connected-hook::.) 395 'ENV' 396 specifies a list of environment variables for the subprocess. E.g. 397 (sbcl-cvs ("/home/me/sbcl-cvs/src/runtime/sbcl" 398 "--core" "/home/me/sbcl-cvs/output/sbcl.core") 399 :env ("SBCL_HOME=/home/me/sbcl-cvs/contrib/")) 400 initializes 'SBCL_HOME' in the subprocess. 401 402 403 File: sly.info, Node: A SLY tour for SLIME users, Next: Working with source files, Prev: Getting started, Up: Top 404 405 3 A SLY tour for SLIME users 406 **************************** 407 408 The chances are that if you’re into Common Lisp, you already know about 409 SLIME, the project that originated SLY. Itself originating in older 410 Emacs extensions SLIM and ILISP, SLIME has been around for at least a 411 decade longer than SLY and is quite an amazing IDE. It's likely that 412 most Lispers have some experience with it, making it a good idea to 413 provide, in the shape of a quick tutorial, a hands-on overview of some 414 of the improvements of SLY over SLIME. 415 416 When you start SLY with 'M-x sly' (*note Basic setup::) you are 417 greeted with its REPL, a common starting point of Lisp hacking sessions. 418 This has been completely redesigned in SLY: you can spawn multiple REPL 419 sessions with 'sly-mrepl-new'; copy objects from most places directly 420 into it (with 'M-RET' and 'M-S-RET'); use powerful incremental history 421 search (with 'C-r') found in most modern shells; and get real-time 422 assistance when "backreferecing" previous evaluation values in your Lisp 423 input. 424 425 426 427 428 429 Starting from the new REPL, let's showcase some of SLY’s features. 430 Let’s pretend we want to hack an existing Lisp project. We'll pick SLY 431 itself, or rather its Lisp server, called Slynk. Let's pretend we're 432 intrigued by the way its "flex"-style completion works. What is flex 433 completion, you ask? Well, if you're at the REPL you can try it now: 434 it's a way of 'TAB'-completing (*note Completion::) symbol names based 435 on educated guesses of a few letters. Thus if we type 'mvbind', SLY 436 guesses that we probably meant 'multiple-value-bind', and if we type 437 'domat' it might possibly guess 'cl-ppcre:do-matches'. Let's dig into 438 the code that makes this happen. 439 440 But how? Where to begin, given we know so little about this project? 441 442 Well, a good starting point is always the _apropos_ functionality, 443 which is a 'grep' of sorts, but aware of the symbols loaded in your 444 Lisp, rather the contents of text files. Furthermore, in SLY, 445 'sly-apropos' will do a regular-expression-enabled symbol search, which 446 will help us here since we don't yet know any symbols names of this 447 mysterious flex feature. 448 449 To enable regular expression searches you need the 'CL-PPCRE' library 450 is loaded (else 'sly-apropos' falls back to regex-less mode). If you 451 have Quicklisp (https://www.quicklisp.org/beta/) installed (you do, 452 right?) you need only type '(ql:quickload :cl-ppcre)' now from the 453 REPL. 454 455 Thus, if we want to hack SLY's flex completion, and _don't_ known any 456 of its symbol's names, we type 'C-c C-d C-z' (the shortcut for 'M-x 457 sly-apropos-all') and then type in "sly.*flex" at the prompt. We follow 458 with 'enter' or 'return' (abbreviated 'RET' or 'C-m'). SLY should now 459 present all Lisp symbols matching your search pattern. 460 461 462 463 464 465 In the 'apropos' buffer, let’s grab the mouse and right-click the 466 symbol 'SLYNK-COMPLETIONS:FLEX-COMPLETIONS'. We’ll be presented with a 467 context menu with options for describing the symbol, inspecting it, or 468 navigating to its source definition. In general, the Lisp-side objects 469 that SLY presents -- symbols, CLOS objects, function calls, etc... -- 470 are right-clickable buttons with such a context menu (*note Interactive 471 objects::). For now, let’s navigate to the source definition of the 472 symbol by choosing "Go To source" from the menu. Alternatively, we 473 could also have just pressed 'M-.' on the symbol, of course. 474 475 From the Lisp source buffer that we landed on (probably 476 'slynk-completion.lisp'), let’s _trace_ the newly found function 477 'SLYNK-COMPLETIONS:FLEX-COMPLETIONS'. However, instead of using the 478 regular 'CL:TRACE', we’ll use SLY’s Trace Dialog functionality. This is 479 how we set it up: 480 481 1. first type 'C-c C-t' on the function’s name, or enter that in the 482 minibuffer prompt; 483 484 2. now, open the Trace Dialog in a new window by typing 'C-c T' 485 (that’s a capital 'T'). We should already see our traced function 486 under the heading "Traced specs"; 487 488 3. thirdly, for good measure, let’s also trace the nearby function 489 'SLYNK-COMPLETIONS::FLEX-SCORE' by also typing 'C-c C-t' on its 490 name, or just entering it in the minibuffer prompt. 491 492 Now let’s return to the REPL by switching to its '*sly-mrepl ...' 493 buffer or typing 'C-c C-z'. To exercise the code we just traced, let’s 494 type something like 'desbind', followed by tab, and see if it suggest 495 'destructuring-bind' as the top match. We could now select some 496 completion from the list, but instead let's just type 'C-g' to dismiss 497 the completion, since we wanted to test completion, not write any actual 498 'destructuring-bind' expression. 499 500 Remember the traced functions in the Trace Dialog? Time to see if we 501 got any traces. let's type 'C-c T' to switch to that buffer, and then 502 type capital 'G'. This should produce a fair number of traces organized 503 in a call graph. 504 505 506 507 508 509 We can later learn more about this mode (*note Trace Dialog::), but 510 for now let’s again pretend we expected the function 'FLEX-SCORE' to 511 return a wildly different score for 'COMMON-LISP:DESTRUCTURING-BIND'. 512 In that case we should like to witness said 'FLEX-SCORE' function 513 respond to any implementation improvements we perform. To do so, it's 514 useful to be able to surgically re-run that function with those very 515 same arguments. Let's do this by finding the function call in the Trace 516 Dialog window, right-clicking it with the mouse and selecting "Copy call 517 to REPL". Pressing 'M-S-RET' on it should accomplish the same. We are 518 automatically transported to the REPL again, where the desired function 519 call has already been typed out for us at the command prompt, awaiting a 520 confirmation 'RET', which will run the function call: 521 522 ; The actual arguments passed to trace 15 523 "desbind" 524 "COMMON-LISP:DESTRUCTURING-BIND" 525 (12 13 14 26 27 28 29) 526 SLYNK-COMPLETION> (slynk-completion::flex-score #v1:0 #v1:1 #v1:2) 527 0.003030303 (0.30303028%) 528 SLYNK-COMPLETION> 529 530 531 532 533 534 If those '#v...''s look odd, here’s what’s going on: to copy the call 535 to the REPL, SLY first copied over its actual arguments, and then wrote 536 the function using special _backreferences_ to those arguments in the 537 correct place. These are the '#v4:0' and '#v4:1' bits seen at the 538 command prompt. If one puts the cursor on them or hovers with the 539 mouse, this highlights the corresponding object a few lines above in the 540 buffer. Later, you can also try typing "#v" at the REPL to 541 incrementally write your own backreferences (*note REPL 542 backreferences::). 543 544 For one final demonstration, let’s now suppose say we are still 545 intrigued by how that function ('FLEX-SCORE') works internally. So 546 let's navigate to its definition using 'M-.' again (or just open the 547 'slynk-completion.lisp' buffer that you probably still have open). The 548 function’s code might look like this: 549 550 (defun flex-score (pattern string indexes) 551 "Score the match of PATTERN on STRING. 552 INDEXES as calculated by FLEX-MATCHES" 553 ;; FIXME: hideously naive scoring 554 (declare (ignore pattern)) 555 (float 556 (/ 1 557 (* (length string) 558 (max 1 559 (reduce #'+ 560 (loop for (a b) on indexes 561 while b 562 collect (- b a 1)))))))) 563 564 Can this function be working correctly? What do all those 565 expressions return? Should we reach for good old C-style 'printf'? 566 Let's try "stickers" instead. SLY's stickers are a form of 567 non-intrusive function instrumentation that work like carefully crafted 568 'print' or '(format t ...)'), but are much easier to work with. You can 569 later read more about them (*note Stickers::), but for now you can just 570 think of them as colorful labels placed on s-exp’s. Let’s place a bunch 571 here, like this: 572 573 1. on the last line of 'flex-score', place your cursor on the first 574 open parenthesis of that line (the opening parenthesis of the 575 expression '(- b a 1)') and press 'C-c C-s C-s'; 576 577 2. now do the same for the symbol 'indexes' a couple of lines above; 578 579 3. again, the same for the expressions '(loop...)', '(reduce...)', 580 '(max...)', '(length...)', '(*...)', '(/... )' and '(float...)'. 581 You could have done this in any order, by the way; 582 583 Now let’s recompile this definition with 'C-c C-c'. Beside the 584 minibuffer note something about stickers being "armed" our function 585 should now look like a rainbow in blue. 586 587 588 589 590 591 Now we return to the SLY REPL, but this time let’s use 'C-c ~' 592 (that’s 'C-c' followed by "tilde") to do so. This syncs the REPL’s 593 local package and local directory to the Lisp file that we’re visiting. 594 This is something not strictly necessary here but generally convenient 595 when hacking on a system, because you can now call functions from the 596 file you came from without package-qualification. 597 598 Now, to re-run the newly instrumented function, by calling it with 599 the same arguments. No need to type all that again, because this REPL 600 supports reverse history i-search, remember? So just type the binding 601 'C-r' and then type something like 'scor' to search history backwards 602 and arrive at the function call copied to the REPL earlier. Type 'RET' 603 once to confirm that's the call your after, and 'RET' again to evaluate 604 it. Because those '#v...' backreferences are still trained specifically 605 on those very same function arguments, you can be sure that the function 606 call is equivalent. 607 608 We can now use the 'C-c C-s C-r' to _replay_ the sticker recordings 609 of this last function call. This is a kind of slow walk-through 610 conducted in separate navigation window called '*sly-stickers-replay*' 611 which pops up. There we can see the Lisp value(s) that each sticker 612 'eval'’ed to each time (or a note if it exited non-locally). We can 613 navigate recordings with 'n' and 'p', and do the usual things allowed by 614 interactive objects like inspecting them and returning them to the REPL. 615 If you need help, toggle help by typing 'h'. There are lots of options 616 here for navigating stickers, ignoring some stickers, etc. When we’re 617 done in this window, we press 'q' to quit. 618 619 620 621 622 623 Finally, we declare that we’re finished debugging 'FLEX-MATCHES'. 624 Even though stickers don’t get saved to the file in any way, we decide 625 we’re not interested in them anymore. So let’s open the "SLY" menu in 626 the menu bar, find the "Delete stickers from top-level form" option 627 under the "Stickers" sub-menu, and click it. Alternatively, we could 628 have typed 'C-u C-c C-s C-s'. 629 630 631 File: sly.info, Node: Working with source files, Next: Common functionality, Prev: A SLY tour for SLIME users, Up: Top 632 633 4 Working with source files 634 *************************** 635 636 SLY's commands when editing a Lisp file are provided via 637 'sly-editing-mode', a minor-mode used in conjunction with Emacs's 638 'lisp-mode'. 639 640 This chapter describes SLY’s commands for editing and working in Lisp 641 source buffers. There are, of course, more SLY’s commands that also 642 apply to these buffers (*note Common functionality::), but with very few 643 exceptions these commands will always be run from a '.lisp' file. 644 645 * Menu: 646 647 * Evaluation:: 648 * Compilation:: 649 * Autodoc:: 650 * Semantic indentation:: 651 * Reader conditionals:: 652 * Macro-expansion:: 653 654 655 File: sly.info, Node: Evaluation, Next: Compilation, Up: Working with source files 656 657 4.1 Evaluating code 658 =================== 659 660 These commands each evaluate a Common Lisp expression in a different 661 way. Usually they mimic commands for evaluating Emacs Lisp code. By 662 default they show their results in the echo area, but a prefix argument 663 'C-u' inserts the results into the current buffer, while a negative 664 prefix argument 'M--' sends them to the kill ring. 665 666 'C-x C-e' 667 'M-x sly-eval-last-expression' 668 669 Evaluate the expression before point and show the result in the 670 echo area. 671 672 'C-M-x' 673 'M-x sly-eval-defun' 674 Evaluate the current toplevel form and show the result in the echo 675 area. 'C-M-x' treats 'defvar' expressions specially. Normally, 676 evaluating a 'defvar' expression does nothing if the variable it 677 defines already has a value. But 'C-M-x' unconditionally resets 678 the variable to the initial value specified in the 'defvar' 679 expression. This special feature is convenient for debugging Lisp 680 programs. 681 682 If 'C-M-x' or 'C-x C-e' is given a numeric argument, it inserts the 683 value into the current buffer, rather than displaying it in the echo 684 area. 685 686 'C-c :' 687 'M-x sly-interactive-eval' 688 Evaluate an expression read from the minibuffer. 689 690 'C-c C-r' 691 'M-x sly-eval-region' 692 Evaluate the region. 693 694 'C-c C-p' 695 'M-x sly-pprint-eval-last-expression' 696 Evaluate the expression before point and pretty-print the result in 697 a fresh buffer. 698 699 'C-c E' 700 'M-x sly-edit-value' 701 Edit the value of a setf-able form in a new buffer '*Edit <form>*'. 702 The value is inserted into a temporary buffer for editing and then 703 set in Lisp when committed with 'C-c C-c'. 704 705 'C-c C-u' 706 'M-x sly-undefine-function' 707 Undefine the function, with 'fmakunbound', for the symbol at point. 708 709 710 File: sly.info, Node: Compilation, Next: Autodoc, Prev: Evaluation, Up: Working with source files 711 712 4.2 Compiling functions and files 713 ================================= 714 715 SLY has fancy commands for compiling functions, files, and packages. 716 The fancy part is that notes and warnings offered by the Lisp compiler 717 are intercepted and annotated directly onto the corresponding 718 expressions in the Lisp source buffer. (Give it a try to see what this 719 means.) 720 721 'C-c C-c' 722 'M-x sly-compile-defun' 723 Compile the top-level form at point. The region blinks shortly to 724 give some feedback which part was chosen. 725 726 With (positive) prefix argument the form is compiled with maximal 727 debug settings ('C-u C-c C-c'). With negative prefix argument it 728 is compiled for speed ('M-- C-c C-c'). If a numeric argument is 729 passed set debug or speed settings to it depending on its sign. 730 731 The code for the region is executed after compilation. In 732 principle, the command writes the region to a file, compiles that 733 file, and loads the resulting code. 734 735 This compilation may arm stickers (*note Stickers::). 736 737 'C-c C-k' 738 'M-x sly-compile-and-load-file' 739 Compile and load the current buffer's source file. If the 740 compilation step fails, the file is not loaded. It's not always 741 easy to tell whether the compilation failed: occasionally you may 742 end up in the debugger during the load step. 743 744 With (positive) prefix argument the file is compiled with maximal 745 debug settings ('C-u C-c C-k'). With negative prefix argument it 746 is compiled for speed ('M-- C-c C-k'). If a numeric argument is 747 passed set debug or speed settings to it depending on its sign. 748 749 This compilation may arm stickers (*note Stickers::). 750 751 'C-c M-k' 752 'M-x sly-compile-file' 753 Compile (but don't load) the current buffer's source file. 754 755 'C-c C-l' 756 'M-x sly-load-file' 757 Load a Lisp file. This command uses the Common Lisp LOAD function. 758 759 'M-x sly-compile-region' 760 Compile the selected region. 761 762 This compilation may arm stickers (*note Stickers::). 763 764 The annotations are indicated as underlining on source forms. The 765 compiler message associated with an annotation can be read either by 766 placing the mouse over the text or with the selection commands below. 767 768 'M-n' 769 'M-x sly-next-note' 770 Move the point to the next compiler note and displays the note. 771 772 'M-p' 773 'M-x sly-previous-note' 774 Move the point to the previous compiler note and displays the note. 775 776 'C-c M-c' 777 'M-x sly-remove-notes' 778 Remove all annotations from the buffer. 779 780 'C-x `' 781 'M-x next-error' 782 Visit the next-error message. This is not actually a SLY command 783 but SLY creates a hidden buffer so that most of the Compilation 784 mode commands (*note (emacs)Compilation Mode::) work similarly for 785 Lisp as for batch compilers. 786 787 788 File: sly.info, Node: Autodoc, Next: Semantic indentation, Prev: Compilation, Up: Working with source files 789 790 4.3 Autodoc 791 =========== 792 793 SLY automatically shows information about symbols near the point. For 794 function names the argument list is displayed, and for global variables, 795 the value. Autodoc is implemented by means of 'eldoc-mode' of Emacs. 796 797 'M-x sly-arglist NAME' 798 Show the argument list of the function NAME. 799 800 'M-x sly-autodoc-mode' 801 Toggles autodoc-mode on or off according to the argument, and 802 toggles the mode when invoked without argument. 803 'M-x sly-autodoc-manually' 804 Like sly-autodoc, but when called twice, or after sly-autodoc was 805 already automatically called, display multiline arglist. 806 807 If 'sly-autodoc-use-multiline-p' is set to non-nil, allow long 808 autodoc messages to resize echo area display. 809 810 'autodoc-mode' is a SLY extension and can be turned off if you so 811 wish (*note Extensions::) 812 813 814 File: sly.info, Node: Semantic indentation, Next: Reader conditionals, Prev: Autodoc, Up: Working with source files 815 816 4.4 Semantic indentation 817 ======================== 818 819 SLY automatically discovers how to indent the macros in your Lisp 820 system. To do this the Lisp side scans all the macros in the system and 821 reports to Emacs all the ones with '&body' arguments. Emacs then 822 indents these specially, putting the first arguments four spaces in and 823 the "body" arguments just two spaces, as usual. 824 825 This should "just work." If you are a lucky sort of person you 826 needn't read the rest of this section. 827 828 To simplify the implementation, SLY doesn't distinguish between 829 macros with the same symbol-name but different packages. This makes it 830 fit nicely with Emacs's indentation code. However, if you do have 831 several macros with the same symbol-name then they will all be indented 832 the same way, arbitrarily using the style from one of their arglists. 833 You can find out which symbols are involved in collisions with: 834 835 (slynk:print-indentation-lossage) 836 837 If a collision causes you irritation, don't have a nervous breakdown, 838 just override the Elisp symbol's 'sly-common-lisp-indent-function' 839 property to your taste. SLY won't override your custom settings, it 840 just tries to give you good defaults. 841 842 A more subtle issue is that imperfect caching is used for the sake of 843 performance. (1) 844 845 In an ideal world, Lisp would automatically scan every symbol for 846 indentation changes after each command from Emacs. However, this is too 847 expensive to do every time. Instead Lisp usually just scans the symbols 848 whose home package matches the one used by the Emacs buffer where the 849 request comes from. That is sufficient to pick up the indentation of 850 most interactively-defined macros. To catch the rest we make a full 851 scan of every symbol each time a new Lisp package is created between 852 commands - that takes care of things like new systems being loaded. 853 854 You can use 'M-x sly-update-indentation' to force all symbols to be 855 scanned for indentation information. 856 857 ---------- Footnotes ---------- 858 859 (1) _Of course_ we made sure it was actually too slow before making 860 the ugly optimization. 861 862 863 File: sly.info, Node: Reader conditionals, Next: Macro-expansion, Prev: Semantic indentation, Up: Working with source files 864 865 4.5 Reader conditional fontification 866 ==================================== 867 868 SLY automatically evaluates reader-conditional expressions, like 869 '#+linux', in source buffers and "grays out" code that will be skipped 870 for the current Lisp connection. 871 872 873 File: sly.info, Node: Macro-expansion, Prev: Reader conditionals, Up: Working with source files 874 875 4.6 Macro-expansion commands 876 ============================ 877 878 'C-c C-m' 879 'M-x sly-expand-1' 880 Macroexpand (or compiler-macroexpand) the expression at point once. 881 If invoked with a prefix argument use macroexpand instead or 882 macroexpand-1 (or compiler-macroexpand instead of 883 compiler-macroexpand-1). 884 885 'M-x sly-macroexpand-1' 886 Macroexpand the expression at point once. If invoked with a prefix 887 argument, use macroexpand instead of macroexpand-1. 888 889 'C-c M-m' 890 'M-x sly-macroexpand-all' 891 Fully macroexpand the expression at point. 892 893 'M-x sly-compiler-macroexpand-1' 894 Display the compiler-macro expansion of sexp at point. 895 896 'M-x sly-compiler-macroexpand' 897 Repeatedly expand compiler macros of sexp at point. 898 899 'M-x sly-format-string-expand' 900 Expand the format-string at point and display it. With prefix arg, 901 or if no string at point, prompt the user for a string to expand. 902 903 Within a sly macroexpansion buffer some extra commands are provided 904 (these commands are always available but are only bound to keys in a 905 macroexpansion buffer). 906 907 'C-c C-m' 908 'M-x sly-macroexpand-1-inplace' 909 Just like sly-macroexpand-1 but the original form is replaced with 910 the expansion. 911 912 'g' 913 'M-x sly-macroexpand-1-inplace' 914 The last macroexpansion is performed again, the current contents of 915 the macroexpansion buffer are replaced with the new expansion. 916 917 'q' 918 'M-x sly-temp-buffer-quit' 919 Close the expansion buffer. 920 921 'C-_' 922 'M-x sly-macroexpand-undo' 923 Undo last macroexpansion operation. 924 925 926 File: sly.info, Node: Common functionality, Next: The REPL and other special buffers, Prev: Working with source files, Up: Top 927 928 5 Common functionality 929 ********************** 930 931 This chapter describes the commands available throughout SLY-enabled 932 buffers, which are not only Lisp source buffers, but every auxiliary 933 buffer created by SLY, such as the REPL, Inspector, etc (*note The REPL 934 and other special buffers::) In general, it’s a good bet that if the 935 buffer’s name starts with '*sly-...*', these commands and functionality 936 will be available there. 937 938 * Menu: 939 940 * Finding definitions:: 941 * Cross-referencing:: 942 * Completion:: 943 * Interactive objects:: 944 * Documentation:: 945 * Multiple connections:: 946 * Disassembly:: 947 * Recovery:: 948 * Temporary buffers:: 949 * Multi-threading:: 950 951 952 File: sly.info, Node: Finding definitions, Next: Cross-referencing, Up: Common functionality 953 954 5.1 Finding definitions 955 ======================= 956 957 One of the most used keybindings across all of SLY is the familiar 'M-.' 958 binding for 'sly-edit-definition'. 959 960 Here's the gist of it: when pressed with the cursor over a symbol 961 name, that symbol's name definition is looked up by the Lisp process, 962 thus producing a Lisp source location, which might be a file, or a 963 file-less buffer. For convenience, a type of "breadcrumb" is left 964 behind at the original location where 'M-.' was pressed, so that another 965 keybinding 'M-,' takes the user back to the original location. Thus 966 multiple 'M-.' trace a path through lisp sources that can be traced back 967 with an equal number of 'M-,'. 968 969 'M-.' 970 'M-x sly-edit-definition' 971 Go to the definition of the symbol at point. 972 973 'M-,' 974 'M-*' 975 'M-x sly-pop-find-definition-stack' 976 Go back to the point where 'M-.' was invoked. This gives 977 multi-level backtracking when 'M-.' has been used several times. 978 979 'C-x 4 .' 980 'M-x sly-edit-definition-other-window' 981 Like 'sly-edit-definition' but switches to the other window to edit 982 the definition in. 983 984 'C-x 5 .' 985 'M-x sly-edit-definition-other-frame' 986 Like 'sly-edit-definition' but opens another frame to edit the 987 definition in. 988 989 The behaviour of the 'M-.' binding is sometimes affected by the type 990 of symbol you are giving it. 991 992 * For single functions or variables, 'M-.' immediately switches the 993 current window's buffer and position to the target 'defun' or 994 'defvar'. 995 996 * For symbols with more than one associated definition, say, generic 997 functions, the same 'M-.' finds all methods and presents these 998 results in separate window displaying a special '*sly-xref*' buffer 999 (*note Cross-referencing::). 1000 1001 1002 File: sly.info, Node: Cross-referencing, Next: Completion, Prev: Finding definitions, Up: Common functionality 1003 1004 5.2 Cross-referencing 1005 ===================== 1006 1007 Finding and presenting the definition of a function is actually the most 1008 elementary aspect of broader _cross-referencing_ facilities framework in 1009 SLY. There are other types of questions about the source code relations 1010 that you can ask the Lisp process.(1) 1011 1012 The following keybindings behave much like the 'M-.' keybinding 1013 (*note Finding definitions::): when pressed as is they make a query 1014 about the symbol at point, but with a 'C-u' prefix argument they prompt 1015 the user for a symbol. Importantly, they always popup a transient 1016 '*sly-xref*' buffer in a different window. 1017 1018 'M-?' 1019 'M-x sly-edit-uses' 1020 Find all the references to this symbol, whatever the type of that 1021 reference. 1022 1023 'C-c C-w C-c' 1024 'M-x sly-who-calls' 1025 Show function callers. 1026 1027 'C-c C-w C-w' 1028 'M-x sly-calls-who' 1029 Show all known callees. 1030 1031 'C-c C-w C-r' 1032 'M-x sly-who-references' 1033 Show references to global variable. 1034 1035 'C-c C-w C-b' 1036 'M-x sly-who-binds' 1037 Show bindings of a global variable. 1038 1039 'C-c C-w C-s' 1040 'M-x sly-who-sets' 1041 Show assignments to a global variable. 1042 1043 'C-c C-w C-m' 1044 'M-x sly-who-macroexpands' 1045 Show expansions of a macro. 1046 1047 'M-x sly-who-specializes' 1048 Show all known methods specialized on a class. 1049 1050 There are two further "List callers/callees" commands that operate by 1051 rummaging through function objects on the heap at a low-level to 1052 discover the call graph. They are only available with some Lisp 1053 systems, and are most useful as a fallback when precise XREF information 1054 is unavailable. 1055 1056 'C-c <' 1057 'M-x sly-list-callers' 1058 List callers of a function. 1059 1060 'C-c >' 1061 'M-x sly-list-callees' 1062 List callees of a function. 1063 1064 In the resulting '*sly-xref*' buffer, these commands are available: 1065 1066 'RET' 1067 'M-x sly-show-xref' 1068 Show definition at point in the other window. Do not leave the 1069 '*sly-xref' buffer. 1070 1071 'Space' 1072 'M-x sly-goto-xref' 1073 Show definition at point in the other window and close the 1074 '*sly-xref' buffer. 1075 1076 'C-c C-c' 1077 'M-x sly-recompile-xref' 1078 Recompile definition at point. Uses prefix arguments like 1079 'sly-compile-defun'. 1080 1081 'C-c C-k' 1082 'M-x sly-recompile-all-xrefs' 1083 Recompile all definitions. Uses prefix arguments like 1084 'sly-compile-defun'. 1085 1086 ---------- Footnotes ---------- 1087 1088 (1) This depends on the underlying implementation of some of these 1089 facilities: for systems with no built-in XREF support SLY queries a 1090 portable XREF package, which is taken from the 'CMU AI Repository' and 1091 bundled with SLY. 1092 1093 1094 File: sly.info, Node: Completion, Next: Interactive objects, Prev: Cross-referencing, Up: Common functionality 1095 1096 5.3 Auto-completion 1097 =================== 1098 1099 Completion commands are used to complete a symbol or form based on what 1100 is already present at point. Emacs has many completion mechanisms that 1101 SLY tries to mimic as much as possible. 1102 1103 SLY provides two styles of completion. The choice between them 1104 happens in the Emacs customization variable *note 1105 sly-complete-symbol-function::, which can be set to two values, or 1106 methods: 1107 1108 1. 'sly-flex-completions' This method is speculative. It assumes that 1109 the letters you've already typed aren't necessarily an exact prefix 1110 of the symbol you're thinking of. Therefore, any possible 1111 completion that contains these letters, in the order that you have 1112 typed them, is potentially a match. Completion matches are then 1113 sorted according to a score that should reflect the probability 1114 that you really meant that them. 1115 1116 Flex completion implies that the package-qualification needed to 1117 access some symbols is automatically discovered for you. However, 1118 to avoid searching too many symbols unnecessarily, this method 1119 makes some minimal assumptions that you can override: it assumes, 1120 for example, that you don't normally want to complete to fully 1121 qualified internal symbols, but will do so if it finds two 1122 consecutive colons ('::') in your initial pattern. Similarly, it 1123 assumes that if you start a completion on a word starting ':', you 1124 must mean a keyword (a symbol from the keyword package.) 1125 1126 Here are the top results for some typical searches. 1127 1128 CL-USER> (quiloa<TAB>) -> (ql:quickload) 1129 CL-USER> (mvbind<TAB>) -> (multiple-value-bind) 1130 CL-USER> (scan<TAB>) -> (ppcre:scan) 1131 CL-USER> (p::scan<TAB>) -> (ppcre::scanner) 1132 CL-USER> (setf locadirs<TAB>) -> (setf ql:*local-project-directories*) 1133 CL-USER> foobar -> asdf:monolithic-binary-op 1134 1135 2. 'sly-simple-completions' This method uses "classical" completion on 1136 an exact prefix. Although poorer, this is simpler, more 1137 predictable and closer to the default Emacs completion method. You 1138 type a prefix for a symbol reference and SLY let's you choose from 1139 symbols whose beginnings match it exactly. 1140 1141 As an enhancement in SLY over Emacs' built-in completion styles, when 1142 the '*sly-completions*' buffer pops up, some keybindings are momentarily 1143 diverted to it: 1144 1145 'C-n' 1146 '<down>' 1147 'M-x sly-next-completion' 1148 Select the next completion. 1149 1150 'C-p' 1151 '<up>' 1152 'M-x sly-prev-completion' 1153 Select the previous completion. 1154 1155 'tab' 1156 'RET' 1157 'M-x sly-choose-completion' 1158 Choose the currently selected completion and enter it at point. 1159 1160 As soon as the user selects a completion or gives up by pressing 1161 'C-g' or moves out of the symbol being completed, the 1162 '*sly-completions*' buffer is closed. 1163 1164 1165 File: sly.info, Node: Interactive objects, Next: Documentation, Prev: Completion, Up: Common functionality 1166 1167 5.4 Interactive objects 1168 ======================= 1169 1170 In many buffers and modes in SLY, there are snippets of text that 1171 represent objects "living" in the Lisp process connected to SLY. These 1172 regions are known in SLY as interactive values or objects. You can tell 1173 these objects from regular text by their distinct "face", is Emacs 1174 parlance for text colour, or decoration. Another way to check if bit of 1175 text is an interactive object is to hover above it with the mouse and 1176 right-click ('<mouse-3>') it: a context menu will appear listing actions 1177 that you can take on that object. 1178 1179 Depending on the mode, different actions may be active for different 1180 types of objects. Actions can also be invoked using keybindings active 1181 only when the cursor is on the button. 1182 1183 'M-RET, ``Copy to REPL''' 1184 1185 Copy the object to the main REPL (*note REPL output:: and *note 1186 REPL backreferences::). 1187 1188 'M-S-RET, ``Copy call to REPL''' 1189 1190 An experimental feature. On some backtrace frames in the Debugger 1191 (*note Debugger::) and Trace Dialog (*note Trace Dialog::), copy 1192 the object to the main REPL. That’s _meta-shift-return_, by the 1193 way, there’s no capital "S". 1194 1195 '.,''Go To Source''' 1196 1197 For function symbols, debugger frames, or traced function calls, go 1198 to the Lisp source, much like with 'M-.'. 1199 1200 'v,''Show Source''' 1201 1202 For function symbols, debugger frames, or traced function calls, 1203 show the Lisp source in another window, but don’t switch to it. 1204 1205 'p,''Pretty Print''' 1206 1207 Pretty print the object in a separate buffer, much like 1208 'sly-pprint-eval-last-expression'. 1209 1210 'i,''Inspect''' 1211 1212 Inspect the object in a separate inspector buffer (*note 1213 Inspector::). 1214 1215 'd,''Describe''' 1216 1217 Describe the object in a separate buffer using Lisp’s 1218 'CL:DESCRIBE'. 1219 1220 1221 File: sly.info, Node: Documentation, Next: Multiple connections, Prev: Interactive objects, Up: Common functionality 1222 1223 5.5 Documentation commands 1224 ========================== 1225 1226 SLY's online documentation commands follow the example of Emacs Lisp. 1227 The commands all share the common prefix 'C-c C-d' and allow the final 1228 key to be modified or unmodified (*note Keybindings::.) 1229 1230 'M-x sly-info' 1231 This command should land you in an electronic version of this very 1232 manual that you can read inside Emacs. 1233 1234 'C-c C-d C-d' 1235 'M-x sly-describe-symbol' 1236 Describe the symbol at point. 1237 1238 'C-c C-d C-f' 1239 'M-x sly-describe-function' 1240 Describe the function at point. 1241 1242 'C-c C-d C-a' 1243 'M-x sly-apropos' 1244 Perform an apropos search on Lisp symbol names for a regular 1245 expression match and display their documentation strings. By 1246 default the external symbols of all packages are searched. With a 1247 prefix argument you can choose a specific package and whether to 1248 include unexported symbols. 1249 1250 'C-c C-d C-z' 1251 'M-x sly-apropos-all' 1252 Like 'sly-apropos' but also includes internal symbols by default. 1253 1254 'C-c C-d C-p' 1255 'M-x sly-apropos-package' 1256 Show apropos results of all symbols in a package. This command is 1257 for browsing a package at a high-level. With package-name 1258 completion it also serves as a rudimentary Smalltalk-ish 1259 image-browser. 1260 1261 'C-c C-d C-h' 1262 'M-x sly-hyperspec-lookup' 1263 Lookup the symbol at point in the 'Common Lisp Hyperspec'. This 1264 uses the familiar 'hyperspec.el' to show the appropriate section in 1265 a web browser. The Hyperspec is found either on the Web or in 1266 'common-lisp-hyperspec-root', and the browser is selected by 1267 'browse-url-browser-function'. 1268 1269 Note: this is one case where 'C-c C-d h' is _not_ the same as 'C-c 1270 C-d C-h'. 1271 1272 'C-c C-d ~' 1273 'M-x hyperspec-lookup-format' 1274 Lookup a _format character_ in the 'Common Lisp Hyperspec'. 1275 1276 'C-c C-d #' 1277 'M-x hyperspec-lookup-reader-macro' 1278 Lookup a _reader macro_ in the 'Common Lisp Hyperspec'. 1279 1280 1281 File: sly.info, Node: Multiple connections, Next: Disassembly, Prev: Documentation, Up: Common functionality 1282 1283 5.6 Multiple connections 1284 ======================== 1285 1286 SLY is able to connect to multiple Lisp processes at the same time. The 1287 'M-x sly' command, when invoked with a prefix argument, will offer to 1288 create an additional Lisp process if one is already running. This is 1289 often convenient, but it requires some understanding to make sure that 1290 your SLY commands execute in the Lisp that you expect them to. 1291 1292 Some SLY buffers are tied to specific Lisp processes. It’s easy read 1293 that from the buffer’s name which will usually be '*sly-<something> for 1294 <connection>*', where 'connection' is the name of the connection. 1295 1296 Each Lisp connection has its own main REPL buffer (*note REPL::), and 1297 all expressions entered or SLY commands invoked in that buffer are sent 1298 to the associated connection. Other buffers created by SLY are 1299 similarly tied to the connections they originate from, including SLY-DB 1300 buffers (*note Debugger::), apropos result listings, and so on. These 1301 buffers are the result of some interaction with a Lisp process, so 1302 commands in them always go back to that same process. 1303 1304 Commands executed in other places, such as 'sly-mode' source buffers, 1305 always use the "default" connection. Usually this is the most recently 1306 established connection, but this can be reassigned via the "connection 1307 list" buffer: 1308 1309 'C-c C-x c' 1310 'M-x sly-list-connections' 1311 Pop up a buffer listing the established connections. 1312 1313 'C-c C-x n' 1314 'M-x sly-next-connection' 1315 Switch to the next Lisp connection by cycling through all 1316 connections. 1317 1318 'C-c C-x p' 1319 'M-x sly-prev-connection' 1320 Switch to the previous Lisp connection by cycling through all 1321 connections. 1322 1323 The buffer displayed by 'sly-list-connections' gives a one-line 1324 summary of each connection. The summary shows the connection's serial 1325 number, the name of the Lisp implementation, and other details of the 1326 Lisp process. The current "default" connection is indicated with an 1327 asterisk. 1328 1329 The commands available in the connection-list buffer are: 1330 1331 'RET' 1332 'M-x sly-goto-connection' 1333 Pop to the REPL buffer of the connection at point. 1334 1335 'd' 1336 'M-x sly-connection-list-make-default' 1337 Make the connection at point the "default" connection. It will 1338 then be used for commands in 'sly-mode' source buffers. 1339 1340 'g' 1341 'M-x sly-update-connection-list' 1342 Update the connection list in the buffer. 1343 1344 'q' 1345 'M-x sly-temp-buffer-quit' 1346 Quit the connection list (kill buffer, restore window 1347 configuration). 1348 1349 'R' 1350 'M-x sly-restart-connection-at-point' 1351 Restart the Lisp process for the connection at point. 1352 1353 'M-x sly-connect' 1354 Connect to a running Slynk server. With prefix argument, asks if 1355 all connections should be closed first. 1356 1357 'M-x sly-disconnect' 1358 Disconnect all connections. 1359 1360 'M-x sly-abort-connection' 1361 Abort the current attempt to connect. 1362 1363 1364 File: sly.info, Node: Disassembly, Next: Recovery, Prev: Multiple connections, Up: Common functionality 1365 1366 5.7 Disassembly commands 1367 ======================== 1368 1369 'C-c M-d' 1370 'M-x sly-disassemble-symbol' 1371 Disassemble the function definition of the symbol at point. 1372 1373 'C-c C-t' 1374 'M-x sly-toggle-trace-fdefinition' 1375 Toggle tracing of the function at point. If invoked with a prefix 1376 argument, read additional information, like which particular method 1377 should be traced. 1378 1379 'M-x sly-untrace-all' 1380 Untrace all functions. 1381 1382 1383 File: sly.info, Node: Recovery, Next: Temporary buffers, Prev: Disassembly, Up: Common functionality 1384 1385 5.8 Abort/Recovery commands 1386 =========================== 1387 1388 'C-c C-b' 1389 'M-x sly-interrupt' 1390 Interrupt Lisp (send 'SIGINT'). 1391 1392 'M-x sly-restart-inferior-lisp' 1393 Restart the 'inferior-lisp' process. 1394 1395 'C-c ~' 1396 'M-x sly-mrepl-sync' 1397 Synchronize the current package and working directory from Emacs to 1398 Lisp. 1399 1400 'M-x sly-cd' 1401 Set the current directory of the Lisp process. This also changes 1402 the current directory of the REPL buffer. 1403 1404 'M-x sly-pwd' 1405 Print the current directory of the Lisp process. 1406 1407 1408 File: sly.info, Node: Temporary buffers, Next: Multi-threading, Prev: Recovery, Up: Common functionality 1409 1410 5.9 Temporary buffers 1411 ===================== 1412 1413 Some SLY commands create temporary buffers to display their results. 1414 Although these buffers usually have their own special-purpose 1415 major-modes, certain conventions are observed throughout. 1416 1417 Temporary buffers can be dismissed by pressing 'q'. This kills the 1418 buffer and restores the window configuration as it was before the buffer 1419 was displayed. Temporary buffers can also be killed with the usual 1420 commands like 'kill-buffer', in which case the previous window 1421 configuration won't be restored. 1422 1423 Pressing 'RET' is supposed to "do the most obvious useful thing." 1424 For instance, in an apropos buffer this prints a full description of the 1425 symbol at point, and in an XREF buffer it displays the source code for 1426 the reference at point. This convention is inherited from Emacs's own 1427 buffers for apropos listings, compilation results, etc. 1428 1429 Temporary buffers containing Lisp symbols use 'sly-mode' in addition 1430 to any special mode of their own. This makes the usual SLY commands 1431 available for describing symbols, looking up function definitions, and 1432 so on. 1433 1434 Initial focus of those "description" buffers depends on the variable 1435 'sly-description-autofocus'. If 'nil' (the default), description 1436 buffers do not receive focus automatically, and vice versa. 1437 1438 1439 File: sly.info, Node: Multi-threading, Prev: Temporary buffers, Up: Common functionality 1440 1441 5.10 Multi-threading 1442 ==================== 1443 1444 If the Lisp system supports multi-threading, SLY spawns a new thread for 1445 each request, e.g., 'C-x C-e' creates a new thread to evaluate the 1446 expression. An exception to this rule are requests from the REPL: all 1447 commands entered in the REPL buffer are evaluated in a dedicated REPL 1448 thread. 1449 1450 You can see a listing of the threads for the current connection with 1451 the command 'M-x sly-list-threads', or 'C-c C-x t'. This pops open a 1452 '*sly-threads*' buffer, where some keybindings to control threads are 1453 active, if you know what you are doing. The most useful is probably 'k' 1454 to kill a thread, but type 'C-h m' in that buffer to get a full listing. 1455 1456 Some complications arise with multi-threading and special variables. 1457 Non-global special bindings are thread-local, e.g., changing the value 1458 of a let bound special variable in one thread has no effect on the 1459 binding of the variables with the same name in other threads. This 1460 makes it sometimes difficult to change the printer or reader behaviour 1461 for new threads. The variable 'slynk:*default-worker-thread-bindings*' 1462 was introduced for such situations: instead of modifying the global 1463 value of a variable, add a binding the 1464 'slynk:*default-worker-thread-bindings*'. E.g., with the following 1465 code, new threads will read floating point values as doubles by default: 1466 1467 (push '(*read-default-float-format* . double-float) 1468 slynk:*default-worker-thread-bindings*). 1469 1470 1471 File: sly.info, Node: The REPL and other special buffers, Next: Customization, Prev: Common functionality, Up: Top 1472 1473 6 The REPL and other special buffers 1474 ************************************ 1475 1476 * Menu: 1477 1478 * REPL:: 1479 * Inspector:: 1480 * Debugger:: 1481 * Trace Dialog:: 1482 * Stickers:: 1483 1484 1485 File: sly.info, Node: REPL, Next: Inspector, Up: The REPL and other special buffers 1486 1487 6.1 The REPL: the "top level" 1488 ============================= 1489 1490 SLY uses a custom Read-Eval-Print Loop (REPL, also known as a "top 1491 level", or listener): 1492 1493 * Conditions signalled in REPL expressions are debugged with the 1494 integrated SLY debugger. 1495 * Return values are interactive values (*note Interactive objects::) 1496 distinguished from printed output by separate Emacs faces (colors). 1497 * Output from the Lisp process is inserted in the right place, and 1498 doesn't get mixed up with user input. 1499 * Multiple REPLs are possible in the same Lisp connection. This is 1500 useful for performing quick one-off experiments in different 1501 packages or directories without disturbing the state of an existing 1502 REPL. 1503 * The REPL is a central hub for much of SLY's functionality, since 1504 objects examined in the inspector (*note Inspector::), debugger 1505 (*note Debugger::), and other extensions can be returned there. 1506 1507 Switching to the REPL from anywhere in a SLY buffer is a very common 1508 task. One way to do it is to find the '*sly-mrepl...*' buffer in 1509 Emacs’s buffer list, but there are other ways to reach a REPL. 1510 1511 'C-c C-z' 1512 'M-x sly-mrepl' 1513 Start or select an existing main REPL buffer. 1514 1515 'M-x sly-mrepl-new' 1516 Start a new secondary REPL session, prompting for a nickname. 1517 1518 'C-c ~' 1519 'M-x sly-mrepl-sync' 1520 Go to the REPL, switching package and default directory as 1521 applicable. More precisely the Lisp variables '*package*' and 1522 '*default-pathname-defaults*' are affected by the location where 1523 the command was issued. In a specific position of a '.lisp' file, 1524 for instance the current package and that file’s directory are 1525 chosen. 1526 1527 * Menu: 1528 1529 * REPL commands:: 1530 * REPL output:: 1531 * REPL backreferences:: 1532 1533 1534 File: sly.info, Node: REPL commands, Next: REPL output, Up: REPL 1535 1536 6.1.1 REPL commands 1537 ------------------- 1538 1539 'RET' 1540 'M-x sly-mrepl-return' 1541 1542 Evaluate the expression at prompt and return the result. 1543 1544 'TAB' 1545 'M-x sly-mrepl-indent-and-complete-symbol' 1546 1547 Indent the current line. If line already indented complete the 1548 symbol at point (*note Completion::). If there is not symbol at 1549 point show the argument list of the most recently enclosed function 1550 or macro in the minibuffer. 1551 1552 'M-p' 1553 'M-x sly-mrepl-previous-input-or-button' 1554 1555 When at the current prompt, fetches previous input from the 1556 history, otherwise jumps to the previous interactive value (*note 1557 Interactive objects::) representing a Lisp object. 1558 1559 'M-n' 1560 'M-x sly-mrepl-next-input-or-button' 1561 1562 When at the current prompt, fetches next input from the history, 1563 otherwise jumps to the previous interactive value representing a 1564 Lisp object. 1565 1566 'C-r' 1567 'M-x isearch-backward' 1568 1569 This regular Emacs keybinding, when invoked at the current REPL 1570 prompt, starts a special transient mode turning the prompt into the 1571 string "History-isearch backward". While in this mode, the user 1572 can compose a string used to search backwards through history, and 1573 reverse the direction of search by pressing 'C-s'. When invoked 1574 outside the current REPL prompt, does a normal text search through 1575 the buffer contents. 1576 1577 'C-c C-b' 1578 'M-x sly-interrupt' 1579 1580 Interrupts the current thread of the inferior-lisp process. 1581 1582 For convenience this function is also bound to 'C-c C-c'. 1583 1584 'C-M-p' 1585 'M-x sly-button-backward' 1586 1587 Jump to the previous interactive value representing a Lisp object. 1588 1589 'C-M-n' 1590 'M-x sly-button-forward' 1591 1592 Jump to the next interactive value representing a Lisp object. 1593 1594 'C-c C-o' 1595 'M-x sly-mrepl-clear-recent-output' 1596 1597 Clear output between current and last REPL prompts, keeping 1598 results. 1599 1600 'C-c M-o' 1601 'M-x sly-mrepl-clear-repl' 1602 1603 Clear the whole REPL of output and results. 1604 1605 1606 File: sly.info, Node: REPL output, Next: REPL backreferences, Prev: REPL commands, Up: REPL 1607 1608 6.1.2 REPL output 1609 ----------------- 1610 1611 REPLs wouldn’t be much use if they just took user input and didn’t print 1612 anything back. In SLY the output printed to the REPL can come from four 1613 different places: 1614 1615 * A function’s return values. One line per return value is printed. 1616 Each line of printed text, called a REPL result, persists after 1617 more expressions are evaluated, and is actually a button (*note 1618 Interactive objects::) presenting the Lisp-side object. You can, 1619 for instance, inspect it (*note Inspector::) or re-return it to 1620 right before the current command prompt so that you may conjure it 1621 up again, as usual in Lisp REPLs, with the special variable '*'. 1622 1623 In the SLY REPL, in addition to the '*', '**' and '***' special 1624 variables, return values can also be accessed through a special 1625 backreference (*note REPL backreferences::). 1626 1627 * An object may be copied to the REPL from some other part in SLY, 1628 such as the Inspector (*note Inspector::), Debugger (*note 1629 Debugger::), etc. using the familiar 'M-RET' binding, or by 1630 selecting "Copy to REPL" from the context menu of an interactive 1631 object. Aside from not having been produced by the evaluation of a 1632 Lisp form in the REPL, these objects behaves exactly like a REPL 1633 result. 1634 1635 * The characters printed to the standard Lisp streams 1636 '*standard-output*', '*error-output*' and '*trace-output*' as a 1637 _synchronous_ and direct result of the evaluation of an expression 1638 in the REPL. 1639 1640 * The characters printed to the standard Lisp streams 1641 '*standard-output*', '*error-output*' and '*trace-output*' printed, 1642 perhaps _asynchronously_, from others threads, for instance. This 1643 feature is optional and controlled by the variable 1644 'SLYNK:*GLOBALLY-REDIRECT-IO*'. 1645 1646 For advanced users, there are some Lisp-side Slynk variables affecting 1647 the way Slynk transmits REPL output to SLY. 1648 1649 'SLYNK:*GLOBALLY-REDIRECT-IO*' 1650 1651 This variable controls the global redirection of the the standard 1652 streams ('*standard-output*', etc) to the REPL in Emacs. The 1653 default value is ':started-from-emacs', which means that 1654 redirection should only take place upon 'M-x sly' invocations. 1655 When 't', global redirection happens even for sessions started with 1656 'M-x sly-connect', meaning output may be diverted from wherever you 1657 started the Lisp server originally. 1658 1659 When 'NIL' these streams are only temporarily redirected to Emacs 1660 using dynamic bindings while handling requests, meaning you only 1661 see output caused by the commands you issued to the REPL. 1662 1663 Note that '*standard-input*' is currently never globally redirected 1664 into Emacs, because it can interact badly with the Lisp's native 1665 REPL by having it try to read from the Emacs one. 1666 1667 Also note that secondary REPLs (those started with 'sly-mrepl-new') 1668 don’t receive any redirected output. 1669 1670 'SLYNK:*USE-DEDICATED-OUTPUT-STREAM*' 1671 1672 This variable controls whether to use a separate socket solely for 1673 Lisp to send printed output to Emacs through, which is more 1674 efficient than sending the output in protocol messages to Emacs. 1675 1676 The default value is ':started-from-emacs', which means that the 1677 socket should only be established upon 'M-x sly' invocations. When 1678 't', it's established even for sessions started with 'M-x 1679 sly-connect'. When 'NIL' usual protocol messages are used for 1680 sending input to the REPL. 1681 1682 Notice that using a dedicated output stream makes it more difficult 1683 to communicate to a Lisp running on a remote host via SSH (*note 1684 Connecting to a remote Lisp::). If you connect via 'M-x 1685 sly-connect', the default ':started-from-emacs' value should ensure 1686 this isn't a problem. 1687 1688 'SLYNK:*DEDICATED-OUTPUT-STREAM-PORT*' 1689 1690 When '*USE-DEDICATED-OUTPUT-STREAM*' is 't' the stream will be 1691 opened on this port. The default value, '0', means that the stream 1692 will be opened on some random port. 1693 1694 'SLYNK:*DEDICATED-OUTPUT-STREAM-BUFFERING*' 1695 1696 For efficiency, some Lisps backends wait until a certain conditions 1697 are met in a Lisp character stream before flushing that stream’s 1698 contents, thus sending it to the SLY REPL. Be advised that this 1699 sometimes works poorly on some implementations, so it’s probably 1700 best to leave alone. Possible values are 'nil' (no buffering), 't' 1701 (enable buffering) or ':line' (enable buffering on EOL) 1702 1703 1704 File: sly.info, Node: REPL backreferences, Prev: REPL output, Up: REPL 1705 1706 6.1.3 REPL backreferences 1707 ------------------------- 1708 1709 In a regular Lisp REPL, the objects produced by evaluating expressions 1710 at the command prompt can usually be referenced in future commands using 1711 the special variables '*', '**' and '***'. This is also true of the SLY 1712 REPL, but it also provides a different way to re-conjure these objects 1713 through a special Lisp reader macro character available only in the 1714 REPL. The macro character, which is '#v' by default takes, in a terse 1715 syntax, two indexes specifying the precise objects in all of the SLY 1716 REPL’s recorded history. 1717 1718 Consider this fragment of a REPL session: 1719 1720 ; Cleared REPL history 1721 CL-USER> (values 'a 'b 'c) 1722 A 1723 B 1724 C 1725 CL-USER> (list #v0) 1726 (A) 1727 CL-USER> (list #v0:1 #v0:2) 1728 (B C) 1729 CL-USER> (append #v1:0 #v2:0) 1730 (A B C) 1731 CL-USER> 1732 1733 Admittedly, while useful, this doesn’t seem terribly easy to use at 1734 first sight. There are a couple of reasons, however, that should make 1735 it worth considering: 1736 1737 * Backreference annotation and highlighting 1738 1739 As soon as the SLY REPL detects that you have pressed '#v', all the 1740 REPL results that can possibly be referenced are temporarily 1741 annotated on their left with two special numbers. These numbers 1742 are in the syntax accepted by the '#v' macro-character, namely 1743 '#vENTRY-IDX:VALUE-IDX'. 1744 1745 Furthermore, as soon as you type a number for 'ENTRY-IDX', only 1746 that entries values remain highlighted. Then, as you finish the 1747 entry with 'VALUE-IDX', only that exact object remains highlighted. 1748 If you make a mistake (say, by typing a letter or an invalid 1749 number) while composing '#v' syntax, SLY lets you know by painting 1750 the backreference red. 1751 1752 Highlighting also happens when you place the cursor over existing 1753 valid '#v' expressions. 1754 1755 * Returning functions calls 1756 1757 An experimental feature in SLY allows copying _function calls_ to 1758 the REPL from the Debugger (*note Debugger::) and the Trace Dialog 1759 (*note Trace Dialog::). In those buffers, pressing keybinding 1760 'M-S-RET' over objects that represent function calls will copy the 1761 _call_, and not the object, to the REPL. This works by first 1762 copying over the argument objects in order to the REPL results, and 1763 then composing an input line that includes the called function's 1764 name and backreferences to those arguments (*note REPL 1765 backreferences::). 1766 1767 Naturally, this call isn't _exactly_ the same because it doesn’t 1768 evaluate in the same dynamic environment as the original one. But 1769 it's a useful debug technique because backreferences are stable 1770 (1), so repeating that very same function call with the very same 1771 arguments is just a matter of textually copying the previous 1772 expression into the command prompt, no matter how far ago it 1773 happened. And that, in turn, is as easy as using 'C-r' and some 1774 characters (*note REPL commands::) to arrive and repeat the desired 1775 REPL history entry. 1776 1777 ---------- Footnotes ---------- 1778 1779 (1) until you clear the REPL’s output, that is 1780 1781 1782 File: sly.info, Node: Inspector, Next: Debugger, Prev: REPL, Up: The REPL and other special buffers 1783 1784 6.2 The Inspector 1785 ================= 1786 1787 The SLY inspector is a Emacs-based alternative to the standard 'INSPECT' 1788 function. The inspector presents objects in Emacs buffers using a 1789 combination of plain text, hyperlinks to related objects. 1790 1791 The inspector can easily be specialized for the objects in your own 1792 programs. For details see the 'inspect-for-emacs' generic function in 1793 'slynk-backend.lisp'. 1794 1795 'C-c I' 1796 'M-x sly-inspect' 1797 Inspect the value of an expression entered in the minibuffer. 1798 1799 The standard commands available in the inspector are: 1800 1801 'RET' 1802 'M-x sly-inspector-operate-on-point' 1803 If point is on a value then recursively call the inspector on that 1804 value. If point is on an action then call that action. 1805 1806 'D' 1807 'M-x sly-inspector-describe-inspectee' 1808 Describe the slot at point. 1809 1810 'e' 1811 'M-x sly-inspector-eval' 1812 Evaluate an expression in the context of the inspected object. The 1813 variable '*' will be bound to the inspected object. 1814 1815 'v' 1816 'M-x sly-inspector-toggle-verbose' 1817 Toggle between verbose and terse mode. Default is determined by 1818 'slynk:*inspector-verbose*'. 1819 1820 'l' 1821 'M-x sly-inspector-pop' 1822 Go back to the previous object (return from 'RET'). 1823 1824 'n' 1825 'M-x sly-inspector-next' 1826 The inverse of 'l'. Also bound to 'SPC'. 1827 1828 'g' 1829 'M-x sly-inspector-reinspect' 1830 Reinspect. 1831 1832 'h' 1833 'M-x sly-inspector-history' 1834 Show the previously inspected objects. 1835 1836 'q' 1837 'M-x sly-inspector-quit' 1838 Dismiss the inspector buffer. 1839 1840 '>' 1841 'M-x sly-inspector-fetch-all' 1842 Fetch all inspector contents and go to the end. 1843 1844 'M-RET' 1845 'M-x sly-mrepl-copy-part-to-repl' 1846 Store the value under point in the variable '*'. This can then be 1847 used to access the object in the REPL. 1848 1849 'TAB, M-x forward-button' 1850 'S-TAB, M-x backward-button' 1851 1852 Jump to the next and previous inspectable object respectively. 1853 1854 1855 File: sly.info, Node: Debugger, Next: Trace Dialog, Prev: Inspector, Up: The REPL and other special buffers 1856 1857 6.3 The SLY-DB Debugger 1858 ======================= 1859 1860 SLY has a custom Emacs-based debugger called SLY-DB. Conditions 1861 signalled in the Lisp system invoke SLY-DB in Emacs by way of the Lisp 1862 '*DEBUGGER-HOOK*'. 1863 1864 SLY-DB pops up a buffer when a condition is signalled. The buffer 1865 displays a description of the condition, a list of restarts, and a 1866 backtrace. Commands are offered for invoking restarts, examining the 1867 backtrace, and poking around in stack frames. 1868 1869 * Menu: 1870 1871 * Examining frames:: 1872 * Restarts:: 1873 * Frame Navigation:: 1874 * Miscellaneous:: 1875 1876 1877 File: sly.info, Node: Examining frames, Next: Restarts, Up: Debugger 1878 1879 6.3.1 Examining frames 1880 ---------------------- 1881 1882 Commands for examining the stack frame at point. 1883 1884 't' 1885 'M-x sly-db-toggle-details' 1886 Toggle display of local variables and 'CATCH' tags. 1887 1888 'v' 1889 'M-x sly-db-show-frame-source' 1890 View the frame's current source expression. The expression is 1891 presented in the Lisp source file's buffer. 1892 1893 'e' 1894 'M-x sly-db-eval-in-frame' 1895 Evaluate an expression in the frame. The expression can refer to 1896 the available local variables in the frame. 1897 1898 'd' 1899 'M-x sly-db-pprint-eval-in-frame' 1900 Evaluate an expression in the frame and pretty-print the result in 1901 a temporary buffer. 1902 1903 'D' 1904 'M-x sly-db-disassemble' 1905 Disassemble the frame's function. Includes information such as the 1906 instruction pointer within the frame. 1907 1908 'i' 1909 'M-x sly-db-inspect-in-frame' 1910 Inspect the result of evaluating an expression in the frame. 1911 1912 'C-c C-c' 1913 'M-x sly-db-recompile-frame-source' 1914 Recompile frame. 'C-u C-c C-c' for recompiling with maximum debug 1915 settings. 1916 1917 1918 File: sly.info, Node: Restarts, Next: Frame Navigation, Prev: Examining frames, Up: Debugger 1919 1920 6.3.2 Invoking restarts 1921 ----------------------- 1922 1923 'a' 1924 'M-x sly-db-abort' 1925 Invoke the 'ABORT' restart. 1926 1927 'q' 1928 'M-x sly-db-quit' 1929 "Quit" - For SLY evaluation requests, invoke a restart which 1930 restores to a known program state. For errors in other threads, 1931 *Note *SLY-DB-QUIT-RESTART*::. 1932 1933 'c' 1934 'M-x sly-db-continue' 1935 Invoke the 'CONTINUE' restart. 1936 1937 '0 ... 9' 1938 'M-x sly-db-invoke-restart-n' 1939 Invoke a restart by number. 1940 1941 Restarts can also be invoked by pressing 'RET' or 'Mouse-2' on them 1942 in the buffer. 1943 1944 1945 File: sly.info, Node: Frame Navigation, Next: Miscellaneous, Prev: Restarts, Up: Debugger 1946 1947 6.3.3 Navigating between frames 1948 ------------------------------- 1949 1950 'n, M-x sly-db-down' 1951 'p, M-x sly-db-up' 1952 Move between frames. 1953 1954 'M-n, M-x sly-db-details-down' 1955 'M-p, M-x sly-db-details-up' 1956 Move between frames "with sugar": hide the details of the original 1957 frame and display the details and source code of the next. Sugared 1958 motion makes you see the details and source code for the current 1959 frame only. 1960 1961 '>' 1962 'M-x sly-db-end-of-backtrace' 1963 Fetch the entire backtrace and go to the last frame. 1964 1965 '<' 1966 'M-x sly-db-beginning-of-backtrace' 1967 Go to the first frame. 1968 1969 1970 File: sly.info, Node: Miscellaneous, Prev: Frame Navigation, Up: Debugger 1971 1972 6.3.4 Miscellaneous Commands 1973 ---------------------------- 1974 1975 'r' 1976 'M-x sly-db-restart-frame' 1977 Restart execution of the frame with the same arguments it was 1978 originally called with. (This command is not available in all 1979 implementations.) 1980 1981 'R' 1982 'M-x sly-db-return-from-frame' 1983 Return from the frame with a value entered in the minibuffer. 1984 (This command is not available in all implementations.) 1985 1986 'B' 1987 'M-x sly-db-break-with-default-debugger' 1988 Exit SLY-DB and debug the condition using the Lisp system's default 1989 debugger. 1990 1991 'C' 1992 'M-x sly-db-inspect-condition' 1993 Inspect the condition currently being debugged. 1994 1995 ':' 1996 'M-x sly-interactive-eval' 1997 Evaluate an expression entered in the minibuffer. 1998 'A' 1999 'M-x sly-db-break-with-system-debugger' 2000 Attach debugger (e.g. gdb) to the current lisp process. 2001 2002 2003 File: sly.info, Node: Trace Dialog, Next: Stickers, Prev: Debugger, Up: The REPL and other special buffers 2004 2005 6.4 Trace Dialog 2006 ================ 2007 2008 The SLY Trace Dialog, in package 'sly-trace-dialog', is a tracing 2009 facility, similar to Common Lisp's 'trace', but interactive rather than 2010 purely textual. 2011 2012 You use it just like you would regular 'trace': after tracing a 2013 function, calling it causes interesting information about that 2014 particular call to be reported. 2015 2016 However, instead of printing the trace results to the the 2017 '*trace-output*' stream (usually the REPL), the SLY Trace Dialog 2018 collects and stores them in your Lisp environment until, on user's 2019 request, they are fetched into Emacs and displayed in a dialog-like 2020 interactive view. 2021 2022 After starting up SLY, SLY's Trace Dialog installs a _Trace_ menu in 2023 the menu-bar of any 'sly-mode' buffer and adds two new commands, with 2024 respective key-bindings: 2025 2026 'C-c C-t' 2027 'M-x sly-trace-dialog-toggle-trace' 2028 If point is on a symbol name, toggle tracing of its function 2029 definition. If point is not on a symbol, prompt user for a 2030 function. 2031 2032 With a 'C-u' prefix argument, and if your lisp implementation 2033 allows it, attempt to decipher lambdas, methods and other 2034 complicated function signatures. 2035 2036 The function is traced for the SLY Trace Dialog only, i.e. it is 2037 not found in the list returned by Common Lisp's 'trace'. 2038 2039 'C-c T' 2040 'M-x sly-trace-dialog' 2041 Pop to the interactive Trace Dialog buffer associated with the 2042 current connection (*note Multiple connections::). 2043 2044 Consider the (useless) program: 2045 2046 (defun foo (n) (if (plusp n) (* n (bar (1- n))) 1)) 2047 (defun bar (n) (if (plusp n) (* n (foo (1- n))) 1)) 2048 2049 After tracing both 'foo' and 'bar' with 'C-c M-t', calling call '(foo 2050 2)' and moving to the trace dialog with 'C-c T', we are presented with 2051 this buffer. 2052 2053 Traced specs (2) [refresh] 2054 [untrace all] 2055 [untrace] common-lisp-user::bar 2056 [untrace] common-lisp-user::foo 2057 2058 Trace collection status (3/3) [refresh] 2059 [clear] 2060 2061 0 - common-lisp-user::foo 2062 | > 2 2063 | < 2 2064 1 `--- common-lisp-user::bar 2065 | > 1 2066 | < 1 2067 2 `-- common-lisp-user::foo 2068 > 0 2069 < 1 2070 2071 The dialog is divided into sections displaying the functions already 2072 traced, the trace collection progress and the actual trace tree that 2073 follow your program's logic. The most important key-bindings in this 2074 buffer are: 2075 2076 'g' 2077 'M-x sly-trace-dialog-fetch-status' 2078 Update information on the trace collection and traced specs. 2079 'G' 2080 'M-x sly-trace-dialog-fetch-traces' 2081 Fetch the next batch of outstanding (not fetched yet) traces. With 2082 a 'C-u' prefix argument, repeat until no more outstanding traces. 2083 'C-k' 2084 'M-x sly-trace-dialog-clear-fetched-traces' 2085 Prompt for confirmation, then clear all traces, both fetched and 2086 outstanding. 2087 2088 The arguments and return values below each entry are interactive 2089 buttons. Clicking them opens the inspector (*note Inspector::). 2090 Invoking 'M-RET' ('sly-trace-dialog-copy-down-to-repl') returns them to 2091 the REPL for manipulation (*note REPL::). The number left of each entry 2092 indicates its absolute position in the calling order, which might differ 2093 from display order in case multiple threads call the same traced 2094 function. 2095 2096 'sly-trace-dialog-hide-details-mode' hides arguments and return 2097 values so you can concentrate on the calling logic. Additionally, 2098 'sly-trace-dialog-autofollow-mode' will automatically display additional 2099 detail about an entry when the cursor moves over it. 2100 2101 2102 File: sly.info, Node: Stickers, Prev: Trace Dialog, Up: The REPL and other special buffers 2103 2104 6.5 Stickers 2105 ============ 2106 2107 SLY Stickers, implemented as the 'sly-stickers' contrib (*note 2108 Extensions::), is a tool for "live" code annotations. It's an 2109 alternative to the 'print' or 'break' statements you add to your code 2110 when debugging. 2111 2112 Contrary to these techniques, "stickers" are non-intrusive, meaning 2113 that saving your file doesn't save your debug code along with it. 2114 2115 Here's the general workflow: 2116 2117 * In Lisp source files, using 'C-c C-s C-s' or 'M-x 2118 sly-stickers-dwim' places a sticker on any Lisp form. Stickers can 2119 exist inside other stickers. 2120 2121 2122 2123 2124 2125 * Stickers are "armed" when a definition or a file is compiled with 2126 the familiar 'C-c C-c' ('M-x sly-compile-defun') or 'C-c C-k' ('M-x 2127 sly-compile-file') commands. An armed sticker changes color from 2128 the default grey background to a blue background. 2129 2130 2131 2132 2133 2134 From this point on, when the Lisp code is executed, the results of 2135 evaluating the underlying forms are captured in the Lisp side. Stickers 2136 help you examine your program's behaviour in three ways: 2137 1. 'C-c C-s C-r' (or 'M-x sly-stickers-replay') interactively walks 2138 the user through recordings in the order that they occurred. In 2139 the created '*sly-stickers-replay*' buffer, type 'h' for a list of 2140 keybindings active in that buffer. 2141 2142 2143 2144 2145 2146 2. To step through stickers as your code is executed, ensure that 2147 "breaking stickers" are enabled via 'M-x 2148 sly-stickers-toggle-break-on-stickers'. Whenever a sticker-covered 2149 expression is reached, the debugger comes up with useful restarts 2150 and interactive for the values produced. You can tweak this 2151 behaviour by setting the Lisp-side variable 2152 'SLYNK-STICKERS:*BREAK-ON-STICKERS*' to a list with the elements 2153 ':before' and ':after', making SLY break before a sticker, after 2154 it, or both. 2155 2156 2157 2158 2159 2160 3. 'C-c C-s S' ('M-x sly-stickers-fetch') populates the sticker 2161 overlay with the latest captured results, called "recordings". If 2162 a sticker has captured any recordings, it will turn green, 2163 otherwise it will turn red. A sticker whose Lisp expression has 2164 caused a non-local exit, will be also be marked with a special 2165 face. 2166 2167 2168 2169 2170 2171 At any point, stickers can be removed with the same 2172 'sly-stickers-dwim' keybinding, by placing the cursor at the beginning 2173 of a sticker. Additionally adding prefix arguments to 2174 'sly-stickers-dwim' increase its scope, so 'C-u C-c C-s C-s' will remove 2175 all stickers from the current function and 'C-u C-u C-c C-s C-s' will 2176 remove all stickers from the current file. 2177 2178 Stickers can be nested inside other stickers, so it is possible to 2179 record the value of an expression inside another expression which is 2180 also annotated. 2181 2182 Stickers are interactive parts just like any other part in SLY that 2183 represents Lisp-side objects, so they can be inspected and returned to 2184 the REPL, for example. To move through the stickers with the keyboard 2185 use the existing keybindings to move through compilation notes ('M-p' 2186 and 'M-n') or use 'C-c C-s p' and 'C-c C-s n' 2187 ('sly-stickers-prev-sticker' and 'sly-stickers-next-sticker'). 2188 2189 There are some caveats when using SLY Stickers: 2190 2191 * Stickers on unevaluated forms (such as 'let' variable bindings, or 2192 other constructs) are rejected, though the function is still 2193 compiled as usual. To let the user know about this, these stickers 2194 remain grey, and are marked as "disarmed". A message also appears 2195 in the echo area. 2196 * Stickers placed on expressions inside backquoted expressions in 2197 macros are always armed, even though they may come to provoke a 2198 runtime error when the macro's expansion is run. Think of this 2199 when setting a sticker inside a macro definition. 2200 2201 2202 File: sly.info, Node: Customization, Next: Tips and Tricks, Prev: The REPL and other special buffers, Up: Top 2203 2204 7 Customization 2205 *************** 2206 2207 * Menu: 2208 2209 * Emacs-side:: 2210 * Lisp-side customization:: 2211 2212 2213 File: sly.info, Node: Emacs-side, Next: Lisp-side customization, Up: Customization 2214 2215 7.1 Emacs-side 2216 ============== 2217 2218 * Menu: 2219 2220 * Keybindings:: 2221 * Keymaps:: 2222 * Defcustom variables:: 2223 * Hooks:: 2224 2225 2226 File: sly.info, Node: Keybindings, Next: Keymaps, Up: Emacs-side 2227 2228 7.1.1 Keybindings 2229 ----------------- 2230 2231 In general we try to make our key bindings fit with the overall Emacs 2232 style. 2233 2234 We never bind 'C-h' anywhere in a key sequence. This is because 2235 Emacs has a built-in default so that typing a prefix followed by 'C-h' 2236 will display all bindings starting with that prefix, so 'C-c C-d C-h' 2237 will actually list the bindings for all documentation commands. This 2238 feature is just a bit too useful to clobber! 2239 2240 "Are you deliberately spiting Emacs's brilliant online help 2241 facilities? The gods will be angry!" 2242 2243 This is a brilliant piece of advice. The Emacs online help facilities 2244 are your most immediate, up-to-date and complete resource for keybinding 2245 information. They are your friends: 2246 2247 'C-h k <key>' 2248 'describe-key' "What does this key do?" 2249 Describes current function bound to '<key>' for focus buffer. 2250 2251 'C-h b' 2252 'describe-bindings' "Exactly what bindings are available?" 2253 Lists the current key-bindings for the focus buffer. 2254 2255 'C-h m' 2256 'describe-mode' "Tell me all about this mode" 2257 Shows all the available major mode keys, then the minor mode keys, 2258 for the modes of the focus buffer. 2259 2260 'C-h l' 2261 'view-lossage' "Woah, what key chord did I just do?" 2262 Shows you the literal sequence of keys you've pressed in order. 2263 2264 For example, you can add one of the following to your Emacs init file 2265 (usually '~/.emacs' or '~/.emacs.d/init.el', but *note Init File: 2266 (emacs)Init File.). 2267 2268 (eval-after-load 'sly 2269 `(define-key sly-prefix-map (kbd "M-h") 'sly-documentation-lookup)) 2270 2271 SLY comes bundled with many extensions (called "contribs" for 2272 historical reasons, *note Extensions::) which you can customize just 2273 like SLY's code. To make 'C-c C-c' clear the last REPL prompt's output, 2274 for example, use 2275 2276 (eval-after-load 'sly-mrepl 2277 `(define-key sly-mrepl-mode-map (kbd "C-c C-k") 2278 'sly-mrepl-clear-recent-output)) 2279 2280 2281 File: sly.info, Node: Keymaps, Next: Defcustom variables, Prev: Keybindings, Up: Emacs-side 2282 2283 7.1.2 Keymaps 2284 ------------- 2285 2286 Emacs’s keybindings "live" in keymap variables. To customize a 2287 particular binding and keep it from trampling on other important keys 2288 you should do it in one of SLY's keymaps. The following non-exhaustive 2289 list of SLY-related keymaps is just a reference: the manual will go over 2290 each associated functionality in detail. 2291 2292 'sly-doc-map' 2293 2294 Keymap for documentation commands (*note Documentation::) in 2295 SLY-related buffers, accessible by the 'C-c C-d' prefix. 2296 2297 'sly-who-map' 2298 2299 Keymap for cross-referencing ("who-calls") commands (*note 2300 Cross-referencing::) in SLY-related buffers, accessible by the 'C-c 2301 C-w' prefix. 2302 2303 'sly-selector-map' 2304 2305 A keymap for SLY-related functionality that should be available in 2306 globally in all Emacs buffers (not just SLY-related buffers). 2307 2308 'sly-mode-map' 2309 2310 A keymap for functionality available in all SLY-related buffers. 2311 2312 'sly-editing-mode-map' 2313 2314 A keymap for SLY functionality available in Lisp source files. 2315 2316 'sly-popup-buffer-mode-map' 2317 2318 A keymap for functionality available in the temporary "popup" 2319 buffers that SLY displays (*note Temporary buffers::) 2320 2321 'sly-apropos-mode-map' 2322 2323 A keymap for functionality available in the temporary SLY "apropos" 2324 buffers (*note Documentation::). 2325 2326 'sly-xref-mode-map' 2327 2328 A keymap for functionality available in the temporary 'xref' 2329 buffers used by cross-referencing commands (*note 2330 Cross-referencing::). 2331 2332 'sly-macroexpansion-minor-mode-map' 2333 2334 A keymap for functionality available in the temporary buffers used 2335 for macroexpansion presentation (*note Macro-expansion::). 2336 2337 'sly-db-mode-map' 2338 2339 A keymap for functionality available in the debugger buffers used 2340 to debug errors in the Lisp process (*note Debugger::). 2341 2342 'sly-thread-control-mode-map' 2343 2344 A keymap for functionality available in the SLY buffers dedicated 2345 to controlling Lisp threads (*note Multi-threading::). 2346 2347 'sly-connection-list-mode-map' 2348 2349 A keymap for functionality available in the SLY buffers dedicated 2350 to managing multiple Lisp connections (*note Multiple 2351 connections::). 2352 2353 'sly-inspector-mode-map' 2354 2355 A keymap for functionality available in the SLY buffers dedicated 2356 to inspecting Lisp objects (*note Inspector::). 2357 2358 'sly-mrepl-mode-map' 2359 2360 A keymap for functionality available in SLY’s REPL buffers (*note 2361 REPL::). 2362 2363 'sly-trace-dialog-mode-map' 2364 2365 A keymap for functionality available in SLY’s "Trace Dialog" 2366 buffers (*note Trace Dialog::). 2367 2368 2369 File: sly.info, Node: Defcustom variables, Next: Hooks, Prev: Keymaps, Up: Emacs-side 2370 2371 7.1.3 Defcustom variables 2372 ------------------------- 2373 2374 The Emacs part of SLY can be configured with the Emacs 'customize' 2375 system, just use 'M-x customize-group sly RET'. Because the customize 2376 system is self-describing, we only cover a few important or obscure 2377 configuration options here in the manual. 2378 2379 'sly-truncate-lines' 2380 The value to use for 'truncate-lines' in line-by-line summary 2381 buffers popped up by SLY. This is 't' by default, which ensures 2382 that lines do not wrap in backtraces, apropos listings, and so on. 2383 It can however cause information to spill off the screen. 2384 2385 'sly-complete-symbol-function' 2386 The function to use for completion of Lisp symbols. Two completion 2387 styles are available: 'sly-simple-completions' and 2388 'sly-flex-completions' (*note Completion::). 2389 2390 'sly-filename-translations' 2391 This variable controls filename translation between Emacs and the 2392 Lisp system. It is useful if you run Emacs and Lisp on separate 2393 machines which don't share a common file system or if they share 2394 the filesystem but have different layouts, as is the case with 2395 SMB-based file sharing. 2396 2397 'sly-net-coding-system' 2398 If you want to transmit Unicode characters between Emacs and the 2399 Lisp system, you should customize this variable. E.g., if you use 2400 SBCL, you can set: 2401 (setq sly-net-coding-system 'utf-8-unix) 2402 To actually display Unicode characters you also need appropriate 2403 fonts, otherwise the characters will be rendered as hollow boxes. 2404 If you are using Allegro CL and GNU Emacs, you can also use 2405 'emacs-mule-unix' as coding system. GNU Emacs has often nicer 2406 fonts for the latter encoding. (Different encodings can be used 2407 for different Lisps, see *note Multiple Lisps::.) 2408 2409 'sly-keep-buffers-on-connection-close' 2410 This variable holds a list of keywords indicating SLY buffer types 2411 that should be kept around when a connection closes. For example, 2412 if the variable's value includes ':mrepl' (which is the default), 2413 REPL buffer is kept around while all other stale buffers (debugger, 2414 inspector, etc..) are automatically killed. 2415 2416 The following customization variables affect the behaviour of the 2417 REPL (*note REPL::): 2418 2419 'sly-mrepl-shortcut' 2420 The key to use to trigger the REPL's "comma shortcut". We 2421 recommend you keep the default setting which is the comma (',') 2422 key, since there's special logic in the REPL to discern if you're 2423 typing a comma inside a backquoted list or not. 2424 2425 'sly-mrepl-prompt-formatter' 2426 Holds a function that can be set from your Emacs init file (*note 2427 Init File: (emacs)Init File.) to change the way the prompt is 2428 rendered. It takes a number of arguments describing the prompt and 2429 should return a propertized Elisp string. See the default value, 2430 'sly-mrepl-default-prompt', for how to implement such a prompt. 2431 2432 'sly-mrepl-history-file-name' 2433 Holds a string designating the file to use for keeping the shared 2434 REPL histories persistently. The default is to use a hidden file 2435 named '.sly-mrepl-history' in the user's home directory. 2436 2437 'sly-mrepl-prevent-duplicate-history' 2438 A symbol. If non-nil, prevent duplicate entries in input history. 2439 If the non-nil value is the symbol 'move', the previously occuring 2440 entry is moved to a more recent spot. 2441 2442 'sly-mrepl-eli-like-history-navigation' 2443 If non-NIL, navigate history like in ELI, Franz's Common Lisp IDE 2444 for Emacs. 2445 2446 2447 File: sly.info, Node: Hooks, Prev: Defcustom variables, Up: Emacs-side 2448 2449 7.1.4 Hooks 2450 ----------- 2451 2452 'sly-mode-hook' 2453 This hook is run each time a buffer enters 'sly-mode'. It is most 2454 useful for setting buffer-local configuration in your Lisp source 2455 buffers. An example use is to enable 'sly-autodoc-mode' (*note 2456 Autodoc::). 2457 2458 'sly-connected-hook' 2459 This hook is run when SLY establishes a connection to a Lisp 2460 server. An example use is to pop to a new REPL. 2461 2462 'sly-db-hook' 2463 This hook is run after SLY-DB is invoked. The hook functions are 2464 called from the SLY-DB buffer after it is initialized. An example 2465 use is to add 'sly-db-print-condition' to this hook, which makes 2466 all conditions debugged with SLY-DB be recorded in the REPL buffer. 2467 2468 2469 File: sly.info, Node: Lisp-side customization, Prev: Emacs-side, Up: Customization 2470 2471 7.2 Lisp-side (Slynk) 2472 ===================== 2473 2474 The Lisp server side of SLY (known as "Slynk") offers several variables 2475 to configure. The initialization file '~/.slynk.lisp' is automatically 2476 evaluated at startup and can be used to set these variables. 2477 2478 * Menu: 2479 2480 * Communication style:: 2481 * Other configurables:: 2482 2483 2484 File: sly.info, Node: Communication style, Next: Other configurables, Up: Lisp-side customization 2485 2486 7.2.1 Communication style 2487 ------------------------- 2488 2489 The most important configurable is 'SLYNK:*COMMUNICATION-STYLE*', which 2490 specifies the mechanism by which Lisp reads and processes protocol 2491 messages from Emacs. The choice of communication style has a global 2492 influence on SLY's operation. 2493 2494 The available communication styles are: 2495 2496 'NIL' 2497 This style simply loops reading input from the communication socket 2498 and serves SLY protocol events as they arise. The simplicity means 2499 that the Lisp cannot do any other processing while under SLY's 2500 control. 2501 2502 ':FD-HANDLER' 2503 This style uses the classical Unix-style "'select()'-loop." Slynk 2504 registers the communication socket with an event-dispatching 2505 framework (such as 'SERVE-EVENT' in CMUCL and SBCL) and receives a 2506 callback when data is available. In this style requests from Emacs 2507 are only detected and processed when Lisp enters the event-loop. 2508 This style is simple and predictable. 2509 2510 ':SIGIO' 2511 This style uses "signal-driven I/O" with a 'SIGIO' signal handler. 2512 Lisp receives requests from Emacs along with a signal, causing it 2513 to interrupt whatever it is doing to serve the request. This style 2514 has the advantage of responsiveness, since Emacs can perform 2515 operations in Lisp even while it is busy doing other things. It 2516 also allows Emacs to issue requests concurrently, e.g. to send one 2517 long-running request (like compilation) and then interrupt that 2518 with several short requests before it completes. The disadvantages 2519 are that it may conflict with other uses of 'SIGIO' by Lisp code, 2520 and it may cause untold havoc by interrupting Lisp at an awkward 2521 moment. 2522 2523 ':SPAWN' 2524 This style uses multiprocessing support in the Lisp system to 2525 execute each request in a separate thread. This style has similar 2526 properties to ':SIGIO', but it does not use signals and all 2527 requests issued by Emacs can be executed in parallel. 2528 2529 The default request handling style is chosen according to the 2530 capabilities of your Lisp system. The general order of preference is 2531 ':SPAWN', then ':SIGIO', then ':FD-HANDLER', with 'NIL' as a last 2532 resort. You can check the default style by calling 2533 'SLYNK-BACKEND::PREFERRED-COMMUNICATION-STYLE'. You can also override 2534 the default by setting 'SLYNK:*COMMUNICATION-STYLE*' in your Slynk init 2535 file (*note Lisp-side customization::). 2536 2537 2538 File: sly.info, Node: Other configurables, Prev: Communication style, Up: Lisp-side customization 2539 2540 7.2.2 Other configurables 2541 ------------------------- 2542 2543 These Lisp variables can be configured via your '~/.slynk.lisp' file: 2544 2545 'SLYNK:*CONFIGURE-EMACS-INDENTATION*' 2546 This variable controls whether indentation styles for 2547 '&body'-arguments in macros are discovered and sent to Emacs. It 2548 is enabled by default. 2549 2550 'SLYNK:*GLOBAL-DEBUGGER*' 2551 When true (the default) this causes '*DEBUGGER-HOOK*' to be 2552 globally set to 'SLYNK:SLYNK-DEBUGGER-HOOK' and thus for SLY to 2553 handle all debugging in the Lisp image. This is for debugging 2554 multithreaded and callback-driven applications. 2555 2556 'SLYNK:*SLY-DB-QUIT-RESTART*' 2557 This variable names the restart that is invoked when pressing 'q' 2558 (*note sly-db-quit::) in SLY-DB. For SLY evaluation requests this 2559 is _unconditionally_ bound to a restart that returns to a safe 2560 point. This variable is supposed to customize what 'q' does if an 2561 application's thread lands into the debugger (see 2562 'SLYNK:*GLOBAL-DEBUGGER*'). 2563 (setf slynk:*sly-db-quit-restart* 'sb-thread:terminate-thread) 2564 2565 'SLYNK:*BACKTRACE-PRINTER-BINDINGS*' 2566 'SLYNK:*MACROEXPAND-PRINTER-BINDINGS*' 2567 'SLYNK:*SLY-DB-PRINTER-BINDINGS*' 2568 'SLYNK:*SLYNK-PPRINT-BINDINGS*' 2569 These variables can be used to customize the printer in various 2570 situations. The values of the variables are association lists of 2571 printer variable names with the corresponding value. E.g., to 2572 enable the pretty printer for formatting backtraces in SLY-DB, you 2573 can use: 2574 2575 (push '(*print-pretty* . t) slynk:*sly-db-printer-bindings*). 2576 2577 The fact that most SLY output (in the REPL for instance, *note 2578 REPL::) uses 'SLYNK:*SLYNK-PPRINT-BINDINGS*' may surprise you if 2579 you expected it to use a global setting for, say, '*PRINT-LENGTH*'. 2580 The rationale for this decision is that output is a very basic 2581 feature of SLY, and it should keep operating normally even if you 2582 (mistakenly) set absurd values for some '*PRINT-...*' variable. 2583 You, of course, override this protection: 2584 2585 (setq slynk:*slynk-pprint-bindings* 2586 (delete '*print-length* 2587 slynk:*slynk-pprint-bindings* :key #'car)) 2588 2589 'SLYNK:*STRING-ELISION-LENGTH*' 2590 'SLYNK:*STRING-ELISION-LENGTH*' 2591 2592 This variable controls the maximum length of strings before their 2593 pretty printed representation in the Inspector, Debugger, REPL, etc 2594 is elided. Don't set this variable directly, create a binding for 2595 this variable in 'SLYNK:*SLYNK-PPRINT-BINDINGS*' instead. 2596 2597 'SLYNK:*ECHO-NUMBER-ALIST*' 2598 'SLYNK:*PRESENT-NUMBER-ALIST*' 2599 These variables hold function designators used for displaying 2600 numbers when SLY presents them in its interface. 2601 2602 The difference between the two functions is that 2603 '*PRESENT-NUMBER-ALIST*', if non-nil, overrides 2604 '*ECHO-NUMBER-ALIST*' in the context of the REPL, Trace Dialog and 2605 Stickers (see *note REPL::, *note Trace Dialog:: and *note 2606 Stickers::), while the latter is used for commands like 'C-x C-e' 2607 or the inspector (see *note Evaluation::, *note Inspector::). 2608 2609 If in doubt, use '*ECHO-NUMBER-ALIST*'. 2610 2611 Both variables have the same structure: each element in the alist 2612 takes the form '(TYPE . FUNCTIONS)', where 'TYPE' is a type 2613 designator and 'FUNCTIONS' is a list of function designators for 2614 displaying that number in SLY. Each function takes the number as a 2615 single argument and returns a string, or nil, if that particular 2616 representation is to be disregarded. 2617 2618 Additionally if a given function chooses to return 't' as its 2619 optional second value, then all the remaining functions following 2620 it in the list are disregarded. 2621 2622 For integer numbers, the default value of this variable holds 2623 function designators that echo an integer number in its binary, 2624 hexadecimal and octal representation. However, if your application 2625 is using integers to represent Unix Epoch Times you can use this 2626 function to display a human-readable time whenever you evaluate an 2627 integer. 2628 2629 (defparameter *day-names* '("Monday" "Tuesday" "Wednesday" 2630 "Thursday" "Friday" "Saturday" 2631 "Sunday")) 2632 2633 (defun fancy-unix-epoch-time (integer) 2634 "Format INTEGER as a Unix Epoch Time if within 10 years from now." 2635 (let ((now (get-universal-time)) 2636 (tenyears (encode-universal-time 0 0 0 1 1 1910 0)) 2637 (unix-to-universal 2638 (+ integer 2639 (encode-universal-time 0 0 0 1 1 1970 0)))) 2640 (when (< (- now tenyears) unix-to-universal (+ now tenyears)) 2641 (multiple-value-bind 2642 (second minute hour date month year day-of-week dst-p tz) 2643 (decode-universal-time unix-to-universal) 2644 (declare (ignore dst-p)) 2645 (format nil "~2,'0d:~2,'0d:~2,'0d on ~a, ~d/~2,'0d/~d (GMT~@d)" 2646 hour minute second (nth day-of-week *day-names*) 2647 month date year (- tz)))))) 2648 2649 (pushnew 'fancy-unix-epoch-time 2650 (cdr (assoc 'integer slynk:*echo-number-alist*))) 2651 2652 42 ; => 42 (6 bits, #x2A, #o52, #b101010) 2653 1451404675 ; => 1451404675 (15:57:55 on Tuesday, 12/29/2015 (GMT+0), 31 bits, #x5682AD83) 2654 2655 'SLYNK-APROPOS:*PREFERRED-APROPOS-MATCHER*' 2656 This variable holds a function used for performing apropos 2657 searches. It defaults to 'SLYNK-APROPOS:MAKE-FLEX-MATCHER', but 2658 can also be set to 'SLYNK-APROPOS:MAKE-CL-PPCRE-MATCHER' (to use a 2659 regex-able matcher) or 'SLYNK-APROPOS:MAKE-PLAIN-MATCHER', for 2660 example. 2661 2662 'SLYNK:*LOG-EVENTS*' 2663 Setting this variable to 't' causes all protocol messages exchanged 2664 with Emacs to be printed to '*TERMINAL-IO*'. This is useful for 2665 low-level debugging and for observing how SLY works "on the wire." 2666 The output of '*TERMINAL-IO*' can be found in your Lisp system's 2667 own listener, usually in the buffer '*inferior-lisp*'. 2668 2669 2670 File: sly.info, Node: Tips and Tricks, Next: Extensions, Prev: Customization, Up: Top 2671 2672 8 Tips and Tricks 2673 ***************** 2674 2675 * Menu: 2676 2677 * Connecting to a remote Lisp:: 2678 * Loading Slynk faster:: 2679 * Auto-SLY:: 2680 * REPLs and game loops:: 2681 * Controlling SLY from outside Emacs:: 2682 2683 2684 File: sly.info, Node: Connecting to a remote Lisp, Next: Loading Slynk faster, Up: Tips and Tricks 2685 2686 8.1 Connecting to a remote Lisp 2687 =============================== 2688 2689 One of the advantages of the way SLY is implemented is that we can 2690 easily run the Emacs side ('sly.el' and friends) on one machine and the 2691 Lisp backend (Slynk) on another. The basic idea is to start up Lisp on 2692 the remote machine, load Slynk and wait for incoming SLY connections. 2693 On the local machine we start up Emacs and tell SLY to connect to the 2694 remote machine. The details are a bit messier but the underlying idea 2695 is that simple. 2696 2697 * Menu: 2698 2699 * Setting up the Lisp image:: 2700 * Setting up Emacs:: 2701 * Setting up pathname translations:: 2702 2703 2704 File: sly.info, Node: Setting up the Lisp image, Next: Setting up Emacs, Up: Connecting to a remote Lisp 2705 2706 8.1.1 Setting up the Lisp image 2707 ------------------------------- 2708 2709 The easiest way to load Slynk "standalone" (i.e. without having 'M-x 2710 sly' start a Lisp that is subsidiary to a particular Emacs), is to load 2711 the ASDF system definition for Slynk. 2712 2713 Make sure the path to the directory containing Slynk's '.asd' file is 2714 in 'ASDF:*CENTRAL-REGISTRY*'. This file lives in the 'slynk' 2715 subdirectory of SLY. Type: 2716 2717 (push #p"/path/to/sly/slynk/" ASDF:*CENTRAL-REGISTRY*) 2718 (asdf:require-system :slynk) 2719 2720 inside a running Lisp image(1). 2721 2722 Now all we need to do is startup our Slynk server. A working example 2723 uses the default settings: 2724 2725 (slynk:create-server) 2726 2727 This creates a "one-connection-only" server on port 4005 using the 2728 preferred communication style for your Lisp system. The following 2729 parameters to 'slynk:create-server' can be used to change that 2730 behaviour: 2731 2732 ':PORT' 2733 Port number for the server to listen on (default: 4005). 2734 ':DONT-CLOSE' 2735 Boolean indicating if the server will continue to accept 2736 connections after the first one (default: 'NIL'). For 2737 "long-running" Lisp processes to which you want to be able to 2738 connect from time to time, specify ':dont-close t' 2739 ':STYLE' 2740 See *Note Communication style::. 2741 2742 So a more complete example will be 2743 (slynk:create-server :port 4006 :dont-close t) 2744 2745 Finally, since section we're going to be tunneling our connection via 2746 SSH(2) we'll only have one port open we must tell Slynk's REPL contrib 2747 (see REPL) to not use an extra connection for output, which it will do 2748 by default. 2749 2750 (setf slynk:*use-dedicated-output-stream* nil) 2751 2752 (3) 2753 2754 ---------- Footnotes ---------- 2755 2756 (1) SLY also SLIME's old-style 'slynk-loader.lisp' loader which does 2757 the same thing, but ASDF is preferred 2758 2759 (2) there is a way to connect without an SSH tunnel, but it has the 2760 side-effect of giving the entire world access to your Lisp image, so 2761 we're not going to talk about it 2762 2763 (3) Alternatively, a separate tunnel for the port set in 2764 'slynk:*dedicated-output-stream-port*' can also be used if a dedicated 2765 output is essential. 2766 2767 2768 File: sly.info, Node: Setting up Emacs, Next: Setting up pathname translations, Prev: Setting up the Lisp image, Up: Connecting to a remote Lisp 2769 2770 8.1.2 Setting up Emacs 2771 ---------------------- 2772 2773 Now we need to create the tunnel between the local machine and the 2774 remote machine. Assuming a UNIX command-line, this can be done with: 2775 2776 ssh -L4005:localhost:4005 youruser@remote.example.com 2777 2778 This incantation creates a SSH tunnel between the port 4005 on our 2779 local machine and the port 4005 on the remote machine, where 'youruser' 2780 is expected to have an account. (1). 2781 2782 Finally we start SLY with 'sly-connect' instead of the usual 'sly': 2783 2784 M-x sly-connect RET RET 2785 2786 The 'RET RET' sequence just means that we want to use the default 2787 host ('localhost') and the default port ('4005'). Even though we're 2788 connecting to a remote machine the SSH tunnel fools Emacs into thinking 2789 it's actually 'localhost'. 2790 2791 ---------- Footnotes ---------- 2792 2793 (1) By default Slynk listens for incoming connections on port 4005, 2794 had we passed a ':port' parameter to 'slynk:create-server' we'd be using 2795 that port number instead 2796 2797 2798 File: sly.info, Node: Setting up pathname translations, Prev: Setting up Emacs, Up: Connecting to a remote Lisp 2799 2800 8.1.3 Setting up pathname translations 2801 -------------------------------------- 2802 2803 One of the main problems with running slynk remotely is that Emacs 2804 assumes the files can be found using normal filenames. if we want 2805 things like 'sly-compile-and-load-file' ('C-c C-k') and 2806 'sly-edit-definition' ('M-.') to work correctly we need to find a way to 2807 let our local Emacs refer to remote files. 2808 2809 There are, mainly, two ways to do this. The first is to mount, using 2810 NFS or similar, the remote machine's hard disk on the local machine's 2811 file system in such a fashion that a filename like 2812 '/opt/project/source.lisp' refers to the same file on both machines. 2813 Unfortunately NFS is usually slow, often buggy, and not always feasible. 2814 Fortunately we have an ssh connection and Emacs' 'tramp-mode' can do the 2815 rest. (See *note TRAMP User Manual: (tramp)Top.) 2816 2817 What we do is teach Emacs how to take a filename on the remote 2818 machine and translate it into something that tramp can understand and 2819 access (and vice versa). Assuming the remote machine's host name is 2820 'remote.example.com', 'cl:machine-instance' returns "remote" and we 2821 login as the user "user" we can use 'sly-tramp' contrib to setup the 2822 proper translations by simply doing: 2823 2824 (add-to-list 'sly-filename-translations 2825 (sly-create-filename-translator 2826 :machine-instance "remote" 2827 :remote-host "remote.example.com" 2828 :username "user")) 2829 2830 2831 File: sly.info, Node: Loading Slynk faster, Next: Auto-SLY, Prev: Connecting to a remote Lisp, Up: Tips and Tricks 2832 2833 8.2 Loading Slynk faster 2834 ======================== 2835 2836 In this section, a technique to load Slynk faster on South Bank Common 2837 Lisp (SBCL) is presented. Similar setups should also work for other 2838 Lisp implementations. 2839 2840 A pre-canned solution that automates this technique was developed by 2841 Pierre Neidhardt (https://gitlab.com/ambrevar/lisp-repl-core-dumper). 2842 2843 For SBCL, we recommend that you create a custom core file with socket 2844 support and POSIX bindings included because those modules take the most 2845 time to load. To create such a core, execute the following steps: 2846 2847 shell$ sbcl 2848 * (mapc 'require '(sb-bsd-sockets sb-posix sb-introspect sb-cltl2 asdf)) 2849 * (save-lisp-and-die "sbcl.core-for-sly") 2850 2851 After that, add something like this to your '~/.emacs' or 2852 '~/.emacs.d/init.el' (*note Emacs Init File::): 2853 2854 (setq sly-lisp-implementations '((sbcl ("sbcl" "--core" 2855 "sbcl.core-for-sly")))) 2856 2857 For maximum startup speed you can include the Slynk server directly 2858 in a core file. The disadvantage of this approach is that the setup is 2859 a bit more involved and that you need to create a new core file when you 2860 want to update SLY or SBCL. The steps to execute are: 2861 2862 shell$ sbcl 2863 * (load ".../sly/slynk-loader.lisp") 2864 * (slynk-loader:dump-image "sbcl.core-with-slynk") 2865 2866 Then add this to the Emacs initializion file: 2867 2868 (setq sly-lisp-implementations 2869 '((sbcl ("sbcl" "--core" "sbcl.core-with-slynk") 2870 :init (lambda (port-file _) 2871 (format "(slynk:start-server %S)\n" port-file))))) 2872 2873 2874 File: sly.info, Node: Auto-SLY, Next: REPLs and game loops, Prev: Loading Slynk faster, Up: Tips and Tricks 2875 2876 8.3 Connecting to SLY automatically 2877 =================================== 2878 2879 To make SLY connect to your lisp whenever you open a lisp file just add 2880 this to your '~/.emacs' or '~/.emacs.d/init.el' (*note Emacs Init 2881 File::): 2882 2883 (add-hook 'sly-mode-hook 2884 (lambda () 2885 (unless (sly-connected-p) 2886 (save-excursion (sly))))) 2887 2888 2889 File: sly.info, Node: REPLs and game loops, Next: Controlling SLY from outside Emacs, Prev: Auto-SLY, Up: Tips and Tricks 2890 2891 8.4 REPLs and "Game Loops" 2892 ========================== 2893 2894 When developing Common Lisp video games or graphical applications, a 2895 REPL (*note REPL::) is just as useful as anywhere else. But it is often 2896 the case that one needs to control exactly the timing of REPL requests 2897 and ensure they do not interfere with the "game loop". In other 2898 situations, the choice of communication style (*note Communication 2899 style::) to the Slynk server may invalidate simultaneous multi-threaded 2900 operation of REPL and game loop. 2901 2902 Instead of giving up on the REPL or using a complicated solution, 2903 SLY's REPL can be built into your game loop by using a couple of Slynk 2904 Common Lisp functions, 'SLYNK-MREPL:SEND-PROMPT' and 2905 'SLYNK:PROCESS-REQUESTS'. 2906 2907 (defun my-repl-aware-game-loop () 2908 (loop initially 2909 (princ "Starting our game") 2910 (slynk-mrepl:send-prompt) 2911 for i from 0 2912 do (with-simple-restart (abort "Skip rest of this game loop iteration") 2913 (when (zerop (mod i 10)) 2914 (fresh-line) 2915 (princ "doing high-priority 3D game loop stuff")) 2916 (sleep 0.1) 2917 ;; When you're ready to serve a potential waiting 2918 ;; REPL request, just do this non-blocking thing: 2919 (with-simple-restart (abort "Abort this game REPL evaluation") 2920 (slynk:process-requests t))))) 2921 2922 Note that this function is to be called _from the REPL_, and will 2923 enter kind of "sub-REPL" inside it. It'll likely "just work" in this 2924 situation. However, if you need you need to call this from anywhere 2925 else (like, say, another thread), you must additionally arrange for the 2926 variable 'SLYNK-API:*CHANNEL*' to be bound to the value it is bound to 2927 in whatever SLY REPL you wish to interact with your game. 2928 2929 2930 File: sly.info, Node: Controlling SLY from outside Emacs, Prev: REPLs and game loops, Up: Tips and Tricks 2931 2932 8.5 Controlling SLY from outside Emacs 2933 ====================================== 2934 2935 If your application has a non-SLY, non-Emacs user interface (graphical 2936 or otherwise), you can use it to exert some control over SLY 2937 functionality, such as its REPL (*note REPL::) and inspector (*note 2938 Inspector::). This requires that you first set, in Emacs, variable 2939 'sly-enable-evaluate-in-emacs' to non-nil. As the name suggests, it 2940 lets outside Slynk servers evaluate code in your Elisp runtime. It is 2941 set to 'nil' by default for security purposes. 2942 2943 Once you've done that, you can call 2944 'SLYNK-MREPL:COPY-TO-REPL-IN-EMACS' from your CL code with some objects 2945 you'd like to manipulate in the REPL. Then you can have this code run 2946 from some UI event handler: 2947 2948 (lambda () 2949 (slynk-mrepl:copy-to-repl-in-emacs 2950 (list 42 'foo) 2951 :blurb "Just a forty-two and a foo")) 2952 2953 And see those objects pop up in your REPL for inspection and 2954 manipulation. 2955 2956 You can also use the functions 'SLYNK:INSPECT-IN-EMACS', 2957 'SLYNK:ED-IN-EMACS', and in general, any exported function ending in 2958 'IN-EMACS'. See their docstrings for details. 2959 2960 2961 File: sly.info, Node: Extensions, Next: Credits, Prev: Tips and Tricks, Up: Top 2962 2963 9 Extensions 2964 ************ 2965 2966 * Menu: 2967 2968 * Loading and unloading:: More contribs:: 2969 * More contribs:: 2970 2971 Extensions, also known as "contribs" are Emacs packages that extend 2972 SLY’s functionality. Contrasting with its ancestor SLIME (*note 2973 Introduction::), most contribs bundled with SLY are active by default, 2974 since they are a decent way to split SLY into pluggable modules. The 2975 auto-documentation (*note Autodoc::), trace (*note Trace Dialog::) and 2976 Stickers (*note Stickers::) are contribs enabled by default, for 2977 example. 2978 2979 Usually, contribs differ from regular Emacs plugins in that they are 2980 partly written in Emacs-lisp and partly in Common Lisp. The former is 2981 usually the UI that queries the latter for information and then presents 2982 it to the user. SLIME used to load all the contribs’ Common Lisp code 2983 upfront, but SLY takes care to loading these two parts at the correct 2984 time. In this way, developers can write third-party contribs that live 2985 independently of SLY perhaps even in different code repositories. The 2986 'sly-macrostep' contrib (<https://github.com/joaotavora/sly-macrostep>) 2987 is one such example. 2988 2989 A special 'sly-fancy' contrib package is the only one loaded by 2990 default. You might never want to fiddle with it (it is the one that 2991 contains the default extensions), but if you find that you don't like 2992 some package or you are having trouble with a package, you can modify 2993 your setup a bit. Generally, you set the variable 'sly-contribs' with 2994 the list of package-names that you want to use. For example, a setup to 2995 load only the 'sly-scratch' and 'sly-mrepl' packages looks like: 2996 2997 ;; _Setup load-path and autoloads_ 2998 (add-to-list 'load-path "~/dir/to/cloned/sly") 2999 (require 'sly-autoloads) 3000 3001 ;; _Set your lisp system and some contribs_ 3002 (setq inferior-lisp-program "/opt/sbcl/bin/sbcl") 3003 (setq sly-contribs '(sly-scratch sly-mrepl)) 3004 3005 After starting SLY, the commands of both packages should be 3006 available. 3007 3008 3009 File: sly.info, Node: Loading and unloading, Next: More contribs, Up: Extensions 3010 3011 9.1 Loading and unloading "on the fly" 3012 ====================================== 3013 3014 We recommend that you setup the 'sly-contribs' variable _before_ 3015 starting SLY via 'M-x sly', but if you want to enable more contribs 3016 _after_ you that, you can set new 'sly-contribs' variable to another 3017 value and call 'M-x sly-setup' or 'M-x sly-enable-contrib'. Note this 3018 though: 3019 3020 * If you've removed contribs from the list they won't be unloaded 3021 automatically. 3022 * If you have more than one SLY connection currently active, you must 3023 manually repeat the 'sly-setup' step for each of them. 3024 3025 Short of restarting Emacs, a reasonable way of unloading contribs is 3026 by calling an Emacs Lisp function whose name is obtained by adding 3027 '-unload' to the contrib's name, for every contrib you wish to unload. 3028 So, to remove 'sly-mrepl', you must call 'sly-mrepl-unload'. Because 3029 the unload function will only, if ever, unload the Emacs Lisp side of 3030 the contrib, you may also need to restart your lisps. 3031 3032 3033 File: sly.info, Node: More contribs, Prev: Loading and unloading, Up: Extensions 3034 3035 9.2 More contribs 3036 ================= 3037 3038 * Menu: 3039 3040 * TRAMP Support:: 3041 * Scratch Buffer:: 3042 3043 3044 File: sly.info, Node: TRAMP Support, Next: Scratch Buffer, Up: More contribs 3045 3046 9.2.1 TRAMP 3047 ----------- 3048 3049 The package 'sly-tramp' provides some functions to set up filename 3050 translations for TRAMP. (*note Setting up pathname translations::) 3051 3052 3053 File: sly.info, Node: Scratch Buffer, Prev: TRAMP Support, Up: More contribs 3054 3055 9.2.2 Scratch Buffer 3056 -------------------- 3057 3058 The SLY scratch buffer, in contrib package 'sly-scratch', imitates 3059 Emacs' usual '*scratch*' buffer. If 'sly-scratch-file' is set, it is 3060 used to back the scratch buffer, making it persistent. The buffer is 3061 like any other Lisp buffer, except for the command bound to 'C-j'. 3062 3063 'C-j' 3064 'M-x sly-eval-print-last-expression' 3065 Evaluate the expression sexp before point and insert a printed 3066 representation of the return values into the current buffer. 3067 3068 'M-x sly-scratch' 3069 Create a '*sly-scratch*' buffer. In this buffer you can enter Lisp 3070 expressions and evaluate them with 'C-j', like in Emacs's 3071 '*scratch*' buffer. 3072 3073 3074 File: sly.info, Node: Credits, Next: Key Index, Prev: Extensions, Up: Top 3075 3076 10 Credits 3077 ********** 3078 3079 _The soppy ending..._ 3080 3081 Hackers of the good hack 3082 ======================== 3083 3084 SLY is a fork of SLIME which is itself an Extension of SLIM by Eric 3085 Marsden. At the time of writing, the authors and code-contributors of 3086 SLY are: 3087 3088 Helmut Eller João Távora Luke Gorrie 3089 Tobias C. Rittweiler Stas Boukarev Marco Baringer 3090 Matthias Koeppe Nikodemus Siivola Alan Ruttenberg 3091 Attila Lendvai Luís Borges de Dan Barlow 3092 Oliveira 3093 Andras Simon Martin Simmons Geo Carncross 3094 Christophe Rhodes Peter Seibel Mark Evenson 3095 Juho Snellman Douglas Crosher Wolfgang Jenkner 3096 R Primus Javier Olaechea Edi Weitz 3097 Zach Shaftel James Bielman Daniel Kochmanski 3098 Terje Norderhaug Vladimir Sedach Juan Jose Garcia 3099 Ripoll 3100 Alexander Artemenko Spenser Truex Nathan Trapuzzano 3101 Brian Downing Mark Jeffrey Cunningham 3102 Espen Wiborg Paul M. Rodriguez Masataro Asai 3103 Jan Moringen Sébastien Villemot Samuel Freilich 3104 Raymond Toy Pierre Neidhardt Phil Hargett 3105 Paulo Madeira Kris Katterjohn Jonas Bernoulli 3106 Ivan Shvedunov Gábor Melis Francois-Rene Rideau 3107 Christophe Junke Bozhidar Batsov Bart Botta 3108 Wilfredo Tianxiang Xiong Syohei YOSHIDA 3109 Velázquez-Rodríguez 3110 Stefan Monnier Rommel MARTINEZ Pavel Kulyov 3111 Paul A. Patience Olof-Joachim Frahm Mike Clarke 3112 Michał Herda Mark H. David Mario Lang 3113 Manfred Bergmann Leo Liu Koga Kazuo 3114 Jon Oddie John Stracke Joe Robertson 3115 Grant Shangreaux Graham Dobbins Eric Timmons 3116 Douglas Katzman Dmitry Igrishin Dmitrii Korobeinikov 3117 Deokhwan Kim Denis Budyak Chunyang Xu 3118 Cayman Angelo Rossi Andrew Kirkpatrick 3119 3120 ... not counting the bundled code from 'hyperspec.el', 'CLOCC', and 3121 the 'CMU AI Repository'. 3122 3123 Many people on the 'sly-devel' mailing list have made non-code 3124 contributions to SLY. Life is hard though: you gotta send code to get 3125 your name in the manual. ':-)' 3126 3127 Thanks! 3128 ======= 3129 3130 We're indebted to the good people of 'common-lisp.net' for their hosting 3131 and help, and for rescuing us from "Sourceforge hell." 3132 3133 Implementors of the Lisps that we support have been a great help. 3134 We'd like to thank the CMUCL maintainers for their helpful answers, 3135 Craig Norvell and Kevin Layer at Franz providing Allegro CL licenses for 3136 SLY development, and Peter Graves for his help to get SLY running with 3137 ABCL. 3138 3139 Most of all we're happy to be working with the Lisp implementors 3140 who've joined in the SLY development: Dan Barlow and Christophe Rhodes 3141 of SBCL, Gary Byers of OpenMCL, and Martin Simmons of LispWorks. Thanks 3142 also to Alain Picard and Memetrics for funding Martin's initial work on 3143 the LispWorks backend! 3144 3145 3146 File: sly.info, Node: Key Index, Next: Command Index, Prev: Credits, Up: Top 3147 3148 Key (Character) Index 3149 ********************* 3150 3151 3152 * Menu: 3153 3154 * 0 ... 9: Restarts. (line 22) 3155 * :: Miscellaneous. (line 28) 3156 * <: Frame Navigation. (line 23) 3157 * >: Inspector. (line 61) 3158 * > <1>: Frame Navigation. (line 19) 3159 * a: Restarts. (line 8) 3160 * A: Miscellaneous. (line 31) 3161 * B: Miscellaneous. (line 19) 3162 * c: Restarts. (line 18) 3163 * C: Miscellaneous. (line 24) 3164 * C-c :: Evaluation. (line 34) 3165 * C-c <: Cross-referencing. (line 57) 3166 * C-c >: Cross-referencing. (line 61) 3167 * C-c C-b: Recovery. (line 8) 3168 * C-c C-b <1>: REPL commands. (line 46) 3169 * C-c C-c: Compilation. (line 14) 3170 * C-c C-c <1>: Cross-referencing. (line 77) 3171 * C-c C-c <2>: Examining frames. (line 38) 3172 * C-c C-d #: Documentation. (line 58) 3173 * C-c C-d C-a: Documentation. (line 24) 3174 * C-c C-d C-d: Documentation. (line 16) 3175 * C-c C-d C-f: Documentation. (line 20) 3176 * C-c C-d C-h: Documentation. (line 43) 3177 * C-c C-d C-p: Documentation. (line 36) 3178 * C-c C-d C-z: Documentation. (line 32) 3179 * C-c C-d ~: Documentation. (line 54) 3180 * C-c C-k: Compilation. (line 30) 3181 * C-c C-k <1>: Cross-referencing. (line 82) 3182 * C-c C-l: Compilation. (line 48) 3183 * C-c C-m: Macro-expansion. (line 8) 3184 * C-c C-m <1>: Macro-expansion. (line 37) 3185 * C-c C-o: REPL commands. (line 63) 3186 * C-c C-p: Evaluation. (line 42) 3187 * C-c C-r: Evaluation. (line 38) 3188 * C-c C-t: Disassembly. (line 12) 3189 * C-c C-t <1>: Trace Dialog. (line 26) 3190 * C-c C-u: Evaluation. (line 53) 3191 * C-c C-w C-b: Cross-referencing. (line 36) 3192 * C-c C-w C-c: Cross-referencing. (line 24) 3193 * C-c C-w C-m: Cross-referencing. (line 44) 3194 * C-c C-w C-r: Cross-referencing. (line 32) 3195 * C-c C-w C-s: Cross-referencing. (line 40) 3196 * C-c C-w C-w: Cross-referencing. (line 28) 3197 * C-c C-x c: Multiple connections. (line 31) 3198 * C-c C-x n: Multiple connections. (line 35) 3199 * C-c C-x p: Multiple connections. (line 40) 3200 * C-c C-z: REPL. (line 29) 3201 * C-c E: Evaluation. (line 47) 3202 * C-c I: Inspector. (line 16) 3203 * C-c M-c: Compilation. (line 69) 3204 * C-c M-d: Disassembly. (line 8) 3205 * C-c M-k: Compilation. (line 44) 3206 * C-c M-m: Macro-expansion. (line 19) 3207 * C-c M-o: REPL commands. (line 69) 3208 * C-c T: Trace Dialog. (line 39) 3209 * C-c ~: Recovery. (line 15) 3210 * C-c ~ <1>: REPL. (line 36) 3211 * C-j: Scratch Buffer. (line 13) 3212 * C-k: Trace Dialog. (line 83) 3213 * C-M-n: REPL commands. (line 58) 3214 * C-M-p: REPL commands. (line 53) 3215 * C-M-x: Evaluation. (line 20) 3216 * C-n: Completion. (line 55) 3217 * C-p: Completion. (line 60) 3218 * C-r: REPL commands. (line 35) 3219 * C-x 4 .: Finding definitions. (line 30) 3220 * C-x 5 .: Finding definitions. (line 35) 3221 * C-x C-e: Evaluation. (line 14) 3222 * C-x `: Compilation. (line 73) 3223 * C-_: Macro-expansion. (line 51) 3224 * d: Multiple connections. (line 57) 3225 * D: Inspector. (line 27) 3226 * d <1>: Examining frames. (line 24) 3227 * D <1>: Examining frames. (line 29) 3228 * e: Inspector. (line 31) 3229 * e <1>: Examining frames. (line 19) 3230 * g: Macro-expansion. (line 42) 3231 * g <1>: Multiple connections. (line 62) 3232 * g <2>: Inspector. (line 49) 3233 * g <3>: Trace Dialog. (line 76) 3234 * G: Trace Dialog. (line 79) 3235 * h: Inspector. (line 53) 3236 * i: Examining frames. (line 34) 3237 * l: Inspector. (line 41) 3238 * M-,: Finding definitions. (line 25) 3239 * M-.: Finding definitions. (line 20) 3240 * M-?: Cross-referencing. (line 19) 3241 * M-n: Compilation. (line 61) 3242 * M-n <1>: REPL commands. (line 28) 3243 * M-n <2>: Frame Navigation. (line 12) 3244 * M-p: Compilation. (line 65) 3245 * M-p <1>: REPL commands. (line 21) 3246 * M-p <2>: Frame Navigation. (line 12) 3247 * M-RET: Inspector. (line 65) 3248 * n: Inspector. (line 45) 3249 * n <1>: Frame Navigation. (line 8) 3250 * p: Frame Navigation. (line 8) 3251 * q: Macro-expansion. (line 47) 3252 * q <1>: Multiple connections. (line 66) 3253 * q <2>: Inspector. (line 57) 3254 * q <3>: Restarts. (line 12) 3255 * R: Multiple connections. (line 71) 3256 * r: Miscellaneous. (line 8) 3257 * R <1>: Miscellaneous. (line 14) 3258 * RET: Cross-referencing. (line 67) 3259 * RET <1>: Multiple connections. (line 53) 3260 * RET <2>: REPL commands. (line 8) 3261 * RET <3>: Inspector. (line 22) 3262 * S-TAB: Inspector. (line 70) 3263 * Space: Cross-referencing. (line 72) 3264 * t: Examining frames. (line 10) 3265 * tab: Completion. (line 65) 3266 * TAB: REPL commands. (line 13) 3267 * TAB <1>: Inspector. (line 70) 3268 * v: Inspector. (line 36) 3269 * v <1>: Examining frames. (line 14) 3270 3271 3272 File: sly.info, Node: Command Index, Next: Variable Index, Prev: Key Index, Up: Top 3273 3274 Command and Function Index 3275 ************************** 3276 3277 3278 * Menu: 3279 3280 * backward-button: Inspector. (line 70) 3281 * forward-button: Inspector. (line 70) 3282 * hyperspec-lookup-format: Documentation. (line 54) 3283 * hyperspec-lookup-reader-macro: Documentation. (line 58) 3284 * isearch-backward: REPL commands. (line 35) 3285 * next-error: Compilation. (line 73) 3286 * sly-abort-connection: Multiple connections. (line 81) 3287 * sly-apropos: Documentation. (line 24) 3288 * sly-apropos-all: Documentation. (line 32) 3289 * sly-apropos-package: Documentation. (line 36) 3290 * sly-arglist NAME: Autodoc. (line 11) 3291 * sly-autodoc-manually: Autodoc. (line 17) 3292 * sly-autodoc-mode: Autodoc. (line 14) 3293 * sly-button-backward: REPL commands. (line 53) 3294 * sly-button-forward: REPL commands. (line 58) 3295 * sly-calls-who: Cross-referencing. (line 28) 3296 * sly-cd: Recovery. (line 19) 3297 * sly-choose-completion: Completion. (line 65) 3298 * sly-compile-and-load-file: Compilation. (line 30) 3299 * sly-compile-defun: Compilation. (line 14) 3300 * sly-compile-file: Compilation. (line 44) 3301 * sly-compile-region: Compilation. (line 51) 3302 * sly-compiler-macroexpand: Macro-expansion. (line 25) 3303 * sly-compiler-macroexpand-1: Macro-expansion. (line 22) 3304 * sly-connect: Multiple connections. (line 74) 3305 * sly-connection-list-make-default: Multiple connections. (line 57) 3306 * sly-db-abort: Restarts. (line 8) 3307 * sly-db-beginning-of-backtrace: Frame Navigation. (line 23) 3308 * sly-db-break-with-default-debugger: Miscellaneous. (line 19) 3309 * sly-db-break-with-system-debugger: Miscellaneous. (line 31) 3310 * sly-db-continue: Restarts. (line 18) 3311 * sly-db-details-down: Frame Navigation. (line 12) 3312 * sly-db-details-up: Frame Navigation. (line 12) 3313 * sly-db-disassemble: Examining frames. (line 29) 3314 * sly-db-down: Frame Navigation. (line 8) 3315 * sly-db-end-of-backtrace: Frame Navigation. (line 19) 3316 * sly-db-eval-in-frame: Examining frames. (line 19) 3317 * sly-db-inspect-condition: Miscellaneous. (line 24) 3318 * sly-db-inspect-in-frame: Examining frames. (line 34) 3319 * sly-db-invoke-restart-n: Restarts. (line 22) 3320 * sly-db-pprint-eval-in-frame: Examining frames. (line 24) 3321 * sly-db-quit: Restarts. (line 12) 3322 * sly-db-recompile-frame-source: Examining frames. (line 38) 3323 * sly-db-restart-frame: Miscellaneous. (line 8) 3324 * sly-db-return-from-frame: Miscellaneous. (line 14) 3325 * sly-db-show-frame-source: Examining frames. (line 14) 3326 * sly-db-toggle-details: Examining frames. (line 10) 3327 * sly-db-up: Frame Navigation. (line 8) 3328 * sly-describe-function: Documentation. (line 20) 3329 * sly-describe-symbol: Documentation. (line 16) 3330 * sly-disassemble-symbol: Disassembly. (line 8) 3331 * sly-disconnect: Multiple connections. (line 78) 3332 * sly-edit-definition: Finding definitions. (line 20) 3333 * sly-edit-definition-other-frame: Finding definitions. (line 35) 3334 * sly-edit-definition-other-window: Finding definitions. (line 30) 3335 * sly-edit-uses: Cross-referencing. (line 19) 3336 * sly-edit-value: Evaluation. (line 47) 3337 * sly-eval-defun: Evaluation. (line 20) 3338 * sly-eval-last-expression: Evaluation. (line 14) 3339 * sly-eval-print-last-expression: Scratch Buffer. (line 13) 3340 * sly-eval-region: Evaluation. (line 38) 3341 * sly-expand-1: Macro-expansion. (line 8) 3342 * sly-format-string-expand: Macro-expansion. (line 28) 3343 * sly-goto-connection: Multiple connections. (line 53) 3344 * sly-goto-xref: Cross-referencing. (line 72) 3345 * sly-hyperspec-lookup: Documentation. (line 43) 3346 * sly-info: Documentation. (line 11) 3347 * sly-inspect: Inspector. (line 16) 3348 * sly-inspector-describe-inspectee: Inspector. (line 27) 3349 * sly-inspector-eval: Inspector. (line 31) 3350 * sly-inspector-fetch-all: Inspector. (line 61) 3351 * sly-inspector-history: Inspector. (line 53) 3352 * sly-inspector-next: Inspector. (line 45) 3353 * sly-inspector-operate-on-point: Inspector. (line 22) 3354 * sly-inspector-pop: Inspector. (line 41) 3355 * sly-inspector-quit: Inspector. (line 57) 3356 * sly-inspector-reinspect: Inspector. (line 49) 3357 * sly-inspector-toggle-verbose: Inspector. (line 36) 3358 * sly-interactive-eval: Evaluation. (line 34) 3359 * sly-interactive-eval <1>: Miscellaneous. (line 28) 3360 * sly-interrupt: Recovery. (line 8) 3361 * sly-interrupt <1>: REPL commands. (line 46) 3362 * sly-list-callees: Cross-referencing. (line 61) 3363 * sly-list-callers: Cross-referencing. (line 57) 3364 * sly-list-connections: Multiple connections. (line 31) 3365 * sly-load-file: Compilation. (line 48) 3366 * sly-macroexpand-1: Macro-expansion. (line 14) 3367 * sly-macroexpand-1-inplace: Macro-expansion. (line 37) 3368 * sly-macroexpand-1-inplace <1>: Macro-expansion. (line 42) 3369 * sly-macroexpand-all: Macro-expansion. (line 19) 3370 * sly-macroexpand-undo: Macro-expansion. (line 51) 3371 * sly-mrepl: REPL. (line 29) 3372 * sly-mrepl-clear-recent-output: REPL commands. (line 63) 3373 * sly-mrepl-clear-repl: REPL commands. (line 69) 3374 * sly-mrepl-copy-part-to-repl: Inspector. (line 65) 3375 * sly-mrepl-indent-and-complete-symbol: REPL commands. (line 13) 3376 * sly-mrepl-new: REPL. (line 32) 3377 * sly-mrepl-next-input-or-button: REPL commands. (line 28) 3378 * sly-mrepl-previous-input-or-button: REPL commands. (line 21) 3379 * sly-mrepl-return: REPL commands. (line 8) 3380 * sly-mrepl-sync: Recovery. (line 15) 3381 * sly-mrepl-sync <1>: REPL. (line 36) 3382 * sly-next-completion: Completion. (line 55) 3383 * sly-next-connection: Multiple connections. (line 35) 3384 * sly-next-note: Compilation. (line 61) 3385 * sly-pop-find-definition-stack: Finding definitions. (line 25) 3386 * sly-pprint-eval-last-expression: Evaluation. (line 42) 3387 * sly-prev-completion: Completion. (line 60) 3388 * sly-prev-connection: Multiple connections. (line 40) 3389 * sly-previous-note: Compilation. (line 65) 3390 * sly-pwd: Recovery. (line 23) 3391 * sly-recompile-all-xrefs: Cross-referencing. (line 82) 3392 * sly-recompile-xref: Cross-referencing. (line 77) 3393 * sly-remove-notes: Compilation. (line 69) 3394 * sly-restart-connection-at-point: Multiple connections. (line 71) 3395 * sly-restart-inferior-lisp: Recovery. (line 11) 3396 * sly-scratch: Scratch Buffer. (line 17) 3397 * sly-show-xref: Cross-referencing. (line 67) 3398 * sly-temp-buffer-quit: Macro-expansion. (line 47) 3399 * sly-temp-buffer-quit <1>: Multiple connections. (line 66) 3400 * sly-toggle-trace-fdefinition: Disassembly. (line 12) 3401 * sly-trace-dialog: Trace Dialog. (line 39) 3402 * sly-trace-dialog-clear-fetched-traces: Trace Dialog. (line 83) 3403 * sly-trace-dialog-fetch-status: Trace Dialog. (line 76) 3404 * sly-trace-dialog-fetch-traces: Trace Dialog. (line 79) 3405 * sly-trace-dialog-toggle-trace: Trace Dialog. (line 26) 3406 * sly-undefine-function: Evaluation. (line 53) 3407 * sly-untrace-all: Disassembly. (line 17) 3408 * sly-update-connection-list: Multiple connections. (line 62) 3409 * sly-who-binds: Cross-referencing. (line 36) 3410 * sly-who-calls: Cross-referencing. (line 24) 3411 * sly-who-macroexpands: Cross-referencing. (line 44) 3412 * sly-who-references: Cross-referencing. (line 32) 3413 * sly-who-sets: Cross-referencing. (line 40) 3414 * sly-who-specializes: Cross-referencing. (line 47) 3415 3416 3417 File: sly.info, Node: Variable Index, Prev: Command Index, Up: Top 3418 3419 Variable and Concept Index 3420 ************************** 3421 3422 3423 * Menu: 3424 3425 * ASCII: Defcustom variables. (line 29) 3426 * Character Encoding: Defcustom variables. (line 29) 3427 * Compilation: Compilation. (line 6) 3428 * Compiling Functions: Compilation. (line 12) 3429 * Completion: Completion. (line 6) 3430 * Contribs: Extensions. (line 11) 3431 * Contributions: Extensions. (line 11) 3432 * Debugger: Debugger. (line 6) 3433 * Extensions: Extensions. (line 11) 3434 * LATIN-1: Defcustom variables. (line 29) 3435 * Listener: REPL. (line 6) 3436 * Macros: Macro-expansion. (line 6) 3437 * Plugins: Extensions. (line 11) 3438 * Symbol Completion: Completion. (line 6) 3439 * TRAMP: TRAMP Support. (line 6) 3440 * Unicode: Defcustom variables. (line 29) 3441 * UTF-8: Defcustom variables. (line 29) 3442 3443 3444 3445 Tag Table: 3446 Node: Top294 3447 Node: Introduction2278 3448 Node: Getting started4597 3449 Node: Platforms4908 3450 Node: Downloading6008 3451 Node: Basic setup7008 3452 Node: Running7941 3453 Node: Basic customization8805 3454 Node: Multiple Lisps10521 3455 Node: A SLY tour for SLIME users13016 3456 Node: Working with source files23902 3457 Node: Evaluation24630 3458 Node: Compilation26457 3459 Node: Autodoc29310 3460 Node: Semantic indentation30252 3461 Ref: Semantic indentation-Footnote-132359 3462 Node: Reader conditionals32454 3463 Node: Macro-expansion32830 3464 Node: Common functionality34462 3465 Node: Finding definitions35233 3466 Node: Cross-referencing37063 3467 Ref: Cross-referencing-Footnote-139455 3468 Node: Completion39683 3469 Node: Interactive objects42675 3470 Node: Documentation44591 3471 Node: Multiple connections46625 3472 Node: Disassembly49576 3473 Node: Recovery50108 3474 Node: Temporary buffers50731 3475 Node: Multi-threading52147 3476 Node: The REPL and other special buffers53715 3477 Node: REPL53988 3478 Node: REPL commands55840 3479 Node: REPL output57855 3480 Node: REPL backreferences62460 3481 Ref: REPL backreferences-Footnote-165612 3482 Node: Inspector65665 3483 Node: Debugger67611 3484 Node: Examining frames68268 3485 Node: Restarts69352 3486 Ref: sly-db-quit69558 3487 Node: Frame Navigation69977 3488 Node: Miscellaneous70661 3489 Node: Trace Dialog71570 3490 Node: Stickers75354 3491 Node: Customization79468 3492 Node: Emacs-side79671 3493 Node: Keybindings79863 3494 Ref: describe-key80665 3495 Ref: describe-bindings80792 3496 Ref: describe-mode80923 3497 Ref: view-lossage81095 3498 Ref: Emacs Init File81231 3499 Node: Keymaps81863 3500 Node: Defcustom variables84500 3501 Ref: sly-complete-symbol-function85189 3502 Ref: sly-net-coding-system85737 3503 Node: Hooks88096 3504 Ref: sly-connected-hook88444 3505 Node: Lisp-side customization88887 3506 Node: Communication style89285 3507 Node: Other configurables91812 3508 Ref: *SLY-DB-QUIT-RESTART*92519 3509 Node: Tips and Tricks98053 3510 Node: Connecting to a remote Lisp98327 3511 Node: Setting up the Lisp image99034 3512 Ref: Setting up the Lisp image-Footnote-1100821 3513 Ref: Setting up the Lisp image-Footnote-2100932 3514 Ref: Setting up the Lisp image-Footnote-3101106 3515 Node: Setting up Emacs101259 3516 Ref: Setting up Emacs-Footnote-1102213 3517 Node: Setting up pathname translations102383 3518 Node: Loading Slynk faster103960 3519 Ref: init-example105437 3520 Node: Auto-SLY105659 3521 Node: REPLs and game loops106140 3522 Node: Controlling SLY from outside Emacs108107 3523 Node: Extensions109352 3524 Node: Loading and unloading111399 3525 Node: More contribs112475 3526 Node: TRAMP Support112646 3527 Node: Scratch Buffer112889 3528 Ref: sly-scratch113015 3529 Node: Credits113648 3530 Node: Key Index116917 3531 Node: Command Index125536 3532 Node: Variable Index135559 3533 3534 End Tag Table 3535 3536 3537 Local Variables: 3538 coding: utf-8 3539 End: