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