[slime-devel] Re: SLIME + syntax highlighting

Tobias C. Rittweiler tcr at freebits.de
Mon Jun 4 08:10:06 UTC 2007


Jeronimo Pellegrini <j_p at aleph0.info> writes:

> I have noticed that when I define my own macros and functions,
> SLIME knows their syntax. If I do:
>
> (my-function-name
>
> SLIME will show the syntax at the minibuffer.

(For the record: that is when SLIME-AUTODOC-MODE is T.)


> Now, since SLIME knows about my own macros/functions, I wonder
> if it is possible for it to also do syntax highlighting for them?
> (Perhaps in a different color from the standard Lisp keywords?)
>
> On a related not, I see that some Lisp identifiers (do, dotimes,
> etc) are highlighted, but some are not. From what I can see,
> only those that are related to control flow are highlighted. Am
> I right?
> And is that possible to get the rest of the identifiers
> highlighted?

Syntax highlighting is called `font-lock' (or fontifying) in Emacs; and
fontifying is defined by Emacs, and as such completely orthogonal to
Slime. Look at the end of the file `font-lock.el' (or .el.gz) within
your Emacs distribution. (Especially `lisp-font-lock-keywords-2'.)

In general, only standard macros and special forms are highlighted
specially. I've got the following in my ~/.emacs, however:

  (font-lock-add-keywords 'lisp-mode
   '(("(\\(\\(define-\\|do-\\|with-\\)\\(\\s_\\|\\w\\)*\\)" 
     1 font-lock-keyword-face)))

So all symbols beginning with `define-', `do-', or `with-' are
highlighted specially. (As these should denote macros.) 

You may like that, too!

  -T.




More information about the slime-devel mailing list