help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Syntax highlighting in SLIME REPL


From: Akater
Subject: Syntax highlighting in SLIME REPL
Date: Sun, 13 Jan 2019 18:37:14 +0000

The SO answer [1] offers one solution to highlight CL syntax in SLIME
REPL. With minor changes, it goes like this:

#+begin_src lisp
    (defvar slime-repl-font-lock-keywords lisp-cl-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))))
    
    (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)))))
#+end_src lisp

This seems to work nicely but overrides SLIME's own output font. I
tried to fix this with

#+begin_src lisp
    (defadvice slime-repl-emit (after font-lock-face activate)
      (let ((inhibit-read-only t))
        (add-text-properties
         slime-output-start
         slime-output-end
         '(font-lock-face
           slime-repl-output-face
           rear-nonsticky
           (slime-repl-output read-only font-lock-face intangible)))))
#+end_src lisp

but failed, as slime-output-start and slime-output-end are seemingly not
recognised as markers, even though I don't see how they are treated
differently by SLIME when compared to `slime-repl-prompt-start-mark'.

My defadvice was an imitation guess only, so the real question is, how
do I enable syntax highlighting in SLIME REPL without breaking
slime-repl-output-face.

[1] 
https://stackoverflow.com/questions/25809493/how-can-i-get-syntax-highlighting-for-common-lisp-in-slimes-repl

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]