From unknown Sun Jun 15 08:43:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48567: 28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes Resent-From: Sam Weerasinghe Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 May 2021 14:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48567 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 48567@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162160838723346 (code B ref -1); Fri, 21 May 2021 14:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 May 2021 14:46:27 +0000 Received: from localhost ([127.0.0.1]:37370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lk6Py-00064T-Mh for submit@debbugs.gnu.org; Fri, 21 May 2021 10:46:27 -0400 Received: from lists.gnu.org ([209.51.188.17]:43388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lk4LJ-0000LC-AB for submit@debbugs.gnu.org; Fri, 21 May 2021 08:33:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lk4LH-0004mm-G9 for bug-gnu-emacs@gnu.org; Fri, 21 May 2021 08:33:29 -0400 Received: from mail-oo1-xc34.google.com ([2607:f8b0:4864:20::c34]:45926) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lk4L9-0005yQ-Ft for bug-gnu-emacs@gnu.org; Fri, 21 May 2021 08:33:27 -0400 Received: by mail-oo1-xc34.google.com with SMTP id s1-20020a4ac1010000b02901cfd9170ce2so4536302oop.12 for ; Fri, 21 May 2021 05:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=t4E23KpgkBrDH2wuNHn6WT+gzuNBo0mzHcr28T0v8lA=; b=KlUDOWF71q0DTertoKwNJX7gBIcUBy+mJiVcpWolJRAHvbGkj8QAIcr2relohwlVer 8pF+W2id4JIuEpmQ0b0J1YE9suySDFHNeshJCd3DfEOgyTqvThO5GbxxnSFJYGZSaTFS sEJ/zzRgmK+5v0dQW4DLrN1UxesluL9UH3llDWp7Eb66M0ufH2OEjQ73JEspxeTOQQqE XdUMoRtWCo4KAFyszKdLvFGDlLqwgjjL0dZMKB5E+rqfBbyKW+XdcXV4Mm+mikSGg/WA 9cnbXtOw9PsuKjbO+r8tM+MbRLGeKmPUh1oAJuhyOCwx3aHV4Okt4qzex3SNQ9krLhQC KNng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=t4E23KpgkBrDH2wuNHn6WT+gzuNBo0mzHcr28T0v8lA=; b=QmeV+4UTww5qeIcbLJsSjsvdF/jUM3WfYSh2OkC1hA2FBZ5qdJGZruz9OUziboRNgH 1eFzEzylGP3vbZKjo+LgnYzorpmPbBOYf6eIXAYbc3wLHjROvHFdgPYrBd1YMIHAlGYy tw2mmt6ncS0nWKJsTtx2Ot0LFvw96JCwOt2+aL+LgUdJWP9NLJutDBlq5TmgzFbiOFAt SWydycQaaGcldDqWObi9GI254OzP4NHfU6e7S9zXU6zZXDED3QhRnd59cUPfhV53bk6N XGCGp7WRjxMrv9/s0QZNf7HZ7eLPZ3vxFj9H/HjE6xrrwak2gTG2pvrdwcosZicFJiYJ B5Ow== X-Gm-Message-State: AOAM531PbPN0nynY07QF+NJ0Uz2oRRZLkf693JMi90a6pYOl0Vqx0xMp 81H78BPuKGvk81i1MAj4T8l5jDbo4t+8ciEsg7cbnmWgUh/C+Q== X-Google-Smtp-Source: ABdhPJzqmUr3GfDraVAUn3Jz1iz5XAlYvbAtf8eb62/Cv6Vs+X1WiYwmuxj5fdWgpqQcEStQlw322hmVkfedbjfDVNM= X-Received: by 2002:a4a:b50b:: with SMTP id r11mr8189940ooo.64.1621600395732; Fri, 21 May 2021 05:33:15 -0700 (PDT) MIME-Version: 1.0 From: Sam Weerasinghe Date: Fri, 21 May 2021 05:33:05 -0700 Message-ID: Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::c34; envelope-from=oystersauce8@gmail.com; helo=mail-oo1-xc34.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.1 (-) X-Mailman-Approved-At: Fri, 21 May 2021 10:46:25 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) 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)) From unknown Sun Jun 15 08:43:34 2025 X-Loop: help-debbugs@gnu.org Subject: bug#48567: 28.0.50; ruby-toggle-string-quotes quotes the wrong pair of quotes Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 May 2021 00:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48567 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Sam Weerasinghe , 48567@debbugs.gnu.org Received: via spool by 48567-submit@debbugs.gnu.org id=B48567.162181765226774 (code B ref 48567); Mon, 24 May 2021 00:55:01 +0000 Received: (at 48567) by debbugs.gnu.org; 24 May 2021 00:54:12 +0000 Received: from localhost ([127.0.0.1]:42032 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkyrE-0006xm-1C for submit@debbugs.gnu.org; Sun, 23 May 2021 20:54:12 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:40756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lkyrC-0006xV-2e for 48567@debbugs.gnu.org; Sun, 23 May 2021 20:54:10 -0400 Received: by mail-wr1-f42.google.com with SMTP id z17so26737526wrq.7 for <48567@debbugs.gnu.org>; Sun, 23 May 2021 17:54:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ksrlTKN4ZGyeQRxpC91lUqRYZBVkpmecYGGNrn7G9iY=; b=ARv4q24BuTM5ydFGAOTdKIZIMLsRiVgT7NALo+uFz2aw6dW8HYRztZnhIc1vGFM4/3 ek/6p+VDT/ODmB3W8nup/X5T8IIs903TgLZJqhevlYMgiKDGq1G1oXO4/6i2R2VMeQBl C2HWzXWvNVrqxmnN/kPspNHOJ0iMAwSnlkkCxmTk7wcGotjqyTTQnvA8O5A769TI6AY+ D0irl0B5jdWWVRTKcGSteRJE0E5Zk4dBbZzop8UY9x6HvfzpDMObb9FsXzOxqNvd6lL5 EnMyqBRMygE0X88zjIhX1W5oK1oR/dymwvtlVSmc3YsqR9Gaj/P1D/EcDW2xZMsNTfR/ D1fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ksrlTKN4ZGyeQRxpC91lUqRYZBVkpmecYGGNrn7G9iY=; b=jwFfcEqC/5hux76kyT1PkIlwijmgjkAOoRxw85UA83RzBpz80p4VrqpV/huM/wp098 mrf3s0ZiRbUvuik9aJKjpo3zHJFroEHHzWKXbbHt23rGxgfY2MvtQvFeXfb4WlxTXzi5 U4hbQ5+2As/FsV/1zQ/r27RGLtT50Qppwieg5TS4m+vmBjS7yhrxmRAqUpdEmcVWIyRP teJi7AVzvztJ9lg+PUrk2gO5UgHzqJJFD/KuvwMfQGrdsuifdwmzgUVuf4sTIkAI4OwM ms2vm7RhSZc+ZLIIFqfgdtKJsdQ2k5faaroGGbEmG0r+8NnLTQbFdEHlnhONDVHxQU/H jB9w== X-Gm-Message-State: AOAM53167fCW+OXAfXQmiLWAHqv85t/LSy1dpoE+vbzZEco6fw0QmH5w t7S7w9CWl7CxHfktLlFyy2LMmpVaBaA= X-Google-Smtp-Source: ABdhPJwUMFjcnLP185UbSDIRDdi4xO2zg6lqI4/Ueq1gTNoiN6I1ZD2OpdBfMsJExdpt4vdhhcdwzg== X-Received: by 2002:adf:e4c8:: with SMTP id v8mr19754341wrm.345.1621817644187; Sun, 23 May 2021 17:54:04 -0700 (PDT) Received: from [192.168.0.6] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id o129sm6310706wmo.22.2021.05.23.17.54.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 23 May 2021 17:54:03 -0700 (PDT) References: From: Dmitry Gutov Message-ID: <37a29f79-f2b6-22a4-4e41-e2f9a7e768b4@yandex.ru> 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 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) 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.