[racket-dev] Parens/string quotes automatic behavior

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Thu May 23 10:15:06 EDT 2013

Hello Racket devs,

I'm working on tweaking how typing a double quote is handled in strings
when DrRacket's auto parens mode is on, per recent post on the users list.
If any of you use the mode and can offer feedback on the following, it'd be
appreciated: In addition to handling Laurent's initial feature request (see
message at bottom), I'm setting it up so that if the following string is in
the DrRacket window:
  "abcdefghi"
and you select the _def_ and press " (double quote), then it places
double-quotes around the "def" with additional quotes to ensure that the
other two portions of the string are still validly delimited, i.e.
  "abc""def""ghi"

One question is where to put the cursor following this operation? Should it
be right inside the beginning of the lifted string, or in front of its
double quotes, i.e.:
  "abc""|def""ghi"
or "abc"|"def""ghi"
?

Another question is whether to space off the "def" string that is created
from the surrounding ones, i.e.
  "abc" "def" "ghi"
instead of "abc""def""ghi"?

(As a side note: the Emacs paredit mode handles the situation of a double
quotes typed inside a string by inserting an escaped \". It uses a separate
key combination to handle splitting both strings and parenthesized
expressions into two pieces.)

Thanks,

--- nadeem

On May 22, 2013, at 7:07 AM, Laurent wrote:

> Hi,
>
> The new behavior of automatic parenthesis matching is really nice, but
there is one problem with string quotes.
> For example, if the cursor is in the middle of a string and I type the
string-quote symbol ", it places a quote which cuts the current string and
leaves the right part in a bad syntax.
>
> Most of the time, when I type a quote inside a string, it's because I
want to split the string in two parts.
> To do that, I have to type string-quote, string-quote, delete (to remove
the extra string-quote added by the paren-match behavior), and left to go
back between the two strings, which is mildly annoying.
>
> Would it be possible (unless problematic) to have the default paren-match
behavior for strings that splits the string instead of inserting a single
string-quote, possibly unless the left symbol is a backslash?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20130523/49ebbb99/attachment.html>

Posted on the dev mailing list.