This is sly.info, produced by makeinfo version 6.7 from sly.texi. Written for SLIME Luke Gorrie and others, rewritten by João Távora for SLY. This file has been placed in the public domain. INFO-DIR-SECTION Emacs START-INFO-DIR-ENTRY * SLY: (sly). Common-Lisp IDE END-INFO-DIR-ENTRY File: sly.info, Node: Top, Next: Introduction, Up: (dir) SLY *** SLY is a Common Lisp IDE for Emacs. This is the manual for version 1.0.42. (Last updated February 28, 2024) Written for SLIME Luke Gorrie and others, rewritten by João Távora for SLY. This file has been placed in the public domain. * Menu: * Introduction:: * Getting started:: * A SLY tour for SLIME users:: * Working with source files:: * Common functionality:: * The REPL and other special buffers:: * Customization:: * Tips and Tricks:: * Extensions:: * Credits:: * Key Index:: * Command Index:: * Variable Index:: -- The Detailed Node Listing -- Getting started * Platforms:: * Downloading:: * Basic setup:: * Running:: * Basic customization:: * Multiple Lisps:: Working with source files * Evaluation:: * Compilation:: * Autodoc:: * Semantic indentation:: * Reader conditionals:: * Macro-expansion:: Common functionality * Finding definitions:: * Cross-referencing:: * Completion:: * Interactive objects:: * Documentation:: * Multiple connections:: * Disassembly:: * Recovery:: * Temporary buffers:: * Multi-threading:: The REPL and other special buffers * REPL:: * Inspector:: * Debugger:: * Trace Dialog:: * Stickers:: The REPL: the "top level" * REPL commands:: * REPL output:: * REPL backreferences:: The SLY-DB Debugger * Examining frames:: * Restarts:: * Frame Navigation:: * Miscellaneous:: Customization * Emacs-side:: * Lisp-side customization:: Emacs-side * Keybindings:: * Keymaps:: * Defcustom variables:: * Hooks:: Lisp-side (Slynk) * Communication style:: * Other configurables:: Tips and Tricks * Connecting to a remote Lisp:: * Loading Slynk faster:: * Auto-SLY:: * REPLs and game loops:: * Controlling SLY from outside Emacs:: Connecting to a remote Lisp * Setting up the Lisp image:: * Setting up Emacs:: * Setting up pathname translations:: Extensions * Loading and unloading:: * More contribs:: More contribs * TRAMP Support:: * Scratch Buffer:: File: sly.info, Node: Introduction, Next: Getting started, Prev: Top, Up: Top 1 Introduction ************** SLY is Sylvester the Cat's Common Lisp IDE. It extends Emacs with support for interactive programming in Common Lisp. The features are centered around an Emacs minor-mode called 'sly-mode', which complements the standard major-mode 'lisp-mode' for editing Lisp source files. 'sly-mode' adds support for interacting with a running Common Lisp process for compilation, debugging, documentation lookup, and so on. SLY attempts to follow the example of Emacs's own native Emacs-Lisp environment. Many of the keybindings and interface concepts used to interact with Emacs's Elisp machine are reused in SLY to interact with the underlying Common Lisp run-times. Emacs makes requests to these processes, asking them to compile files or code snippets; deliver introspection information various objects; or invoke commands or debugging restarts. Internally, SLY's user-interface, written in Emacs Lisp, is connected via sockets to one or more instances of a server program called "Slynk" that is running in the Lisp processes. The two sides communicate using a Remote Procedure Call (RPC) protocol. The Lisp-side server is primarily written in portable Common Lisp. However, because some non-standard functionality is provided differently by each Lisp implementation (SBCL, CMUCL, Allegro, etc...) the Lisp-side server is again split into two parts - portable and non-portable implementation - which communicate using a well-defined interface. Each Lisp implementation provides a separate implementation of that interface, making SLY as a whole readily portable. SLY is a direct fork of SLIME, the "Superior Lisp Interaction Mode for Emacs", which itself derived from previous Emacs programs such as SLIM and ILISP. If you already know SLIME, SLY's closeness to it is immediately apparent. However, where SLIME has traditionally focused on the stability of its core functionality, SLY aims for a richer feature set, a more consistent user interface, and an experience generally closer to Emacs' own. To understand the differences between the two projects read SLY's NEWS.md file. For a hand-on approach to these differences you might want to *note A SLY tour for SLIME users::. File: sly.info, Node: Getting started, Next: A SLY tour for SLIME users, Prev: Introduction, Up: Top 2 Getting started ***************** This chapter tells you how to get SLY up and running. * Menu: * Platforms:: * Downloading:: * Basic setup:: * Running:: * Basic customization:: * Multiple Lisps:: File: sly.info, Node: Platforms, Next: Downloading, Up: Getting started 2.1 Supported Platforms ======================= SLY supports a wide range of operating systems and Lisp implementations. SLY runs on Unix systems, Mac OSX, and Microsoft Windows. GNU Emacs versions 24.4 and above are supported. _XEmacs or Emacs 23 are notably not supported_. The supported Lisp implementations, roughly ordered from the best-supported, are: * CMU Common Lisp (CMUCL), 19d or newer * Steel Bank Common Lisp (SBCL), 1.0 or newer * Clozure Common Lisp (CCL), version 1.3 or newer * LispWorks, version 4.3 or newer * Allegro Common Lisp (ACL), version 6 or newer * CLISP, version 2.35 or newer * Armed Bear Common Lisp (ABCL) * Scieneer Common Lisp (SCL), version 1.2.7 or newer * Embedded Common Lisp (ECL) * ManKai Common Lisp (MKCL) * Clasp Most features work uniformly across implementations, but some are prone to variation. These include the precision of placing compiler-note annotations, XREF support, and fancy debugger commands (like "restart frame"). File: sly.info, Node: Downloading, Next: Basic setup, Prev: Platforms, Up: Getting started 2.2 Downloading SLY =================== By far the easiest method for getting SLY up and running is using Emacs’ package system configured to the popular MELPA repository. This snippet of code should already be in your configuration: (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) You should now be able to issue the command 'M-x package-install', choose 'sly' and have it be downloaded and installed automatically. If you don’t find it in the list, ensure you run 'M-x package-refresh-contents' first. In other situations, such as when developing SLY itself, you can access the Git repository directly: git clone https://github.com/joaotavora/sly.git If you want to hack on SLY, use Github's _fork_ functionality and submit a _pull request_. Be sure to first read the CONTRIBUTING.md file first. File: sly.info, Node: Basic setup, Next: Running, Prev: Downloading, Up: Getting started 2.3 Basic setup =============== If you installed SLY from MELPA, it is quite possible that you don’t need any more configuration, provided that SLY can find a suitable Lisp executable in your 'PATH' environment variable. Otherwise, you need to tell it where a Lisp program can be found, so customize the variable 'inferior-lisp-program' (*note Defcustom variables::) or add a line like this one to your '~/.emacs' or '~/.emacs.d/init.el' (*note Emacs Init File::). (setq inferior-lisp-program "/opt/sbcl/bin/sbcl") After evaluating this, you should be able to execute 'M-x sly' and be greeted with a REPL. If you cloned from the Git repository, you’ll have to add a couple of more lines to your initialization file configuration: (add-to-list 'load-path "~/dir/to/cloned/sly") (require 'sly-autoloads) File: sly.info, Node: Running, Next: Basic customization, Prev: Basic setup, Up: Getting started 2.4 Running SLY =============== SLY can either ask Emacs to start its own Lisp subprocesss or connect to a running process on a local or remote machine. The first alternative is more common for local development and is started via 'M-x sly'. The "inferior" Lisp process thus started is told to load the Lisp-side server known as "Slynk" and then a socket connection is established between Emacs and Lisp. Finally a REPL buffer is created where you can enter Lisp expressions for evaluation. The second alternative uses 'M-x sly-connect'. This assumes that that a Slynk server is running on some local or remote host, and listening on a given port. 'M-x sly-connect' prompts the user for these values, and upon connection the REPL is established. File: sly.info, Node: Basic customization, Next: Multiple Lisps, Prev: Running, Up: Getting started 2.5 Basic customization ======================= A big part of Emacs, and Emacs’s extensions, are its near-infinite customization possibilities. SLY is no exception, because it runs on both Emacs and the Lisp process, there are layers of Emacs-side customization and Lisp-side customization. But don’t be put off by this! SLY tries hard to provide sensible defaults that don’t "hide" any fanciness beneath layers of complicated code, so that even a setup with no customization at all exposes SLY’s most important functionality. Emacs-side customization is usually done via Emacs-lisp code snippets added to the user’s initialization file, usually '$HOME/.emacs' or '$HOME/.emacs.d/init.el' (*note Emacs Init File::). 90% of Emacs-lisp customization happens in either "keymaps" or "hooks" (*note Emacs-side::). Still on the Emacs side, there is also a separate interface, appropriately called 'customize' (or sometimes just 'custom'), that uses a nicer UI with mouse-clickable buttons to set some special variables. See *Note Defcustom variables::. Lisp-side customization is done exclusively via Common Lisp code snippets added to the user’s '$HOME/.slynkrc' file. See *Note Lisp-side customization::. As a preview, take this simple example of a frequently customized part of SLY: its keyboard shortcuts, known as "keybindings". In the following snippet 'M-h' is added to 'sly-prefix-map' thus yielding 'C-c M-h' as a shortcut to the 'sly-documentation-lookup' command. (eval-after-load 'sly `(define-key sly-prefix-map (kbd "M-h") 'sly-documentation-lookup)) File: sly.info, Node: Multiple Lisps, Prev: Basic customization, Up: Getting started 2.6 Multiple Lisps ================== By default, the command 'M-x sly' starts the program specified with 'inferior-lisp-program', a variable that you can customize (*note Defcustom variables::). However, if you invoke 'M-x sly' with a _prefix argument_, meaning you type 'C-u M-x sly' then Emacs prompts for the program which should be started instead. If you need to do this frequently or if the command involves long filenames it's more convenient to set the 'sly-lisp-implementations' variable in your initialization file (*note Emacs Init File::). For example here we define two programs: (setq sly-lisp-implementations '((cmucl ("cmucl" "-quiet")) (sbcl ("/opt/sbcl/bin/sbcl") :coding-system utf-8-unix))) Now, if you invoke SLY with a _negative_ prefix argument, 'M-- M-x sly', you can select a program from that list. When called without a prefix, either the name specified in 'sly-default-lisp', or the first item of the list will be used. The elements of the list should look like (NAME (PROGRAM PROGRAM-ARGS...) &key CODING-SYSTEM INIT INIT-FUNCTION ENV) 'NAME' is a symbol and is used to identify the program. 'PROGRAM' is the filename of the program. Note that the filename can contain spaces. 'PROGRAM-ARGS' is a list of command line arguments. 'CODING-SYSTEM' the coding system for the connection. (*note sly-net-coding-system::)x 'INIT' should be a function which takes two arguments: a filename and a character encoding. The function should return a Lisp expression as a string which instructs Lisp to start the Slynk server and to write the port number to the file. At startup, SLY starts the Lisp process and sends the result of this function to Lisp's standard input. As default, 'sly-init-command' is used. An example is shown in *note Loading Slynk faster: init-example. 'INIT-FUNCTION' should be a function which takes no arguments. It is called after the connection is established. (See also *note sly-connected-hook::.) 'ENV' specifies a list of environment variables for the subprocess. E.g. (sbcl-cvs ("/home/me/sbcl-cvs/src/runtime/sbcl" "--core" "/home/me/sbcl-cvs/output/sbcl.core") :env ("SBCL_HOME=/home/me/sbcl-cvs/contrib/")) initializes 'SBCL_HOME' in the subprocess. File: sly.info, Node: A SLY tour for SLIME users, Next: Working with source files, Prev: Getting started, Up: Top 3 A SLY tour for SLIME users **************************** The chances are that if you’re into Common Lisp, you already know about SLIME, the project that originated SLY. Itself originating in older Emacs extensions SLIM and ILISP, SLIME has been around for at least a decade longer than SLY and is quite an amazing IDE. It's likely that most Lispers have some experience with it, making it a good idea to provide, in the shape of a quick tutorial, a hands-on overview of some of the improvements of SLY over SLIME. When you start SLY with 'M-x sly' (*note Basic setup::) you are greeted with its REPL, a common starting point of Lisp hacking sessions. This has been completely redesigned in SLY: you can spawn multiple REPL sessions with 'sly-mrepl-new'; copy objects from most places directly into it (with 'M-RET' and 'M-S-RET'); use powerful incremental history search (with 'C-r') found in most modern shells; and get real-time assistance when "backreferecing" previous evaluation values in your Lisp input. [image src="images/tutorial-1.png"