<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.paskvil.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.paskvil.com/index.php?action=history&amp;feed=atom&amp;title=Emacs_and_slime_reference</id>
		<title>Emacs and slime reference - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.paskvil.com/index.php?action=history&amp;feed=atom&amp;title=Emacs_and_slime_reference"/>
		<link rel="alternate" type="text/html" href="https://wiki.paskvil.com/index.php?title=Emacs_and_slime_reference&amp;action=history"/>
		<updated>2026-04-10T11:27:20Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.22.0</generator>

	<entry>
		<id>https://wiki.paskvil.com/index.php?title=Emacs_and_slime_reference&amp;diff=6&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;&lt;pre&gt;Emacs in General --------------------------------------------------------------- General: * C-u N cmd                repeat the 'cmd' N-times (N is a number) - further on de...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.paskvil.com/index.php?title=Emacs_and_slime_reference&amp;diff=6&amp;oldid=prev"/>
				<updated>2011-06-24T13:47:13Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt;Emacs in General --------------------------------------------------------------- General: * C-u N cmd                repeat the &amp;#039;cmd&amp;#039; N-times (N is a number) - further on de...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;Emacs in General ---------------------------------------------------------------&lt;br /&gt;
General:&lt;br /&gt;
* C-u N cmd                repeat the 'cmd' N-times (N is a number) - further on denoted [N] cmd&lt;br /&gt;
* M-N cmd                  repeat the 'cmd' N-times (N is a number) - further on denoted [N] cmd&lt;br /&gt;
* C-g                      stop current command - useful if emacs stops responding; also to discard command typed so far&lt;br /&gt;
* &amp;lt;Esc&amp;gt; &amp;lt;Esc&amp;gt; &amp;lt;Esc&amp;gt;        general &amp;quot;get out&amp;quot; command&lt;br /&gt;
* C-h c cmd                display brief help for the 'cmd'&lt;br /&gt;
* C-h k cmd                display a full help for the 'cmd'&lt;br /&gt;
* C-h f fn                 display a full help for the function 'fn'&lt;br /&gt;
* C-h a                    apropos - type word or regex to show all commands related to it&lt;br /&gt;
* C-h r                    reference manual&lt;br /&gt;
* chord C-h                print a list of all command that start with a given key 'chord' e.g. C-x C-h gives all commands starting with C-x&lt;br /&gt;
* C-h b, C-h m             list of available bindings, info about current mode&lt;br /&gt;
* C-x C-c                  quit&lt;br /&gt;
&lt;br /&gt;
To (re)define key chord, edit your ~/.emacs file like this:&lt;br /&gt;
(define-key slime-repl-mode-map (kbd &amp;quot;C-c ;&amp;quot;)&lt;br /&gt;
            'slime-insert-balanced-comments)&lt;br /&gt;
(global-set-key (quote [C-tab]) 'slime-complete-symbol)&lt;br /&gt;
&lt;br /&gt;
To interactively create bindings, use (in Emacs):&lt;br /&gt;
1) M-x global-set-key&lt;br /&gt;
2) press the key combination you want&lt;br /&gt;
3) type the command to run upon this&lt;br /&gt;
4) press C-x ESC ESC to see the command in full&lt;br /&gt;
&lt;br /&gt;
Moving around:&lt;br /&gt;
* C-v, M-v                one screen ahead/back&lt;br /&gt;
* [N] C-v, [N] M-v        move the screen down/up by N lines&lt;br /&gt;
* C-l                     center the screen around cursor, move to top, and move to bottom (on repetition of the stroke)&lt;br /&gt;
* [N] C-l                 move the current line to be N-th on the screen, 0-based&lt;br /&gt;
* C-b, C-f, C-p, C-n      move left/right/up/down&lt;br /&gt;
* M-b, M-f                move by words backward/forward&lt;br /&gt;
* C-a, C-e                move to the beginning/end of current line&lt;br /&gt;
* M-a, M-e                move to the beginning/end of current sentence&lt;br /&gt;
* M-&amp;lt;, M-&amp;gt;                move to the beginning/end of whole text&lt;br /&gt;
&lt;br /&gt;
Editing:&lt;br /&gt;
* M-Bcksp, M-d            kill word before/after cursor&lt;br /&gt;
* C-k, M-k                kill from cursor to end of line (second C-k will kill \n at the end), to end of sentence&lt;br /&gt;
                          repeating C-k will accumulate the killed text (if you press C-k 10 times - killing 5 lines,&lt;br /&gt;
                          and then yank the text, it will yank all 5 lines, not just the last)&lt;br /&gt;
* [N] C-k                 kill N lines, including the newlines&lt;br /&gt;
* C-y                     yank the killed text&lt;br /&gt;
* M-y                     replace the yank with previous kill (i.e. after C-y, you can press M-y, and it will replace the yank&lt;br /&gt;
                          with text that was killed before this one, and so on; this is circular queue - press M-y will get you&lt;br /&gt;
                          back to the last kill; you can also use [N] M-y, where N can be positive or negative)&lt;br /&gt;
* C-x u, C-_              undo&lt;br /&gt;
                          undo's are considered ordinary changes; thus if the chain of undo's is stopped, e.g. with C-f, undo's can be undone&lt;br /&gt;
&lt;br /&gt;
Windows:&lt;br /&gt;
* C-x 1                   kill all other windows - go to &amp;quot;one window&amp;quot; editing; deletes all other windows, and expands current to full screen&lt;br /&gt;
* C-x 2                   split screen in 2&lt;br /&gt;
* C-x o                   move to &amp;quot;other&amp;quot; window&lt;br /&gt;
* C-M-v                   scroll the other window&lt;br /&gt;
* C-x 3                   split window vertically&lt;br /&gt;
* C-x 4 C-f file          open file in new bottom window and jump to it&lt;br /&gt;
&lt;br /&gt;
Files:&lt;br /&gt;
* C-x C-f                 find (open) file; opens in a new buffer&lt;br /&gt;
* C-x C-s                 save the file contents&lt;br /&gt;
&lt;br /&gt;
Buffers:&lt;br /&gt;
* C-x C-b                 list of buffers&lt;br /&gt;
* C-x b                   switch to buffer (prompts for buffer name)&lt;br /&gt;
* C-x s                   save some buffers&lt;br /&gt;
* C-x &amp;lt;lft&amp;gt;, C-x &amp;lt;rgh&amp;gt;    previous/next buffer&lt;br /&gt;
* C-x k    bfr            kill buffer 'bfr', defaults to current buffer&lt;br /&gt;
&lt;br /&gt;
Search and Replace:&lt;br /&gt;
* C-s, C-r                search forward/backward, incrementally; C-s/C-r repeats the search, Backspace goes back, Enter ends the search&lt;br /&gt;
* M-x replace-string      params 'from' 'to'&lt;br /&gt;
&lt;br /&gt;
SLIME - Superior Lisp Interaction Mode for Emacs -------------------------------&lt;br /&gt;
-- note: all 3-key commands can be used with or without `C-' for the last key;&lt;br /&gt;
e.g C-c C-d d can also be used as C-c C-d C-d&lt;br /&gt;
    C-c C-w c can also be used as C-c C-w C-c, etc.&lt;br /&gt;
with the exception of the last key being 'h'&lt;br /&gt;
-- Evaluation&lt;br /&gt;
* C-x C-e, C-c C-p        evaluate expression before point and show result in echo area/pretty print result in new buffer&lt;br /&gt;
* C-M-x                   evaluate current toplevel (note - if evaluating defvar, resets the variable even if already bound)&lt;br /&gt;
* C-c :                   evaluate expression read from minibuffer&lt;br /&gt;
* C-c C-r                 evaluate region&lt;br /&gt;
* C-x M-e                 evaluate expression before point, and show output buffer (useful for expressions that print to stdout)&lt;br /&gt;
* C-c E                   edit value of set-able form in new buffer, and set its value in Lisp upon commit with C-c C-c&lt;br /&gt;
* C-c C-u                 undefine (fmakunbound) function for the symbol at point&lt;br /&gt;
&lt;br /&gt;
-- Compilation&lt;br /&gt;
* C-c C-c                 compile toplevel form at point; the code is executed afterwards&lt;br /&gt;
* [N] C-c C-c             -&amp;quot;-, with N&amp;gt;0 compile for maximal debugging, for N&amp;lt;0 for speed&lt;br /&gt;
* C-c C-k                 compile and load current buffer's source file&lt;br /&gt;
* C-c M-k                 compile but do not load current buffer's source file&lt;br /&gt;
* C-c C-l                 load Lisp file&lt;br /&gt;
---- after the compilation (notes are indicated as underlining on source forms)&lt;br /&gt;
* M-n, M-p                move to next/previous compiler note, and display it&lt;br /&gt;
* C-c M-c                 remove all annotations from buffer&lt;br /&gt;
* C-x `                   go to next error message&lt;br /&gt;
&lt;br /&gt;
-- Completion and Editing&lt;br /&gt;
* M-TAB                   complete symbol at point&lt;br /&gt;
* C-c M-q                 reindent current defun&lt;br /&gt;
* M-x slime-close-all-parens-in-sexp&lt;br /&gt;
* M-x slime-insert-balanced-comments&lt;br /&gt;
* M-C-a, M-C-e            slime-beginning/end-of-defun&lt;br /&gt;
* M-x slime-ensure-typeout-frame    create typeout frame if necessary; it's like echo area, just scrollable and more persistent&lt;br /&gt;
* M-x slime-highlight-edits-mode    toggle on-off highlighting edits is file (e.g. to see what to recompile with C-c C-c)&lt;br /&gt;
&lt;br /&gt;
-- Finding Definitions&lt;br /&gt;
* M-.                     go to the definition of the symbol at point&lt;br /&gt;
* M-,                     go to the point where M-. was invoked&lt;br /&gt;
* C-x 4 .                 like M-. but switches to the other window to edit the definition&lt;br /&gt;
* C-x 5 .                 like M-. but opens another frame to edit the definition in&lt;br /&gt;
&lt;br /&gt;
-- Documentation&lt;br /&gt;
* SPC                     inserts space and looks up arguments list for the function at point&lt;br /&gt;
* C-c C-d d               describe the symbol at point&lt;br /&gt;
* C-c C-f                 describe the function at point&lt;br /&gt;
* C-c C-d a               perform apropos search on Lisp symbol names, and display their doc strings&lt;br /&gt;
* C-c C-d z               like C-c C-d a, but includes internal symbols by default&lt;br /&gt;
* C-c C-d p               show apropos results of all symbols in package&lt;br /&gt;
* C-c C-d h               hyperspec lookup, location defined in 'common-lisp-hyperspec-root'; the 'C-c C-d C-h' does not work here!&lt;br /&gt;
* C-c C-d ~               lookup a 'format character' in hyperspec&lt;br /&gt;
&lt;br /&gt;
-- Cross-Reference&lt;br /&gt;
* C-c C-w c               show callers of a function&lt;br /&gt;
* C-c C-w w               show all known callees&lt;br /&gt;
* C-c C-w r               show references to global variable&lt;br /&gt;
* C-c C-w b               show bindings of a global variable&lt;br /&gt;
* C-c C-w s               show assignments to a global variable&lt;br /&gt;
* C-c C-w m               show expansions of a macro&lt;br /&gt;
* M-x slime-who-specializes        show all known methods that specialized on a class&lt;br /&gt;
---- Lisp system dependent (works by going through heap, and is only somewhere available)&lt;br /&gt;
* C-c &amp;lt;                   list callers of a function&lt;br /&gt;
* C-c &amp;gt;                   list callees of a function&lt;br /&gt;
&lt;br /&gt;
-- Macro-Expansion&lt;br /&gt;
* C-c C-m                 macro-expand1 the expression at point&lt;br /&gt;
* C-c M-m                 macro-expand the expression at point&lt;br /&gt;
&lt;br /&gt;
-- Disassembly&lt;br /&gt;
* C-c M-d                 disassemble the function definition of the symbol at point&lt;br /&gt;
* C-c C-t                 toggle tracing of the function at point&lt;br /&gt;
* M-x slime-untrace-all   untrace all functions&lt;br /&gt;
&lt;br /&gt;
-- Abort/Recovery&lt;br /&gt;
* C-c C-b                 interrupt Lisp (send SIGINT)&lt;br /&gt;
* M-x slime-restart-inferior-lisp&lt;br /&gt;
* C-c ~                   synchronize the current package and working directory from Emacs to Lisp&lt;br /&gt;
* C-c M-p                 set the current package of the REPL&lt;br /&gt;
* M-x slime-cd            set the cwd of the Lisp process and of the REPL buffer&lt;br /&gt;
* M-x slime-pwd           print the current directory of the Lisp process&lt;br /&gt;
&lt;br /&gt;
-- Inspector&lt;br /&gt;
* C-c I                   inspect the value of an expression entered in the minibuffer&lt;br /&gt;
---- within the inspector&lt;br /&gt;
* RET                     call inspector on the value at point; call the action if point is on action&lt;br /&gt;
* d                       describe the slot at point&lt;br /&gt;
* v                       toggle between verbose and terse mode&lt;br /&gt;
* l                       go back from the previous object (return from RET)&lt;br /&gt;
* n                       inverse of 'l', also bound to SPC&lt;br /&gt;
* q                       dismiss the inspector buffer&lt;br /&gt;
* M-RET                   store the value under point in variable '*', to access it in REPL&lt;br /&gt;
&lt;br /&gt;
-- Profiling&lt;br /&gt;
* M-x slime-toggle-profile-fdefinition        toggle profiling of a function&lt;br /&gt;
* M-x slime-profile-package                   profile all functions in a package&lt;br /&gt;
* M-x slime-unprofile-all                     unprofile all functions&lt;br /&gt;
* M-x slime-profile-report                    report profiler data&lt;br /&gt;
* M-x slime-profile-reset                     reset profiler data&lt;br /&gt;
* M-x slime-profiled-functions                show list of currently profiled functions&lt;br /&gt;
&lt;br /&gt;
SLIME Debugger (SLDB)&lt;br /&gt;
-- Examining Frames (going through stack frames in debugger)&lt;br /&gt;
* t                       toggle display of local variables and CATCH tags&lt;br /&gt;
* v                       view frame's current source expression in Lisp source file's buffer&lt;br /&gt;
* e                       evaluate an expression in the frame; it can refer to local variables in the frame&lt;br /&gt;
* d                       -&amp;quot;- and pretty print the result in a temp buffer&lt;br /&gt;
* D                       disassemble the frame's function&lt;br /&gt;
* i                       inspect the result of evaluating expression in the frame&lt;br /&gt;
&lt;br /&gt;
-- Invoking Restarts&lt;br /&gt;
* a                       invoke the ABORT restart&lt;br /&gt;
* q                       &amp;quot;quit&amp;quot; - THROW to a tag that the toplevel SLIME request-loop catches&lt;br /&gt;
* c                       invoke the CONTINUE restart&lt;br /&gt;
* 0..9                    invoke restart by number; also can be called with RET on them in the buffer&lt;br /&gt;
&lt;br /&gt;
-- Navigating between Frames&lt;br /&gt;
* n, p                    move between frames&lt;br /&gt;
* M-n, M-p                move with &amp;quot;sugar&amp;quot; - display details and source of the next frame only&lt;br /&gt;
&lt;br /&gt;
-- Stepping&lt;br /&gt;
* s                       step to the next expression in the frame&lt;br /&gt;
* x                       step to next form in the current function&lt;br /&gt;
* o                       stop single-stepping temporarly, resume it upon return to this function&lt;br /&gt;
&lt;br /&gt;
-- Miscellaneous&lt;br /&gt;
* r                       restart execution of the frame with the original arguments to it&lt;br /&gt;
* R                       return from the frame with the value entered in the minibuffer&lt;br /&gt;
* B                       exit SLDB and debug the condition using Lisp system's default debugger&lt;br /&gt;
* :                       evaluate an expression entered in the minibuffer&lt;br /&gt;
&lt;br /&gt;
SLIME Misc&lt;br /&gt;
-- slime-selector command - for quickly switching to important buffers&lt;br /&gt;
-- to bind it to e.g. 'C-c s', use: (global-set-key &amp;quot;\C-cs&amp;quot; 'slime-selector)&lt;br /&gt;
-- the following keys switch to buffers:&lt;br /&gt;
* ?                       help buffer for current SLIME connection&lt;br /&gt;
* r                       the REPL for current SLIME connection&lt;br /&gt;
* d                       the most recently activated SLDB buffer&lt;br /&gt;
* l                       the most recently visited lisp-mode source buffer&lt;br /&gt;
* s                       the *slime-scratch* buffer&lt;br /&gt;
&lt;br /&gt;
-- slime-macroexpansion-minor-mode&lt;br /&gt;
* C-c C-m                 macro-expand1 the current form in place (replaces the original form)&lt;br /&gt;
* g                       repeat the last macroexpansion, replacing the contents of the buffer with new expression&lt;br /&gt;
* q                       close the expansion buffer&lt;br /&gt;
&lt;br /&gt;
SLIME Tips and Tricks&lt;br /&gt;
-- Setting Up the Lisp Image&lt;br /&gt;
   - to load swank without Emacs, just run: (load &amp;quot;/path/to/swank-loader.lisp&amp;quot;) within the running Lisp image.&lt;br /&gt;
   now just run the swank server: (swank:create-server); to use just one port, e.g. when tunneling through ssh,&lt;br /&gt;
   tell swank not to use extra connection for output: (setf swank:*use-dedicated-output-stream* nil) [this is now default].&lt;br /&gt;
   -- parameters to swank:create-server:&lt;br /&gt;
      :port - port number to listen on (default 4005)&lt;br /&gt;
      :dont-close - should the server continue accepting connections after the first one? (default NIL)&lt;br /&gt;
      :coding-system - encoding to use for communication, e.g. &amp;quot;utf-8-unix&amp;quot;&lt;br /&gt;
   - then, on the Emacs side, you set these as parameters:&lt;br /&gt;
      (setq slime-net-coding-system 'utf-8-unix)&lt;br /&gt;
      (slime-connect &amp;quot;127.0.0.1&amp;quot; 4005)&lt;br /&gt;
   - to create ssh tunnel for swank/slime: `ssh -L4005:localhost:4005 user@remote-machine.com`,&lt;br /&gt;
   then start the SLIME with 'M-x slime-connect RET RET' - RET RET means accepting defaults - localhost&lt;br /&gt;
   and 4005 port, the ssh tunnel will forward this to the 'remote-machine.com'&lt;br /&gt;
   - to translate filenames from local to remote, use 'tramp-mode', like this:&lt;br /&gt;
      (push (slime-create-filename-translator :machine-instance &amp;quot;remote-machine.com&amp;quot;&lt;br /&gt;
                                              :remote-host &amp;quot;remote&amp;quot;    ; this is what cl:machine-instance returns for the host name&lt;br /&gt;
                                              :username &amp;quot;user&amp;quot;&lt;br /&gt;
            slime-filename-translations)&lt;br /&gt;
&lt;br /&gt;
-- Connecting to SLIME automatically&lt;br /&gt;
   if you want SLIME to connect to Lisp whenever you open a Lisp file, add this to ~/.emacs:&lt;br /&gt;
      (add-hook 'slime-mode-hook&lt;br /&gt;
                (lambda ()&lt;br /&gt;
                  (unless (slime-connected-p)&lt;br /&gt;
                    (save-excursion (slime)))))&lt;br /&gt;
&lt;br /&gt;
SLIME Presentations&lt;br /&gt;
-- presentation is region of text associated with Lisp object; right-click brings up menu with allowed operations;&lt;br /&gt;
   some, like inspecting, are for all, other are specialized; you can cut-paste presentations - the objects themselves,&lt;br /&gt;
   not just the text, - even if it's unreadable object&lt;br /&gt;
-- the package 'slime-presentations' installs them in REPL; they appear in red; they can be e.g. copied to a new input&lt;br /&gt;
   in REPL; copying incomplete presentation, or editing text within it will turn it to plain text; this can be undone&lt;br /&gt;
-- they are also available in inspector (all inspectable parts are presentations) and debugger (all local variables),&lt;br /&gt;
   thus can be evaluated in REPL; they are valid as long as the corresponding buffers are open&lt;br /&gt;
* C-c C-v SPC             marks presentation at point, making it possible to copy it&lt;br /&gt;
* C-c C-v w, C-c C-v r    copying the presentation at point to the kill ring/REPL&lt;br /&gt;
* C-c C-v d, C-c C-v i    describe/inspect the object associated with the presentation at point&lt;br /&gt;
* C-c C-v n, C-c C-v p    move point to the next/previous presentation in the buffer&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>