emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Mike Gauland <mikelygee@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Passing table to Ruby session
Date: Thu, 31 Aug 2023 09:58:01 +0000	[thread overview]
Message-ID: <875y4vv8ie.fsf@localhost> (raw)
In-Reply-To: <87pm3ut3zi.fsf@localhost>

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

Ihor Radchenko <yantar92@posteo.net> writes:

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

Fixed, on main.
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=deb5ea0fc

There are still some issues with inf-ruby I cannot understand though.
When I tried to evaluate the src blocks multiple times, inf-ruby (AFAIU)
interprets some of the puts output as input for some reason, which is
bizarre and does not look like Org's fault.

May you please check if you can reproduce the same problem on your side?

Instructions:

1. Download the attached bug.org file
2. Clone the latest Org: git clone https://git.savannah.gnu.org/cgit/emacs/org-mode.git
3. cd org-mode
4. make repro REPRO_ARGS="-L /path/to/inf-ruby -l ob-ruby /path/to/bug.org"
5. Go to the second code block (the one with :session)
6. Evaluate it several times
7. At some point, you will see either empty result or an error.
   In the *ruby* buffer, you will see
   _org_babel_ruby_prompt (irb):481:in `<main>': undefined method `_org_babel_ruby_prompt' for main:Object (NoMethodError)
	from /usr/lib64/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
	from /usr/bin/irb:25:in `load'
	from /usr/bin/irb:25:in `<main>'
_org_babel_ruby_prompt


[-- Attachment #2: bug.org --]
[-- Type: application/vnd.lotus-organizer, Size: 6246 bytes --]

# Without a session, this works even when the table isn't shortened:
#
#+begin_src ruby :var raw_data=raw-data :colnames no :exports code :results output
puts(raw_data.count)
#+end_src

#+RESULTS:
: 77


# The next two blocks *only* work when the table is cut off at 73. If the
# last two lines are added back in to the table, the ruby session does not
# return.
# Also, even with a truncated table, I don't get any output without the
# extra call to puts() to print a blank line.
#
#+begin_src ruby :var raw_data=raw-data :session :colnames no :exports code :results output
puts(raw_data.count)
puts()
#+end_src

#+RESULTS:
: 77


#+begin_src ruby :var raw_data=raw-data :session :colnames no :exports code :results value
raw_data.count
#+end_src

#+RESULTS:
: 77


  #+NAME: raw-data
  | Column 1 | Column 2 | Notes                                     |
  |----------+----------+-------------------------------------------|
  |        0 |        0 | This is note #0. It just takes up space.  |
  |        1 |        1 | This is note #1. It just takes up space.  |
  |        2 |        2 | This is note #2. It just takes up space.  |
  |        3 |        3 | This is note #3. It just takes up space.  |
  |        4 |        4 | This is note #4. It just takes up space.  |
  |        5 |        5 | This is note #5. It just takes up space.  |
  |        6 |        6 | This is note #6. It just takes up space.  |
  |        7 |        7 | This is note #7. It just takes up space.  |
  |        8 |        8 | This is note #8. It just takes up space.  |
  |        9 |        9 | This is note #9. It just takes up space.  |
  |       10 |       10 | This is note #10. It just takes up space. |
  |       11 |       11 | This is note #11. It just takes up space. |
  |       12 |       12 | This is note #12. It just takes up space. |
  |       13 |       13 | This is note #13. It just takes up space. |
  |       14 |       14 | This is note #14. It just takes up space. |
  |       15 |       15 | This is note #15. It just takes up space. |
  |       16 |       16 | This is note #16. It just takes up space. |
  |       17 |       17 | This is note #17. It just takes up space. |
  |       18 |       18 | This is note #18. It just takes up space. |
  |       19 |       19 | This is note #19. It just takes up space. |
  |       20 |       20 | This is note #20. It just takes up space. |
  |       21 |       21 | This is note #21. It just takes up space. |
  |       22 |       22 | This is note #22. It just takes up space. |
  |       23 |       23 | This is note #23. It just takes up space. |
  |       24 |       24 | This is note #24. It just takes up space. |
  |       25 |       25 | This is note #25. It just takes up space. |
  |       26 |       26 | This is note #26. It just takes up space. |
  |       27 |       27 | This is note #27. It just takes up space. |
  |       28 |       28 | This is note #28. It just takes up space. |
  |       29 |       29 | This is note #29. It just takes up space. |
  |       30 |       30 | This is note #30. It just takes up space. |
  |       31 |       31 | This is note #31. It just takes up space. |
  |       32 |       32 | This is note #32. It just takes up space. |
  |       33 |       33 | This is note #33. It just takes up space. |
  |       34 |       34 | This is note #34. It just takes up space. |
  |       35 |       35 | This is note #35. It just takes up space. |
  |       36 |       36 | This is note #36. It just takes up space. |
  |       37 |       37 | This is note #37. It just takes up space. |
  |       38 |       38 | This is note #38. It just takes up space. |
  |       39 |       39 | This is note #39. It just takes up space. |
  |       40 |       40 | This is note #40. It just takes up space. |
  |       41 |       41 | This is note #41. It just takes up space. |
  |       42 |       42 | This is note #42. It just takes up space. |
  |       43 |       43 | This is note #43. It just takes up space. |
  |       44 |       44 | This is note #44. It just takes up space. |
  |       45 |       45 | This is note #45. It just takes up space. |
  |       46 |       46 | This is note #46. It just takes up space. |
  |       47 |       47 | This is note #47. It just takes up space. |
  |       48 |       48 | This is note #48. It just takes up space. |
  |       49 |       49 | This is note #49. It just takes up space. |
  |       50 |       50 | This is note #50. It just takes up space. |
  |       51 |       51 | This is note #51. It just takes up space. |
  |       52 |       52 | This is note #52. It just takes up space. |
  |       53 |       53 | This is note #53. It just takes up space. |
  |       54 |       54 | This is note #54. It just takes up space. |
  |       55 |       55 | This is note #55. It just takes up space. |
  |       56 |       56 | This is note #56. It just takes up space. |
  |       57 |       57 | This is note #57. It just takes up space. |
  |       58 |       58 | This is note #58. It just takes up space. |
  |       59 |       59 | This is note #59. It just takes up space. |
  |       60 |       60 | This is note #60. It just takes up space. |
  |       61 |       61 | This is note #61. It just takes up space. |
  |       62 |       62 | This is note #62. It just takes up space. |
  |       63 |       63 | This is note #63. It just takes up space. |
  |       64 |       64 | This is note #64. It just takes up space. |
  |       65 |       65 | This is note #65. It just takes up space. |
  |       66 |       66 | This is note #66. It just takes up space. |
  |       67 |       67 | This is note #67. It just takes up space. |
  |       68 |       68 | This is note #68. It just takes up space. |
  |       69 |       69 | This is note #69. It just takes up space. |
  |       70 |       70 | This is note #70. It just takes up space. |
  |       71 |       71 | This is note #71. It just takes up space. |
  |       72 |       72 | This is note #72. It just takes up space. |
  |       73 |       73 | This is note #73. It just takes up space. |
  |       74 |       74 | This is note #74. It just takes up space. |
  |       75 |       75 | This is note #75. It just takes up space. |

[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

      parent reply	other threads:[~2023-08-31  9:58 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
2023-08-14 10:18               ` Ihor Radchenko
2023-08-25 13:19                 ` Ihor Radchenko
2023-08-31  9:58             ` Ihor Radchenko [this message]

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=875y4vv8ie.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=mikelygee@gmail.com \
    /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).