emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Passing table to Ruby session


From: Mike Gauland
Subject: Re: Passing table to Ruby session
Date: Mon, 14 Aug 2023 08:26:53 +1200
User-agent: Mozilla Thunderbird

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))))


reply via email to

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