Search code examples
emacscommon-lispslime

I can't close the last parenthesis and send my function to the REPL using lisp-mode in Slime


This is a very simple question. I have installed Emacs 22.2.1 (from the Ubuntu (9.04) repo and I downloaded Slime-current from the repo on their homepage.

I followed the instructions provided with slime and it works. I can start slime and use it as expected.

However, when I enter lisp-mode (M-x lisp-mode) I can no longer interact with the REPL. Nothing I type works, the cursor just moves to the next line when I press enter.

Does anyone have a fix for this?

Edit:

Regarding the question of how I'm using Emacs. Yes, I start Emacs, then enter slime with M-x slime. I read that I could get proper syntax highlighting by next entering lisp mode with M-x lisp-mode.

It did provide syntax highlighting, but as pointed out below, it's meant for editing text files, not interacting with the REPL.

I also recently read that placing the following in my .emacs file will enable syntax highlighting (it did not work).

; Syntax Highlighting
(global-font-lock-mode 1)

; Enable slime
(add-to-list 'load-path "/home/doug/Software/slime/")  ; your SLIME directory
(setq inferior-lisp-program "/home/doug/Software/ccl/ccl") ; your Lisp system
(require 'slime)
(slime-setup)

; Enable psvn
(require 'psvn)

So I guess my question needs revising. Since lisp-mode isn't meant to simply enable lisp features for slime, then how I enable syntax highlighting in slime?

Edit 2:

The answer was provided in a comment.

Start slime then open/create a new file to work with. This is the buffer where lisp-mode is intended to be used.

The function is written, highlighted, and sent to the REPL. The output appears at the bottom.

The two are supposed to cooperate, not integrate.


Solution

  • Moved out of comments: usually, you would not write big functions directly in the REPL buffer, but write them in another buffer and send them to the REPL via C-c C-c. The slime-repl-mode has its own highlighting, but with a different purpose: it shows input, output, and system messages in different colours (in my green-on-black setup, it shows input in green, system messages in red, and output in light blue).