emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mike Gauland <mikelygee@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Passing table to Ruby session
Date: Mon, 14 Aug 2023 08:26:53 +1200	[thread overview]
Message-ID: <cf567ae3-6a38-4d4b-9a3b-2e7df0ebaac8@gmail.com> (raw)
In-Reply-To: <87pm3ut3zi.fsf@localhost>

[-- Attachment #1: Type: text/plain, Size: 887 bytes --]

On 11/08/23 19:47, Ihor Radchenko wrote:
> On Org side, the best we might do is splitting the long command into 
> multiline (if ruby REPL supports line continuation like \ this or 
> similar). Of course, it will be a workaround.

I've redefined org-babel-ruby-var-to-ruby in my init.el to add a newline 
after each element in an array, which I think will work for anything 
less than a 4k-long string. Ideally, the hard-coded \n would follow the 
EOL convention of the buffer, but I haven't gotten that far yet.


(defun org-babel-ruby-var-to-ruby (var)
   "Convert VAR into a ruby variable.
Convert an elisp value into a string of ruby source code
specifying a variable of the same value."
   (if (listp var)
       (concat "[" (mapconcat #'org-babel-ruby-var-to-ruby var ", \n") "]")
     (if (eq var 'hline)
     org-babel-ruby-hline-to
       (format "%S" var))))

[-- Attachment #2: Type: text/html, Size: 1574 bytes --]

  reply	other threads:[~2023-08-13 20:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09  8:17 Passing table to Ruby session Mike Gauland
2023-08-09 10:14 ` Ihor Radchenko
2023-08-09 19:06   ` Mike Gauland
2023-08-09 21:24     ` Mike Gauland
2023-08-10  4:40       ` Mike Gauland
2023-08-10  9:11       ` Ihor Radchenko
2023-08-11  1:24         ` Mike Gauland
2023-08-11  7:47           ` Ihor Radchenko
2023-08-13 20:26             ` Mike Gauland [this message]
2023-08-14 10:18               ` Ihor Radchenko
2023-08-25 13:19                 ` Ihor Radchenko
2023-08-31  9:58             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf567ae3-6a38-4d4b-9a3b-2e7df0ebaac8@gmail.com \
    --to=mikelygee@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).