bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48567: 28.0.50; ruby-toggle-string-quotes quotes the wrong pair of q


From: Dmitry Gutov
Subject: bug#48567: 28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes
Date: Mon, 24 May 2021 03:54:02 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

Hi!

On 21.05.2021 15:33, Sam Weerasinghe wrote:
I have a method like this:

   def create!
     form_name = "Acme Corp #{shop.label("Abandon Cart")}"
   end

put point at the start of the phrase "Abandon Cart"
and press C-c ' ( ruby-toggle-string-quotes ),

the line becomes:

     form_name = 'Acme Corp #{shop.label("Abandon Cart")}'

but the line should become:

     form_name = "Acme Corp #{shop.label('Abandon Cart')}"

Improving this in a consistent fashion is somewhat difficult because we don't support an infinite nesting of string literals (or percent literals, etc), and the "inner" quote characters are not really considered to be quote characters by the syntax scanner anymore.

So identifying the pair of quotes to change, which ones to skip over, and which ones to quote-unquote, will require some ad-hoc heuristics.

I'd be happy to review a patch, though.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]