1. Jens' solution is good. I've used for the Pygments highlighter and
for racket-mode. I recommend it!  You may want to stop reading now. :)

2. Coincidentally very recently I've been taking a fresh look at this
for racket-mode. I think a recent commit message sums it up pretty
well:

https://github.com/greghendershott/racket-mode/commit/5956f51c0e14d2c295adaf644b0e8c7f6448701d

~~~

The question of what is a "keyword" and a "builtin" is not so simple
in Racket:

1. The distinction between the two is squishy, and from one point of
   view Racket has 1400+ "primitives" (!).

2. As for "builtins", there are many, many "batteries included"
   libraries in the main distribution. Where to draw the line?

3. More fundamentally, Racket is a language for making languages.
   Ultimately the only way to be 100% correct is to do something "live"
   with namespace-mapped-symbols. But I don't see that as performant for
   Emacs font-lock.

Here I'm saying that:

(a) "keywords" are syntax (only) from racket/base

(b) "builtins" are everything else provided by #lang racket and #lang
    typed/racket (except the capitalized Types from typed/racket go into
    their own list). Plus for modern macros, racket/syntax and a few
    items from syntax/parse (but not all the syntax classes, because
    things like `id` and `str` are too "generic" and too likely to be
    user program identifiers).

Is that somewhat arbitrary? Hell yes. It's my least-worst, practical
idea for now. Also, IMHO it's an improvement over getting pull
requests to add people's favorites, a few at a time. At least this way
is consistent, and can be regenerated programatically as Racket
evolves.

~~~

TL;DR  No fixed list will be correct. Some fixed lists will
pragmatically be OK for most people. It's a judgment call where to
draw the line -- whether you want to include identifiers also from
typed/racket, racket/syntax, syntax/parse, or others.

Also I have a commit to support Emacs font-lock-maximum-decoration
(the level of font-lock), so people who find the pragmatic list of
keywords annoying or distracting can just completely disable
highlighting those.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to