emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Update ob-ruby for inf-ruby 2.5
@ 2016-12-27 16:00 Rick Frankel
  2017-01-01 18:56 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Rick Frankel @ 2016-12-27 16:00 UTC (permalink / raw)
  To: emacs-orgmode

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

inf-ruby (melpa stable) has recently been updated to v2.5. The library has
been significantly re-factored, and `run-ruby` no longer accepts `nil` has
the command name. The following patch updates ob-ruby so that it continues
to work w/ inf-ruby v2.5. It should still (untested) work with the previous
version (2.4).


rick


[-- Attachment #2: 0001-Update-ob-ruby-for-inf-ruby-2.5.patch --]
[-- Type: text/plain, Size: 1584 bytes --]

From aa836b45487e61de6e74b6edde3c07ab5b885eb8 Mon Sep 17 00:00:00 2001
From: Rick Frankel <rick@rickster.com>
Date: Mon, 26 Dec 2016 15:00:32 -0500
Subject: [PATCH] Update ob-ruby for inf-ruby 2.5

 * lisp/ob-ruby.el (org-babel-ruby-initiate-session): `run-ruby` has
   very different semantics in inf-ruby 2.5. Set ruby command to the
   default which used to be set by `run-ruby` and try and find already
   existing buffer before invocation.
---
 lisp/ob-ruby.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el
index 6415f354b..e510fc753 100644
--- a/lisp/ob-ruby.el
+++ b/lisp/ob-ruby.el
@@ -150,12 +150,16 @@ If there is not a current inferior-process-buffer in SESSION
 then create one.  Return the initialized session."
   (unless (string= session "none")
     (require 'inf-ruby)
-    (let ((session-buffer (save-window-excursion
-			    (run-ruby nil session) (current-buffer))))
+    (let* ((cmd (cdr (assoc inf-ruby-default-implementation
+			    inf-ruby-implementations)))
+	   (buffer (get-buffer (format "*%s*" session)))
+	   (session-buffer (or buffer (save-window-excursion
+					(run-ruby cmd session)
+					(current-buffer)))))
       (if (org-babel-comint-buffer-livep session-buffer)
 	  (progn (sit-for .25) session-buffer)
-        (sit-for .5)
-        (org-babel-ruby-initiate-session session)))))
+	(sit-for .5)
+	(org-babel-ruby-initiate-session session)))))
 
 (defvar org-babel-ruby-eoe-indicator ":org_babel_ruby_eoe"
   "String to indicate that evaluation has completed.")
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Update ob-ruby for inf-ruby 2.5
  2016-12-27 16:00 [PATCH] Update ob-ruby for inf-ruby 2.5 Rick Frankel
@ 2017-01-01 18:56 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2017-01-01 18:56 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Rick Frankel <rick@rickster.com> writes:

> inf-ruby (melpa stable) has recently been updated to v2.5. The library has
> been significantly re-factored, and `run-ruby` no longer accepts `nil` has
> the command name. The following patch updates ob-ruby so that it continues
> to work w/ inf-ruby v2.5. It should still (untested) work with the previous
> version (2.4).

I applied it to maint branch. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-01 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-27 16:00 [PATCH] Update ob-ruby for inf-ruby 2.5 Rick Frankel
2017-01-01 18:56 ` Nicolas Goaziou

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