简体   繁体   English

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

[英]How can I get syntax highlighting for common lisp in SLIME's REPL?

I want to learn Common Lisp and have installed emacs (24.3) and slime via the emacs package manager. 我想学习Common Lisp并通过emacs包管理器安装了emacs(24.3)和slime。

In the slime REPL syntax highlighting doesn't work. 在粘液中,REPL语法突出显示不起作用。 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. 另一方面,当我启动Lisp-Mode(而在slime REPL中)时,表达式的值不再被打印(当我输入时,说“Hello World”并点击回车我得到一个新行而不是表达的价值。

(If I open lisp files syntax highlighting works) (如果我打开lisp文件语法突出显示工程)

this works for me ( http://compgroups.net/comp.emacs/tweaking-slime/95455 ): 这对我有用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))))))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM