问题
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:
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))))))
来源:https://stackoverflow.com/questions/25809493/how-can-i-get-syntax-highlighting-for-common-lisp-in-slimes-repl