emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/inf-ruby f8d7404ea9 5/6: use double quoted strings to be a


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby f8d7404ea9 5/6: use double quoted strings to be able to use \n
Date: Thu, 28 Sep 2023 13:01:33 -0400 (EDT)

branch: elpa/inf-ruby
commit f8d7404ea95c703fa340eac2f44e268a24905687
Author: bo-tato <122528427+bo-tato@users.noreply.github.com>
Commit: bo-tato <122528427+bo-tato@users.noreply.github.com>

    use double quoted strings to be able to use \n
---
 inf-ruby.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 4754c1e493..91fccd173a 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -676,12 +676,13 @@ This function also removes itself from 
`pre-command-hook'."
         (buffer-substring-no-properties (point) (line-end-position))))))
 
 (defun ruby-shell--encode-string (string)
-  "Escape all backslashes, single quotes, and newlines in STRING."
+  "Escape all backslashes, double quotes, newlines, and # in STRING."
   (cl-reduce (lambda (string subst)
                (replace-regexp-in-string (car subst) (cdr subst) string))
              '(("\\\\" . "\\\\\\\\")
-               ("'" . "\\\\'")
-               ("\n" . "'\"\\\\n\"'"))
+               ("\"" . "\\\\\"")
+               ("#" . "\\\\#")
+               ("\n" . "\\\\n"))
              :initial-value string))
 
 (defun ruby-send-string (string &optional file line)
@@ -693,7 +694,7 @@ Optionally provide FILE and LINE metadata to Ruby."
                                     (format ", %S" (inf-ruby-file-local-name 
file)))
                                   (when (and file line)
                                     (format ", %d" line))))
-         (code (format "eval('%s', %s%s)\n"
+         (code (format "eval(\"%s\", %s%s)\n"
                        (ruby-shell--encode-string string)
                        inf-ruby-eval-binding
                        file-and-lineno)))



reply via email to

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