10.07.2015 Views

SLIME Superior Lisp Interaction Mode for Emacs - Common Lisp.net

SLIME Superior Lisp Interaction Mode for Emacs - Common Lisp.net

SLIME Superior Lisp Interaction Mode for Emacs - Common Lisp.net

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SLIME</strong><strong>Superior</strong> <strong>Lisp</strong> <strong>Interaction</strong> <strong>Mode</strong> <strong>for</strong> <strong>Emacs</strong>Tobias-Christian Rittweiler <strong>SLIME</strong>December 11, 2008– 1 / 30


OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?Tobias-Christian Rittweiler <strong>SLIME</strong>– 2 / 30


• OutlineSlime – An overview• Some initial remarks• Development• Related stuff•ºÑ×bitsSlime – How does it work?Slime – What can it do?Slime – An overviewTobias-Christian Rittweiler <strong>SLIME</strong>– 3 / 30


Some initial remarks• OutlineSlime – An overview• Some initial remarks• Development• Related stuff•ºÑ×bitsSlime – How does it work?Slime – What can it do?• > 5 years old• > 42k loc• > 1600ÒÄÓentries• > 100 contributors◦ Code base sometimes feels like a gigantic, mutually sharedºÑ×◦ or IOW, a big ball of mud:◦ no code poetry, but in general quite readable.Use the source, Luke!Tobias-Christian Rittweiler <strong>SLIME</strong>– 4 / 30


Development• OutlineSlime – An overview• Some initial remarks• Development• Related stuff•ºÑ×bitsSlime – How does it work?Slime – What can it do?• No release management◦ You’re supposed to check out (and update) from CVS.◦ <strong>SLIME</strong> is mostly hacked during semester breaks, so it’s safe toupdate in Nov/Dez and Jul/Jun.◦ Website terribly out of date.◦ Likewise last official release, Slime-2.0, has a veeery long beard.• Changes are not necessarily backwards-compatible!• But if something bugs you, or you miss something, drop a mail to×ÐѹÚÐÓÑÑÓÒ¹Ð×ÔºÒØ.Tobias-Christian Rittweiler <strong>SLIME</strong>– 5 / 30


Related stuff• OutlineSlime – An overview• Some initial remarks• Development• Related stuff•ºÑ×bitsStuff to use in combination with <strong>SLIME</strong>:• Taylor Campbell’s paredit(ØØÔ»»ÑÙÑкÒØ»ÑÔÐлÑ×»ÔÖغÐ)Slime – How does it work?Slime – What can it do?• Michael Weber’s redshank(ØØÔ»»ÛÛÛºÓÐÖºÓÖ»ÑÐÛ»Ñ×»Ö×Ò»)“Alternatives” to <strong>SLIME</strong>:• Symbolics <strong>Lisp</strong> Machine (ØØÔ»»ÛÛÛº×ÝÑÓÐ׺ÓÑ)• Cusp <strong>for</strong> Eclipse (ØØÔ»»ÛÛÛºØÙÒºÓÑ»ÔÖÓØ×»Ù×Ô»)• Limp <strong>for</strong> Vim (ØØÔ»»ÓÑÑÓÒ¹Ð×ÔºÒØ»ÔÖÓØ»ÐÑÔ»)Tobias-Christian Rittweiler <strong>SLIME</strong>– 6 / 30


• OutlineSlime – An overview• Some initial remarks• Development• Related stuff•ºÑ×bitsSlime – How does it work?Slime – What can it do?ºÑ×bits××ÐÑÓÒÙÖØÓÒ´¾¼¼¹½¾¹¼¿µ ´¹ØÓ¹Ð×سÐÓ¹ÔØ»ÓÑ»ØÖ»ºÑ׺»×ÐÑ»µ ´¹ØÓ¹Ð×سÐÓ¹ÔØ»ÓÑ»ØÖ»ºÑ׺»×ÐÑ»ÓÒØÖ»µ´ÖÕÙÖ³×Ðѵ ÁÑÔÓÖØÒØ´µ×ÐѹÒݳ×ØÑØÓÒØÖØØÛÐÐÒд×ØÕ×ÐѹÐ×Ô¹ÑÔÐÑÒØØÓÒ× ´ÓÓµÑÒ×ØØØÔÖÓÖÑÑÓÓ×ØÖØÓÜÙغ ´×Ðѹ×ØÙÔ³´×ÐѹÒÝ×Ðѹ׵µ ÐÐ×ÓÖØ×ÓÚÒØÙÖ׺³´´Ð¼ ´Ð×Ô ´ÑÙÐ ´Ð×Ôµ ´ÑÐ×Ôµ ´Ð×Ôµ ´×е ÓÒ¹×Ý×ØÑ×Ó¹ÐØÒ¹½¹ÙÒܵÙÒÓÚÐÐ×ÓÓÒŹÜ×ÐѳÛÐÐÜÙØØ×ÒØÖÝÒ×ÐѹÐ×Ô¹ÑÔÐÑÒØØÓÒ׳º ´×йÚ×¹ÒÓ¹ÙØ´×йÚ×µµµµ ´×йش×йصÓÒ¹×Ý×ØÑÙع¹ÙÒܵÓÙÒ×ÔÝÒÓØÖÒØÖÝØÓÙ×ÝŹ¹Å¹Ü×Ðѳº ´×Ø×ÐѹÙÐعÐ×Ô³×йصTobias-Christian Rittweiler <strong>SLIME</strong>– 7 / 30


Architecture• Remote (and reattachable!) sessions possible (securing e.g. via ssh tunneling)• Multiple simultaneous connections to different implementations possibleTobias-Christian Rittweiler <strong>SLIME</strong>– 9 / 30


Implementation bits• OutlineSlime – An overviewSlime – How does it work?• Architecture• Implementation bits• More implementation bits• RPC protocol• An example:¹¹ÑSlime – What can it do?The×ÔÛÒSwank server is implemented differently depending on what thebackend supports. On some implementations, you can even choose whichcharacteristics you want—by tweaking the variableÇÅÅÍÆÁÌÁÇƹËÌÄ:•Using different threads:◦ reader thread (polling)◦ control thread (dispatching)◦ repl thread (executing repl requests)◦ worker threads (executing misc user requests)¹ÒÐÖ•×Ó UsingËÊιÎÆÌ: A×ÐØ´µ-based polling•Using POSIX signals (ËÁÁÇ.)framework toÒÐasynchronously invoke callbacks when a polledbecomes available.•Busy waiting.Tobias-Christian Rittweiler <strong>SLIME</strong>– 10 / 30


• OutlineSlime – An overviewSlime – How does it work?• Architecture• Implementation bits• More implementation bits• RPC protocol• An example:¹¹ÑSlime – What can it do?More implementation bitswatch out <strong>for</strong>ËÄÁÅÍÆWhen browsing×ÛÒºÐ×Ô, •Defines a function that can be invoked via an RPC from <strong>SLIME</strong>:◦ receives data from <strong>Emacs</strong>, returns data to <strong>Emacs</strong> (caution: no realautomatic marshalling.)in×ÛÒ¹ÓÓºÐ×Ô◦ function’s name automatically exported fromËÏÆÃpackage.The file×ÛÒ¹ÒºÐ×Ôdefines lots of function prototypes that aresupposed to be implemented by the actual backendsÁÆÌÊ•ÁÅÈÄÅÆÌÌÁÇÆ•Defines such a function prototype; a default implementation can begiven.Defines an actual implementation <strong>for</strong> a function prototype; overwritesdefault implementation.A warning <strong>for</strong> unimplemented prototypes is signalled during startup.Tobias-Christian Rittweiler <strong>SLIME</strong>– 11 / 30


RPC protocol• OutlineSlime – An overviewSlime – How does it work?• Architecture• Implementation bits• More implementation bits• RPC protocol• An example:¹¹ÑSlime – What can it do?Packet encoding:• packet header = length, packet payload = sexp• sexp <strong>for</strong>mat shared between Elisp and <strong>Common</strong> <strong>Lisp</strong>:◦ lists◦ symbols (explicitly qualified, except <strong>for</strong>Ì,ÆÁÄ, andÉÍÇÌ)◦ numbers (fixnums, single-floats)◦ strings (encoding settings must be isomorphic)Protocol semantics:• based on so-called events (lists + keyword asÊ):´Ñ×¹ÖÜÓÖÑÔØÖ¹ÓÒعµ ´ÖØÙÖÒÚÐÙÓÒعµ ´Ñ×¹ÒØÖÖÙÔØØÖ¹µ ´ÒÒØØÓÒ¹ÙÔØ×ÝÑÓйØе◦´ÔÖ×ÒØØÓÒ¹×ØÖØÔÖ×¹²ÓÔØÓÒÐØÖص◦´ÔÖ×ÒØØÓÒ¹ÒÔÖ×¹²ÓÔØÓÒÐØÖص◦◦◦◦◦ . . .Tobias-Christian Rittweiler <strong>SLIME</strong>– 12 / 30


• OutlineSlime – An overviewSlime – How does it work?• Architecture• Implementation bits• More implementation bits• RPC protocol• An example:¹¹ÑSlime – What can it do?An example:¹¹Ñ<strong>Emacs</strong> side¹¹Ñis×ÐѹÑÖÓÜÔÒ¹½•RPC×ÛÒ×ÛÒ¹ÑÖÓÜÔÒ¹½via×ÐѹÚй×ÝÒÓÚÖØÛÖsends´Ñ×¹ÖÜ´×ÛÒ×ÛÒ¹ÑÖÓÜÔÒ¹½´ÓÓºººµµµ• invokes•• grabs string representation of <strong>for</strong>m at point from the buffer. . .Tobias-Christian Rittweiler <strong>SLIME</strong>– 13 / 30


An example:¹¹Ñ• OutlineSlime – An overviewSlime – How does it work?• Architecture• Implementation bits• More implementation bits• RPC protocol• An example:¹¹ÑSlime – What can it do?<strong>Emacs</strong> side again• when <strong>Emacs</strong> goespayload´ÖØÙÖÒºººµidle, available input from the inferior <strong>Lisp</strong> isprocessed• dispatches on• invokes continuation with received value´ºººÜÔÒ×ÓÒºººµ(thecontinuation was stored by×ÐѹÚй×ÝÒpreviously.)• continuation pops up buffer, inserts the expansion, indents and finallyfontifies it.Tobias-Christian Rittweiler <strong>SLIME</strong>– 13 / 30


• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••Slime – What can it do?• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 14 / 30


Foreword• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• This talk is based on <strong>SLIME</strong> checked out on 2008-12-11, and SBCL1.0.22.• Make sure that you use the×ÐѹÒÝ,and×Ðѹ×contrib.• The talk will not be about sexp frobbing. For that, let me refer you toÔÖØ’s documentation.• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 15 / 30


Basics• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••All Slime operations are perfomed within global or buffer-local context:• current connectionbuffer-local, <strong>for</strong> example, in Macroexpansion buffers—so furtherin-place macroexpand operations (see later) are per<strong>for</strong>med within theoriginal connection.• current threadbuffer-local <strong>for</strong> SLDB buffers, as you can interrupt specific threads.• Recipe: SLDB makeup• Tip: Renaming identifiers• &c• current packageinºÐ×Ôbuffers, the buffer’s current package is determined bysearching backwards <strong>for</strong> “´Ò¹Ôºººµ” <strong>for</strong>ms.Tobias-Christian Rittweiler <strong>SLIME</strong>– 16 / 30


• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cBasics<strong>Mode</strong>line indicates the context as follows:ËÐÑ×ÛÒ¸×ÐßÒÐ℄•ËÐÑ×ÛÒ¸ÇÆ×ÐßÒ¸ÑÐ℄•ËÐÑ×Ð℄•ËÐÑ×ÛÒ¸×ÐßÐÓÐÐ℄•Connected to “sbcl” with “swank” being buffer package and “n”pending (non-debugged) requests.Like above, but there are additional “m” debugged requests.No buffer package could be determined, soÈÃis implicitlyused. Furthermore, there are no pending requests.The connection is buffer local; changing the default connection won’taffect operations in this buffer.• ËÐÑ×ÛÒ¸ß×ØÐÐ℄Tobias-Christian Rittweiler A local connection was closed; this buffer thus became useless.<strong>SLIME</strong>– 16 / 30


Compilation & Evaluation• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••Compilation• ¹¹, compile & load defun at point• ¹Ù¹¹, like above but compiled with maximum debug settings• ¹¹, compile & load buffer• ¹Å¹, compile only buffer 1• ŹÜ×ÐѹÓÑÔйÖÓÒ, compile & load region 2Evaluation• ¹Å¹Ü, evaluate defun at point (reevaluatesÎÊ<strong>for</strong>ms!)• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler 1 Useful <strong>for</strong> solely testing compile-time effects.or inlined functions.2 Useful <strong>for</strong> block-compiling regions involvingÎĹÏÀÆ<strong>for</strong>ms,<strong>SLIME</strong>– 17 / 30


Compilation & Evaluation• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••Compilation Notes• inËÄÁÅÓÑÔÐÖ¹ÆÓØ×buffer◦ ÊÌ, jumpto offending source location• inºÐ×Ôbuffer◦ ŹÒ, go to next note overlay◦ ŹÔ, go to previous note overlay◦ ¹Å¹, delete all note overlays from the buffer• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 17 / 30


Arglist Display• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Arglist display <strong>for</strong> functions, methods, macros, special-<strong>for</strong>ms.◦ type “´ÖÑÓÚ”◦ type “´ÙÒÛÒ¹ÔÖÓØØ”• Arglist display <strong>for</strong> declare expressions and type specifiers◦ type “´ÐÖ´ÒÐÒ”◦ type “´ÐÖ´ØÝÔ´×ÑÔйÖÖÝ”• Contextual arglist display◦ type “´ÑØÓ”• Recipe: SLDB makeup• Tip: Renaming identifiers• &c◦ type “´ÑØÓÒØÐÞ¹Ò×ØÒ”◦ type “´Ð××ÓÓ´µ´´ÒØÖµ´ÒØÖµµ”,then “´Ñ¹Ò×ØÒ³ÓÓ”Tobias-Christian Rittweiler <strong>SLIME</strong>– 18 / 30


Arglist Display• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• ²Æis non-existinglambda-list keyword to indicate optimize qualities orÎĹÏÀÆsituations.like·Ç·or constantdisplays its value.◦ type “´ÐÖ´ÓÔØÑÞ”◦ type “´ÚйÛÒ”• Placing point at a variable likeÍÆÁÎÊË,◦ type “×ØÒÖ¹ÓÙØÔÙØ”• Arglist displays also works <strong>for</strong> local functions defined viaÄÌ,ÄÄË.• Likewise <strong>for</strong> local macros defined viaÅÊÇÄÌ.• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 18 / 30


Completion• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &c• Compound-Prefix Completion onÌat the REPL,on¹Ìin .Ð×Ôbuffers.at the REPLon¹Å¹• Fuzzy Completion◦ type “´Ñ¹Ú¹Ì” ◦ type “´ÖÑÓÚÜ×ÕÖÓÑÌ”◦ type “Ì”◦ type “´ÐÓ»ÓÑÌ”◦ type “´ÑڹŹ”◦ type “´×ÛعŹ”◦ (UseÍÈ,ÇÏÆtonavigate,Ìtoselect an entry, and¹to• ¹¹×inserts remaining arglist onto point◦ type “´ÚйÛÒ¹¹×”• C-c C-y inserts call to the defun-at-point into the REPLquit.)Tobias-Christian Rittweiler ◦ type “´ÙÒÓӴܵ¹¹Ý”in aºÐ×Ôbuffer<strong>SLIME</strong>– 19 / 30


REPL• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &c• ŹÒ,ŹÔ, navigating• ŹÖ, • ¹¹, • ¹Å¹Ó,in input historysearch backwards in input historyto interrupt the inferior <strong>Lisp</strong>to clear the REPL buffer• Often¸ÐÓused REPL shortcuts:pop)◦load an ASDF system (includesÌcompletion!)◦ ¸Ôswitch¸ÓÖ¹ÐÓ¹×Ý×ØÑpackage (also¸·Ôto push, and¸¹Ôto¸×ÝÓÓÒÖ◦¸ÕÙØ◦¸Ö×ØÖØ◦¸Ìclose current connection only◦◦recompile & load an ASDF system (e.g. to update staleº×Ðs!)close all connections and kill <strong>SLIME</strong>-related buffers.restart the inferior lisp (brave new world!)Tobias-Christian Rittweiler <strong>SLIME</strong>– 20 / 30


Inspector• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cNavigation• Ì, cycle <strong>for</strong>ward through inspectable parts• ˹Ì, cycle backward• ÊÌ, follow link• Ð, go backwards• , reinspectSource finding• º, find source of object-at-point• Źº, find source of symbol-at-pointMisc• Ô, pretty-print object-at-point (useful to overcome truncating)• ŹÊÌ, copy representation of object-at-point to the REPL(also works on the “header”, i.e. the object being inspected)Tobias-Christian Rittweiler <strong>SLIME</strong>– 21 / 30


Inspector• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••FAQ: How to find out about what symbols a package exports?Answer: Inspect the package!ÜØÖÒÐ×ÝÑÓÐ×”,¹Á´Ò¹ÔеÊÌ“ººº•• click on• click on “ÖÓÙÔÝÐ××ØÓÒ℄”• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 21 / 30


Debugger• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cNavigation• Ò, next frame• Ô, previous frameFrame operations• ÊÌ(orØ), toggle frame details• Ú, jump to source location of frame-at-point• Ö, restart from frame-at-point• ¹¹, recompile location of frame-at-pointSelecting restarts• Õ, return to toplevel• , invokeÓÖØrestart• , invokeÓÒØÒÙrestart• ¼-, invoke ith restartTobias-Christian Rittweiler Misc• , inspect the condition currently being debugged<strong>SLIME</strong>– 22 / 30


Debugger• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cFAQ: How can I get a local variable’s value to the REPL, so I can frob it?Answer:(subsumed(shortcut:¹¹Ú¹Öµ• If you use the×ÐѹÔÖ×ÒØØÓÒ×contrib by×ÐѹÒÝ)◦ useÅÓÙ×¹¿(right-click), then select “ÓÔÝØÓÊÈÄ”◦• Alternatively,◦ useto inspect the value,the header representation◦ then useŹÊÌonTobias-Christian Rittweiler <strong>SLIME</strong>– 22 / 30


Debugger• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••FAQ: How can I do single-stepping?Answer:with´Ù¿µ• functions you want to step through, must be compiled• invoke´Öµ,or arrange otherwise to land in the debugger• ×, to step into• Ü, to step over (mnemonic: “cross”)• Ó, to step out• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 22 / 30


Debugger• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cUse case: Recompiling frames.• looking at a frame with too few frame details?• recompile the frame with maximum debug settings via¹Ù¹¹• now restart computation◦ either by invoking theÖØÖÝrestart possibly provided by <strong>SLIME</strong>,◦ or by restarting from an earlier frame(It is hence a good idea to always compile an application’s dispatchloop with´Ù¾µsettings such that the function becomesrestartable.)Tobias-Christian Rittweiler <strong>SLIME</strong>– 22 / 30


Macroexpanding• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••InºÐ×Ôbuffers• ¹¹Ñ, macroexpand the <strong>for</strong>m-at-point one single stept• ¹Å¹Ñ, macroexpand the <strong>for</strong>m-at-point fully (often useful onÄÇÇÈ)In the resultingËÄÁÅÅÖÓÜÔÒ×ÓÒbuffer• , redo last macroexpansion• ¹¹Ñ, still usable!• ¹Å¹Ñ, ditto• ¹or¹», undo last macroexpansion operation• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 23 / 30


Źº& XREF• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cInºÐ×Ôbuffers• Źº, goto definition of symbol-at-point• Ź¸, return from definition (works stack-like)• ¹Å¹º, cycle through multiple available definitionsIn an XREF buffer• ÊÌ, goto definition-at-point, do not leave XREF buffer• ËÈ, goto definition-at-point, close XREF buffer• Ò, next definition• ¹¹, recompile definition-at-point• ¹¹, recompile all definitionsN.B.• When usingŹºon presentations, a definition of the object-at-point(not the symbol-at-point) is searched <strong>for</strong>.Tobias-Christian Rittweiler <strong>SLIME</strong>– 24 / 30


Źº& XREF• OutlineSlime – An overviewXross REFerence:Slime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• ×ÐѹÛÓ¹Ò×(¹¹Û)• ×ÐѹÛÓ¹ÐÐ×(¹¹Û)• ×ÐѹÐÐ×¹ÛÓ(¹¹ÛÛ)• ×ÐѹÛÓ¹ÑÖÓÜÔÒ×(¹¹ÛÑ)• ×ÐѹÛÓ¹ÖÖÒ×(¹¹ÛÖ)• ×ÐѹÛÓ¹×Ø×(¹¹Û×)• ×ÐѹÛÓ¹×ÔÐÞ×(¹¹Û)• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 24 / 30


Źº& XREF• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••FAQ: I changed a macro. How do I recompile all functions using the macro?Answer:¹¹Û¹Ñ×ÛÒÛعÒÒו• ¹¹in theÖººº℄bufferNB: This is only as good as an implementation’sÛÓ¹ÑÖÓÜÔÒis.• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 24 / 30


• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion•Recipe:Á×Ö¹ÒREPL• InspectorRecipe:ÇÊÅÌ»»• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cRecipe:ÄÇÇÈindentation´ÐÓÓÔÓÖÜÖÓѼØÓ½¼ ÓÖÝÖÓѼØÓ½¼´×ØÕÐ×Ô¹×ÑÔйÐÓÓÔ¹ÒÒØØÓÒ½ Ð×Ô¹ÐÓÓÔ¹ÝÛÓÖ¹ÒÒØØÓÒ Ð×Ô¹ÐÓÓÔ¹ÓÖÑ×¹ÒÒØØÓÒµ´ÐÓÓÔÓÖÜÖÓѼØÓ½¼ ÓÖÝÖÓѼØÓ½¼ ÓÐÐØ´ÓÒ×ÜݵµSo we getÓÐÐØ´ÓÒ×ÜݵµPlace the following snippet in yourºÑ×toBy default,ÄÇÇÈis indented oddly in <strong>Emacs</strong>:fixthat:(Alternatively, you can use the×ÐѹÒÒØcontrib which is not subsumedby×ÐѹÒÝ.)Tobias-Christian Rittweiler <strong>SLIME</strong>– 25 / 30


Recipe:Á×Ö¹Ò• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion•Recipe:Á×Ö¹ÒREPL• InspectorRecipe:ÇÊÅÌ»»• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cyank the word at point.Un<strong>for</strong>tunately, the hyphen is a word seperator by default, so¹Ûworksineffectively on <strong>Lisp</strong> symbols.In×Ö¹ÑÓ, you can use¹Ûto´ÙÒ×Ö¹ÝÒ¹×ÝÑÓйÛÓÖ¹ÓÖ¹Ö´µ ´ÒØÖØÚµ ´×Ö¹ÝÒ¹ÒØÖÒÐ ´ÐÑ´µ´¹ÓÓ³Ð×Ô¹ÑÓ¹ÓÓ ´ÐØ´´×ØÒ´×Ô¹×ÝÒØܹÓÖÛÖÛµµµ ´ÛÒ´ÞÖÓÔ×ØÒµ´ÓÖÛÖ¹Ö½µµ ´ÔÓÒصµµµµ ´ÐÑ´µ ´Ñ¹ÐÓйÚÖг×Ö¹ÑÓ¹ÑÔµ ´Ò¹Ý×Ö¹ÑÓ¹ÑÔ¹Û³×Ö¹ÝÒ¹×ÝÑÓйÛÓÖ¹ÓÖ¹ÖµµµBut we can arrange that:Test case:Tobias-Christian Rittweiler • place point on front of “×ØÒÖ¹ÒÔÙØ”• ¹×¹Û.<strong>SLIME</strong>– 26 / 30


• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• Recipe: SLDB makeup• Tip: Renaming identifiers• &cRecipe:ÇÊÅÌ»»´Ò¹Ô×ÛÒµ ´ÙÒÔ´×ØÖÑÓزÓÔØÓÒÐÓÐÓÒ¹Ôع×Ò¹Ôµ ´ÐÖ´ÒÓÖÓÐÓÒ¹Ôع×Ò¹ÔµµPut´ÐØ´´×Ðѹ×ØÖѹԴ×ØÖѵthe following into»º×ÛÒºÐ×Ô1´××ÖØ´×Ðѹ×ØÖѹÔ×ØÖѵµ ´ÐØ´´´ÒÖÓÖ¹ÖÔйÖ×ÙÐØ×´×Ú¹ÔÖ×ÒعÓØÓصµµµ ´Ûع×ØÖÙØ´ÓÒÒØÓÒºÙ×Ö¹ÓÙØÔÙØÙ×Ö¹ÓØÖ¹ÓÙØÔÙØÖÔйÖ×ÙÐØ×µ´Ò×¹ÓÙØÔÙØ×ØÖѵ ´ÑÑÖ×ØÖÑ´Ð×ØÙ×Ö¹ÓÙØÔÙØÙ×Ö¹ÓØÖ¹ÓÙØÔÙØÖÔйÖ×ÙÐØ×µµµµµ ´ÙÐعÓÒÒØÓÒµ´×Ò¹ØÓ¹Ñ×´ÔÖ×ÒØØÓÒ¹×ØÖظµµ ´×Ò¹ØÓ¹Ñ×´ÛÖع×ØÖÒ¸´ÔÖÒ½¹ØÓ¹×ØÖÒÓصµµ ´Ò×¹ÓÙØÔÙØ×ØÖѵµµµ ´×Ò¹ØÓ¹Ñ×´ÔÖ×ÒØØÓÒ¹Ò¸µµTest case:• Evaluate “´ÓÖÑØØÌÙÖÖÒØÖØÐ×»×ÛÒÔ»ºÖØе”1 User customization file which is executed once Swank is loaded.Tobias-Christian Rittweiler <strong>SLIME</strong>– 27 / 30


Recipe: SLDB makeup• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••The look of SLDB is highly customizable 2×йÖ×ØÖØйÖѹÐÒ¹• search×йÒÓÒ¹Ö×ØÖØйÖѹÐÒ¹<strong>for</strong> “Ò¹×й” in×ÐѺÐ<strong>for</strong> all• recently introduced faces:◦◦available faces.• Recipe: SLDB makeup• Tip: Renaming identifiers• &c2 The look of the inspector is also customizable, search <strong>for</strong> “×ÐѹÒ×ÔØÓÖ¹º¹×”.Tobias-Christian Rittweiler <strong>SLIME</strong>– 28 / 30


Tip: Renaming identifiers• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••• For functions, macros, global variables, make use of XREF’sÛÓ¹foo!In particular, use¹Å¹º+keyboard• For renaming a local bindingmacro.◦ get in front of the toplevel <strong>for</strong>m (¹Å¹)◦ select the toplevel <strong>for</strong>m (¹ËȹŹËÈ)◦ useÕÙÖݹÖÔÐon region (ŹÜÕÙÖݹÖÔÐ)the• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 29 / 30


&c• OutlineSlime – An overviewSlime – How does it work?Slime – What can it do?• Foreword• Basics• Compilation & Evaluation• Arglist Display• Completion• REPL• InspectorRecipe:ÇÊÅÌ»»Recipe:Á×Ö¹Ò• Debugger• Macroexpanding•Å¹º& XREF• Recipe:ÄÇÇÈindentation••There is still stuff that was not mentioned:• profiler• trace• apropos• disassemble• setting up remote connections• anything that I can’t remember of..• Recipe: SLDB makeup• Tip: Renaming identifiers• &cTobias-Christian Rittweiler <strong>SLIME</strong>– 30 / 30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!