如何在SLIME的REPL中为常见的lisp获取语法高亮?

时间:2014-09-12 13:29:52

标签: emacs common-lisp slime

我想学习Common Lisp并通过emacs包管理器安装了emacs(24.3)和slime。

在粘液中,REPL语法突出显示不起作用。另一方面,当我启动Lisp-Mode(同时在粘液REPL中)时,表达式的值不再被打印(当我打字时,说" Hello World"然后点击输入I获取一个新行而不是表达式的值。

(如果我打开lisp文件语法高亮显示工作)

1 个答案:

答案 0 :(得分:3)

这对我有用 (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))))))