GNU bug report logs - #48567
28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes

Previous Next

Package: emacs;

Reported by: Sam Weerasinghe <oystersauce8 <at> gmail.com>

Date: Fri, 21 May 2021 14:47:01 UTC

Severity: minor

Found in version 28.0.50

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Sam Weerasinghe <oystersauce8 <at> gmail.com>, 48567 <at> debbugs.gnu.org
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
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.




This bug report was last modified 4 years and 23 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.