7
votes

I want to learn Common Lisp and have installed emacs (24.3) and slime via the emacs package manager.

In the slime REPL syntax highlighting doesn't work. When I start Lisp-Mode (while in the slime REPL) on the other hand, the values of the expressions don't get printed anymore (when I type, say "Hello World" and hit enter I get a new line instead of the value of the expression.

(If I open lisp files syntax highlighting works)

1
Where exactly is syntax highlighting not working? Are you talking about *.lisp buffers or the REPL or both? You also might want to add the common lisp tag to your question to increase visibility. - schaueho
I'm talking about the REPL. - user3691571
Added the tag and edited the question, hope it is more clear now. - user3691571
I get syntax highlighting for the buffer, although I don't get the differentiated syntax highlighting as in a CL code buffer. Instead the entire *slime-repl*buffer gets syntax-highlighting which allows to quickly distinguish between code you typed, warnings or messages from your CL system and return values. - schaueho

1 Answers

3
votes

this works for me (http://compgroups.net/comp.emacs/tweaking-slime/95455):

(defvar slime-repl-font-lock-keywords lisp-font-lock-keywords-2)
(defun slime-repl-font-lock-setup ()
  (setq font-lock-defaults
        '(slime-repl-font-lock-keywords
         ;; From lisp-mode.el
         nil nil (("+-*/.<>=!?$%_&~^:@" . "w")) nil
         (font-lock-syntactic-face-function
         . lisp-font-lock-syntactic-face-function))))

(add-hook 'slime-repl-mode-hook 'slime-repl-font-lock-setup)

(defadvice slime-repl-insert-prompt (after font-lock-face activate)
  (let ((inhibit-read-only t))
    (add-text-properties
     slime-repl-prompt-start-mark (point)
     '(font-lock-face
      slime-repl-prompt-face
      rear-nonsticky
      (slime-repl-prompt read-only font-lock-face intangible))))))