From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: [PATCH] Update ob-ruby for inf-ruby 2.5 Date: Tue, 27 Dec 2016 11:00:53 -0500 Message-ID: <20161227160053.3yy2t3ijoaqojzxt@eyeBook> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="yn3zvvrwvmrfq36r" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41723) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cLuBP-0000ad-2d for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 11:00:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cLuBM-0007Wr-24 for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 11:00:59 -0500 Received: from mail.cybercode.nyc ([45.55.183.129]:37975) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cLuBL-0007WW-TD for emacs-orgmode@gnu.org; Tue, 27 Dec 2016 11:00:55 -0500 Received: from authenticated-user (mail.cybercode.nyc [45.55.183.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.cybercode.nyc (Postfix) with ESMTPSA id D3172140378 for ; Tue, 27 Dec 2016 11:00:53 -0500 (EST) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --yn3zvvrwvmrfq36r Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 --yn3zvvrwvmrfq36r Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-Update-ob-ruby-for-inf-ruby-2.5.patch" >From aa836b45487e61de6e74b6edde3c07ab5b885eb8 Mon Sep 17 00:00:00 2001 From: Rick Frankel 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 --yn3zvvrwvmrfq36r--