racket / racket/drracket

Proposal: New info key `drracket:comments`

Open
#634 34 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
516
Forks
103
PR merge metrics
No merged PRs in 30d

Description

Things like DrRacket and Emacs offer commands to comment and un-comment a region.

Non-s-expression langs should be able to supply information for these commands, via a new info key named something like "drracket:comments".

Open to improvements, but initially I'll suggest the value is a list:

(list comment-start comment-end comment-padding)

where those three values as identical to three configuration variables in Emacs:

When a comment command makes a new comment, it inserts the value of
‘comment-start’ as an opening comment delimiter. It also inserts the
value of ‘comment-end’ after point, as a closing comment delimiter. For
example, in Lisp mode, ‘comment-start’ is ‘";"’ and ‘comment-end’ is
‘""’ (the empty string). In C mode, ‘comment-start’ is ‘"/* "’ and
‘comment-end’ is ‘" */"’.

The variable ‘comment-padding’ specifies a string that the commenting
commands should insert between the comment delimiter(s) and the comment
text. The default, ‘" "’, specifies a single space. Alternatively, the
value can be a number, which specifies that number of spaces, or ‘nil’,
which means no spaces at all.

Examples:

  • s-expression langs (default): (";;" "" " ")
  • scribble: ("@;" "" " ")
  • rhombus: ("//" "" " ")

I'd suggest that when the key isn't supplied, it's OK to default to s-expression as the default. (Justification: There exist many more s-expression langs.)


Whatever the final form, I think the to-do list would be:

If agreed/confirmed, I would probably be able to make PRs easily for all but the last. (I'm not familiar with that code. I'm not sure about details like whether a "Racket" menu is where these should continue to live.)


Background: https://github.com/greghendershott/racket-mode/pull/661#issuecomment-1693769408

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the documented language-customization page and DrRacket’s existing comment and uncomment commands, then compare the proposed drracket:comments values for s-expression languages, Scribble, and Rhombus. Done means confirming whether the documented info key and command integration are complete, or identifying the remaining design decision and implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
emacs
Domain
desktop, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.