[racket] scratching an itch: how do I customize which words get colored as keywords in DrRacket?
On Jun 8, 2013, at 1:31 PM, Robby Findler <robby at eecs.northwestern.edu> wrote:
> It is the ones that it has special indentation rules for. Not super heplful to you here, I know.
That sounds like this won't be super easy, but it's a start! Thank you Robby.
Who knows how to add indentation rules to DrRacket? Where are they found? Is their modification something that can be attempted by a long-time programmer, but Racket novice? If I can add an indentation rule for "if" that just duplicates the current default behavior, then hopefully, it would highlight my ifs!
> The specific conditional that you might be looking (if you wish to do things differently) for is in framework/private/racket.rkt around line 1306 in the body of racket-lexer-wrapper. The first case of that 'cond' is the keyword case and that shows how it wires into the preferences. So if you wanted to add a new preference pane or something, that's where you'd look at its values.
I don't really want to add a new preference pane to DrRacket; that sounds like a useful and worthy project for someone with more time and experience than I have. I just want to get DrRacket to highlight "if" to start out with.
Any other knowledgable people willing to share some insights to help in this quest?
--Christopher
>
> Robby
>
>
> On Sat, Jun 8, 2013 at 2:05 PM, Christopher <ultimatemacfanatic at gmail.com> wrote:
> Greetings all! First post here.
>
> Just finished my first significant project in Racket: writing parser in Racket for my new Python/Racket fusion programming language (roughly 2000 lines of Racket for the parser). The next phase is the runtime classes, which seems less straightforward--wish me luck!
>
> Also happy to report figuring out on my own how to get Command-L reassigned to goto-line instead of Choose Language in DrRacket, using my own home-brewed keybindings file, as I frequently switch between other editors that use this key binding. (However, DrRacket not only fails when instructed through the menu interface to detach this keybindings file, but does so reporting an internal error, but that's another story and may or may not be due to somebody else's bug.)
>
>
>
>
> Now that I've introduced myself, let me get to the reason I'm writing.
>
> In DrRacket I have gone to Preferences menu item->Colors tab->Racket sub-tab and changed the color associated with "Keyword" to orange, to make it a different color from the blue color for "Symbol".
>
> I have noticed that there are some symbols colored as being in the "Keyword" category that I wish were not, and there are others not so colored that I wish would be thus. For instance, I'm considered having "match", "class", and "make-object" be colored as "Symbol" instead of "Keyword"; on the other hand, I am dumbfounded that, while "cond", "while", and "unless" are colored as keywords, "if" is colored as an ordinary symbol; this seems like an incontestable error of omission (surely an accident).
>
> I have grepped through all the source files in DrRacket's "collects" folder, but have not been able to isolate the place where DrRacket's list of keywords are stored.
>
> Does anyone know how to tweak the list of symbols that DrRacket colors as keywords? I would consider using a different, more easily customizable editor like my beloved TextMate 2, but neither it nor any of the other editors I'm familiar with has DrRacket's intelligent indentation assistance that conforms to Racket conventions for indenting--this is a feature without which I would probably lose my mind, given my compulsion for proper and consistent indentation.
>
>
>
> Any help would be appreciated!
>
> Thank you,
>
> Christopher
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130608/658c08de/attachment.html>