[slime-devel] Improved font-lock

Tobias C. Rittweiler tcr at freebits.de
Sun Aug 2 20:32:43 UTC 2009

Mikhail Novikov <freiksenet at gmail.com> writes:

> Hi!
> SLIME is great and it was the reason why I switched from vim to emacs.
> But both vim and emacs+slime have one minor problem that bugs me a lot:
> syntax coloration only applies to predefined set of keywords, so not
> only some of common lisp standard keywords such as "push" are not
> colored, but also all functions user implements are not highlighted.
> Is it somehow possible to make slime modify lisp font-lock mode so all
> currently implemented functions/macroses/variables are highlighted too?
> M-tab already gives the list of all possible keywords, so this should
> not be too hard, I think %)

If all currently implemented functions/macros/variables are highlighted,
then pretty much everything is highlighted.

I once had a patch to hightlight all macros (by generalizing the
indentation update information), but I didn't like it because the result
looked like fruit salad, and all the colors would overstrain your
celebral cortex. In particular:

  - I really loathed that AND, and OR were fontified specially. That
    would redirect your attention to them, and away from the predicates
    they're used with and which are the interesting bits.

  - Emacs' fontification system works by regexps; it simply looks for
    (<symbol> and cannot know when such a occurence is actually
    evaluated. By increasing the amount of symbols that are highlighted,
    you also increase the amount of false positives which is very
    annoying when you do encounter one. (For example using BLOCK as a
    function's parameter name.)

  - For the same reason, fontification does not take packages into
    account. Although I think it's possible to make it do so. The result
    may not be performanent enough, though.

But see for yourself


(Notice how AND, and PUSH are fontified.)

What gain do you promise yourself by longing for this?


More information about the slime-devel mailing list