Open andrew-kennedy opened 8 years ago
Thanks for the report. IIUC this is also relevant to #lang typed/racket
and simply optional arguments in plain #lang racket
.
The DrRacket feature upon which this is modeled doesn't seem to handle this case either. At least when I tried just now with Racket 6.3.
That doesn't mean racket-mode couldn't do better in this regard; just an observation.
That's interesting. I just tested in DrRacket 6.4 and it still doesn't function correctly. I'll probably just turn it off then, at least for typed Racket and plai-typed. Maybe something like general-close can provide a good enough solution for this, as opposed to using DrRacket's features.
Maybe something like general-close can provide a good enough solution for this, as opposed to using DrRacket's features.
If you'd be happy with just the closing delimiter, racket-mode already does this for }
, ]
, )
. For instance C-h k ] says:
] runs the command racket-insert-closing, which is an interactive
compiled Lisp function in `racket-common.el'.
It is bound to }, ], ).
(racket-insert-closing &optional PREFIX)
Insert a matching closing delimiter.
With a prefix, insert the typed character as-is.
Of course many people get matching closing delimiters from paredit
, smartparens
, or (in newer Emacs) electric-pair-mode
. The smart open bracket works with all these, and the appeal is just hitting [ and it (hopefully) does the right thing.
Having said that, I don't actually use the smart open bracket feature in racket-mode, myself. I added it on request.
In plai-typed, function arguments in definitions look like this:
smart-open-bracket does not handle inserting brackets in this case, reverting to parens. Just wanted to make the author aware, not sure if there's a good solution to this.