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

To reply to this bug, email your comments to 48567 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#48567; Package emacs. (Fri, 21 May 2021 14:47:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sam Weerasinghe <oystersauce8 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 21 May 2021 14:47:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sam Weerasinghe <oystersauce8 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes
Date: Fri, 21 May 2021 05:33:05 -0700
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')}"




################################################################################

In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin19.6.0)
 of 2021-03-24 built on Administrators-MacBook-Pro-2.local
Repository revision: a5617bccf7d77b24c6f431e2c97496c440b06fe2
Repository branch: master
System Description:  Mac OS X 10.15.6

Configured using:
 'configure --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/HEAD-a5617bc/share/info/emacs
 --prefix=/usr/local/Cellar/emacs/HEAD-a5617bc --with-gnutls --without-x
 --with-xml2 --without-dbus --with-modules --without-ns
 --without-imagemagick --without-selinux'

Configured features:
ACL GMP GNUTLS JSON LIBXML2 MODULES NOTIFY KQUEUE PDUMPER THREADS XIM
ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Help

Minor modes in effect:
  xterm-mouse-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  projectile-mode: t
  shell-dirtrack-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  which-key-mode: t
  override-global-mode: t
  global-auto-revert-mode: t
  mouse-wheel-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/lisp/coverage hides
/Users/administrator/.emacs.d/elpa/coverage-20191113.1958/coverage

Features:
(shadow sort mail-extr emacsbug sendmail eieio-opt speedbar ezimage
dframe shortdoc help-fns radix-tree pulse cus-start cus-load xt-mouse
vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs bug-reference
git-rebase mule-util magit-extras face-remap magit-bookmark
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func magit-diff
smerge-mode diff git-commit log-edit message rmc puny rfc822 mml mml-sec
epa epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log
magit-core magit-autorevert magit-margin magit-transient magit-process
with-editor magit-mode transient magit-git magit-section magit-utils crm
two-column sh-script executable misearch multi-isearch vc rect dired-aux
inf-ruby rubocop tramp tramp-loaddefs trampver tramp-integration files-x
tramp-compat parse-time iso8601 ls-lisp git-auto-commit-mode vc-git
diff-mode vc-dispatcher image etags fileloop generator js imenu cc-mode
cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs term/xterm xterm server projectile ibuf-ext ibuffer
ibuffer-loaddefs flycheck rx exec-path-from-shell sgml-mode facemenu dom
prodigy hl-line bpr rspec-mode ruby-mode smie coverage ov
my-send-to-terminal-app key-chord iterm thingatpt my-org-mode-toggling
vue-mode edit-indirect ssass-mode vue-html-mode mmm-cmds mmm-mode
mmm-univ mmm-class mmm-region mmm-auto mmm-vars mmm-utils mmm-compat
hydra lv use-package-hydra ob-shell shell org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete
pcomplete org-list org-faces org-entities time-date noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-table ol org-keys
org-compat org-macs org-loaddefs format-spec find-func cal-menu calendar
cal-loaddefs bookmark+ bookmark+-key dired-x bookmark+-1 bookmark+-bmu
bookmark+-lit bookmark pp f dash s wgrep grep yasnippet counsel xdg xref
project dired dired-loaddefs compile text-property-search comint
ansi-color swiper ivy derived delsel ring colir color ivy-overlay
which-key pcase advice regexp-opt cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core autorevert
filenotify finder-inf info tool-bar edmacro kmacro package browse-url
url url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
mwheel iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite charscript charprop case-table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote threads kqueue multi-tty
make-network-process emacs)

Memory information:
((conses 16 783962 128052)
 (symbols 48 43055 2)
 (strings 32 168549 9980)
 (string-bytes 1 5311958)
 (vectors 16 62744)
 (vector-slots 8 764803 34047)
 (floats 8 385 3077)
 (intervals 56 9906 816)
 (buffers 992 61))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#48567; Package emacs. (Mon, 24 May 2021 00:55:01 GMT) Full text and rfc822 format available.

Message #8 received at 48567 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Sam Weerasinghe <oystersauce8 <at> gmail.com>, 48567 <at> debbugs.gnu.org
Subject: Re: 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 2 years and 346 days ago.

Previous Next


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