Changing command-char removes highlight of the command line in DrRacket #103

Closed
opened 9 years ago by gregid · 7 comments
gregid commented 9 years ago (Migrated from github.com)

If you change command-char to anything other than lozenge DrRacket drops the highlight of command lines (or rather doesn't apply highlighting to new command-char).
Also please consider alternative default command-char for those stuck with Windows (or even Linux) as the idea of using character not even on the keyboard is somewhat discouraging for users (especially with no highlight) - it was for me until I finally ended up with AutoHotKey to get the character. How about simple "^" ie:

^(define inner 2)

and

^|inner|

It seems like a logical choice as it brings to mind: "look up" and it still looks like a half of the lozenge ;)

If you change command-char to anything other than lozenge DrRacket drops the highlight of command lines (or rather doesn't apply highlighting to new command-char). Also please consider alternative default command-char for those stuck with Windows (or even Linux) as the idea of using character not even on the keyboard is somewhat discouraging for users (especially with no highlight) - it was for me until I finally ended up with AutoHotKey to get the character. How about simple "^" ie: ``` ^(define inner 2) ``` and ``` ^|inner| ``` It seems like a logical choice as it brings to mind: "look up" and it still looks like a half of the lozenge ;)
mbutterick commented 9 years ago (Migrated from github.com)

If you change command-char to anything other than lozenge DrRacket drops the highlight of command lines (or rather doesn't apply highlighting to new command-char).

True. Not sure what to do about it. Even if I could get DrRacket to see the custom command character, AFAIK DrRacket caches the language settings for a whole session. Meaning, if you switched between Pollen source files with different command characters, the syntax highlighting wouldn’t follow.

Also please consider alternative default command-char for those stuck with Windows

Any plain text can be valid Pollen source code, so there are annoying consequences to using an ASCII command character. For instance, you couldn’t easily move text into or out of Pollen from other places (because you'd have to escape / unescape the ASCII command character). Whereas once you have a way of typing the lozenge, you can use it forever. In other words, instead of a permanent, incurable wart in the system design, I’ve opted for a temporary, curable one. (While you’re at it, you can figure out the λ character too)

Here’s an AutoHotkey script for Windows.

> If you change command-char to anything other than lozenge DrRacket drops the highlight of command lines (or rather doesn't apply highlighting to new command-char). True. Not sure what to do about it. Even if I could get DrRacket to see the custom command character, AFAIK DrRacket caches the language settings for a whole session. Meaning, if you switched between Pollen source files with different command characters, the syntax highlighting wouldn’t follow. > Also please consider alternative default command-char for those stuck with Windows Any plain text can be valid Pollen source code, so there are annoying consequences to using an ASCII command character. For instance, you couldn’t easily move text into or out of Pollen from other places (because you'd have to escape / unescape the ASCII command character). Whereas once you have a way of typing the lozenge, you can use it forever. In other words, instead of a permanent, incurable wart in the system design, I’ve opted for a temporary, curable one. (While you’re at it, you can figure out the `λ` character too) Here’s an [AutoHotkey script for Windows](http://pkg-build.racket-lang.org/doc/pollen/pollen-command-syntax.html#%28part._.A.H.K_script%29).
mbutterick commented 9 years ago (Migrated from github.com)

I think that you have to make the syntax colorer discover which is the
@ character in the same way "#lang pollen" discovers it and then pass
that along to the scribble-inside-lexer. (This may require changing
scribble-inside-lexer to be more flexible in when it accepts the
character.) Lexers have a way to track context information (via the
"mode" argument and the last result) and so that can be extended to
track whether or not the character has been seen yet and, if it has,
what it is.

> I think that you have to make the syntax colorer discover which is the > @ character in the same way "#lang pollen" discovers it and then pass > that along to the scribble-inside-lexer. (This may require changing > scribble-inside-lexer to be more flexible in when it accepts the > character.) Lexers have a way to track context information (via the > "mode" argument and the last result) and so that can be extended to > track whether or not the character has been seen yet and, if it has, > what it is.
mbutterick commented 9 years ago (Migrated from github.com)

I will research this a bit more based on the advice above.

I will research this a bit more based on the advice above.
mbutterick commented 9 years ago (Migrated from github.com)

After further investigation, this isn’t going to work. Sorry. DrRacket’s syntax coloring has constraints.

After further investigation, this isn’t going to work. Sorry. DrRacket’s syntax coloring has constraints.
gregid commented 9 years ago (Migrated from github.com)

Thanks for trying. If you don't mind reading alternative idea - to make a more pleasant experience for a newcomer to Pollen (ie: to allow a newcomer to jump right in - instead of figuring out stuff like AutoHotKey and/or changing command-char before first proper use) I would suggest extending DrRacket, Insert menu to be exact. Similarly to existing "Insert λ Ctl+" add "Insert ◊ (some shortcut)".

IMHO that would resolve majority of lozenge averse doubts about the choice made for the command-char.

If you are not interested in this direction I may try to write the extension myself in few months time - after learning a bit more about language and its IDE (DrRacket). Your project (Pollen) was one of the reasons I decided to give Racket a try - so thank you for your hard work!

Thanks for trying. If you don't mind reading alternative idea - to make a more pleasant experience for a newcomer to Pollen (ie: to allow a newcomer to jump right in - instead of figuring out stuff like AutoHotKey and/or changing command-char before first proper use) I would suggest extending DrRacket, Insert menu to be exact. Similarly to existing "Insert λ Ctl+\" add "Insert ◊ (some shortcut)". IMHO that would resolve majority of lozenge averse doubts about the choice made for the command-char. If you are not interested in this direction I may try to write the extension myself in few months time - after learning a bit more about language and its IDE (DrRacket). Your project (Pollen) was one of the reasons I decided to give Racket a try - so thank you for your hard work!
mbutterick commented 9 years ago (Migrated from github.com)

Similarly to existing "Insert λ Ctl+" add "Insert ◊ (some shortcut)".

Sure: it is now issue #104.

Your project (Pollen) was one of the reasons I decided to give Racket a try - so thank you for your hard work

I welcome suggestions for improvement.

> Similarly to existing "Insert λ Ctl+\" add "Insert ◊ (some shortcut)". Sure: it is now issue #104. > Your project (Pollen) was one of the reasons I decided to give Racket a try - so thank you for your hard work I welcome suggestions for improvement.
mbutterick commented 9 years ago (Migrated from github.com)

DrRacket’s syntax coloring has constraints.

After further further investigation, I came up with a way of doing this. The DrRacket syntax colorer will now correctly colorize a custom Pollen command character.

Keep in mind that DrRacket only reads this character once when you open a source file. Thus, if you go to "pollen.rkt" and alter the custom command character during a session, you won't see it reflected in the syntax coloring until you close and reopen the affected source files.

> DrRacket’s syntax coloring has constraints. After further further investigation, I came up with a way of doing this. The DrRacket syntax colorer will now correctly colorize a custom Pollen command character. Keep in mind that DrRacket only reads this character once when you open a source file. Thus, if you go to "pollen.rkt" and alter the custom command character during a session, you won't see it reflected in the syntax coloring until you close and reopen the affected source files.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: mbutterick/pollen#103
Loading…
There is no content yet.