SLIME features in Lisp mode
SLIME features in Lisp mode
Hi there,
When I'm starting to type a function in the SLIME REPL and have typed, say, "(string-", I can press tab and I get a list of possible completions. I assume these are found dynamically from the module, so they include e.g. things I've not typed before.
However, when editing a source file in Lisp mode I can do M-/ which can cycle through options, but only those it's seen previously e.g. earlier in the source file or in the REPL.
I find it really inconvenient to have to C-x o to the REPL in order to see expansions for functions I don't remember (which is normally because I've not used them recently!). Does anyone know how I can get this aspect of REPL-like behaviour in a lisp-mode buffer?
When I'm starting to type a function in the SLIME REPL and have typed, say, "(string-", I can press tab and I get a list of possible completions. I assume these are found dynamically from the module, so they include e.g. things I've not typed before.
However, when editing a source file in Lisp mode I can do M-/ which can cycle through options, but only those it's seen previously e.g. earlier in the source file or in the REPL.
I find it really inconvenient to have to C-x o to the REPL in order to see expansions for functions I don't remember (which is normally because I've not used them recently!). Does anyone know how I can get this aspect of REPL-like behaviour in a lisp-mode buffer?
Re: SLIME features in Lisp mode
With Emacs only very few things are as easy as they sound. But Emacs users know that there is always help available from Emacs itself.
The SLIME Manual Section 3.4 Completion Commands tells me that I shall use M-TAB to complete symbols. But if I press M-TAB, my window manager (fvwm2) shows me a list of all open windows, while in Emacs happens nothing, because the M-TAB never reaches Emacs at all.
But maybe M-TAB works for you (try this first).
If M-TAB doesn't work, then first the easy method:
- edgar
The SLIME Manual Section 3.4 Completion Commands tells me that I shall use M-TAB to complete symbols. But if I press M-TAB, my window manager (fvwm2) shows me a list of all open windows, while in Emacs happens nothing, because the M-TAB never reaches Emacs at all.
But maybe M-TAB works for you (try this first).
If M-TAB doesn't work, then first the easy method:
- If there is a SLIME menu in your Emacs menu bar in Lisp source code buffers then just simply look-up the key binding of the "Complete Symbol" entry in the SLIME menu.
- The page of the SLIME Manual (same link as above) tells me that the SLIME Emacs function is called `slime-complete-symbol'.
- If I press C-h b (describe-bindings) in a Lisp code buffer then a second buffer pops up with all current key bindings of the Lisp code buffer.
- In the key bindings buffer I search for `slime-complete-symbol' and find that the function in my Emacs is also bound to C-c TAB.
- edgar
Re: SLIME features in Lisp mode
Hey - thanks, that explanation taught me a lot. Much appreciated!
Re: SLIME features in Lisp mode
The probably most important Emacs key-combo is C-h C-h, that pops-up a buffer with a list of all Emacs C-h... introspection functions.
- edgar
- edgar
Re: SLIME features in Lisp mode
Awesome, that's really helpful - thanks again!edgar-rft wrote:The probably most important Emacs key-combo is C-h C-h, that pops-up a buffer with a list of all Emacs C-h... introspection functions.
Re: SLIME features in Lisp mode
This snippet from my ~/.emacs might help.
Searching for "slime-indent-and-complete-symbol" may find a better way to do this.
Slime is a bit complicated to configure and IMO the defaults are less than ideal. Search around; there are a number of blog posts describing tricks and tips, parenscript, etc.
Code: Select all
(define-key slime-mode-map
(kbd "TAB") 'slime-indent-and-complete-symbol)
Slime is a bit complicated to configure and IMO the defaults are less than ideal. Search around; there are a number of blog posts describing tricks and tips, parenscript, etc.