[slime-devel] Trouble adding to font-lock-syntactic-keywords for the REPL and *inferior-lisp*

Nikodemus Siivola nikodemus at random-state.net
Sat Dec 3 20:35:02 UTC 2011


Here's a bit of code (originally thanks to Tobias) I'd like to make
slime-indentation to use to make sexps parse right -- it sometimes
messes up indentation most irritatingly when Emacs counts #p"foo" as
two expressions instead of one.

(defun common-lisp-declare-dispatch-macro-char (def1 &rest more-defs)
  (let ((regexp (regexp-opt (cons def1 more-defs))))
    (pushnew `(,regexp 0 "'") font-lock-syntactic-keywords :test #'equal)))

(defun common-lisp-extend-sexp-syntax ()
  ;; Set up some of the finer points of CL syntax.
  (make-variable-buffer-local 'font-lock-syntactic-keywords)
  (set (make-variable-buffer-local 'parse-sexp-lookup-properties) t)
  (common-lisp-declare-dispatch-macro-char "#*" "#." "#=" "#A" "#C" "#P" "#S"))

I put this in lisp-mode-hook without trouble, and normal lisp buffers
will be fine.

However, neither REPL nor inferior lisp use the lisp-mode, and even if
I manually try to enable this for them by calling
(common-lisp-extend-syntax), they presist in believing that
sharp-macros such as these consititute two expressions. Looking at
font-lock-syntactic-keywords I see just what I expect, so I'm a bit at
a loss as to why it doesn't work.

Any ideas or suggestions?

Cheers,

 -- Nikodemus




More information about the slime-devel mailing list