From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GdbfJTC0vl88BAAA0tVLHw (envelope-from ) for ; Wed, 25 Nov 2020 19:44:48 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id GCYtITC0vl+zZgAAB5/wlQ (envelope-from ) for ; Wed, 25 Nov 2020 19:44:48 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 1E3C0940485 for ; Wed, 25 Nov 2020 19:44:48 +0000 (UTC) Received: from localhost ([::1]:38252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ki0id-0001xU-1j for larch@yhetil.org; Wed, 25 Nov 2020 14:44:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55092) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ki0i1-0001xA-5R for emacs-orgmode@gnu.org; Wed, 25 Nov 2020 14:44:09 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:52175) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ki0hy-0001hJ-Q8 for emacs-orgmode@gnu.org; Wed, 25 Nov 2020 14:44:08 -0500 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id B3431240002; Wed, 25 Nov 2020 19:44:01 +0000 (UTC) From: Juri Linkov To: Kyle Meyer Subject: Re: [PATCH] ob-ruby.el: allow specification of ruby command w/header arg Organization: LINKOV.NET References: <20201020084956.61337-1-aaron@madlon-kay.com> <20201020084956.61337-2-aaron@madlon-kay.com> <87y2j9j9ai.fsf@mail.linkov.net> <87ft5b63hg.fsf@kyleam.com> Date: Wed, 25 Nov 2020 21:41:53 +0200 In-Reply-To: <87ft5b63hg.fsf@kyleam.com> (Kyle Meyer's message of "Sat, 14 Nov 2020 16:19:23 -0500") Message-ID: <87r1oh6x6m.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=217.70.178.230; envelope-from=juri@linkov.net; helo=relay10.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: vnYzOnbODMmP --=-=-= Content-Type: text/plain >> ob-ruby.el: allow specification of session ruby command w/header arg >> >> * lisp/ob-ruby.el (org-babel-ruby-initiate-session): Use a header argument >> to get ruby command. > > I've ported it to the Org repo, but please avoid doing this in the > future. The preferred method is for development to happen through > Org's list and repo. Thanks, point taken. Now in https://github.com/nonsequitur/inf-ruby/issues/121 we came to the conclusion that another patch is needed for ob-ruby.el. This patch should allow sharing the same :session among code blocks for the same root dir only when :session is nil. But in case of a named :session, its commands always should be encapsulated within the buffer with the same name as :session. Therefore I'm submitting the patch here for inclusion to the Org repo. Thanks in advance. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-ruby.el-Don-t-reuse-the-same-buffer-among-differe.patch >From a20049fc53f4474b3c6d50da08369dbb67af9c38 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 25 Nov 2020 21:35:01 +0200 Subject: [PATCH] ob-ruby.el: Don't reuse the same buffer among different named sessions * lisp/ob-ruby.el (org-babel-ruby-initiate-session): Instead of run-ruby that always insists on using the existing buffer, use run-ruby-or-pop-to-buffer that allows using the buffer with the same name as :session header arg. Use the existing buffer returned by inf-ruby-buffer only when :session header arg is nil. https://github.com/nonsequitur/inf-ruby/issues/121 --- lisp/ob-ruby.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el index 5ad006429..47548ff7b 100644 --- a/lisp/ob-ruby.el +++ b/lisp/ob-ruby.el @@ -40,6 +40,8 @@ (require 'org-macs) (declare-function run-ruby "ext:inf-ruby" (&optional command name)) +(declare-function run-ruby-or-pop-to-buffer "ext:inf-ruby" (command &optional name buffer)) +(declare-function inf-ruby-buffer "ext:inf-ruby" ()) (declare-function xmp "ext:rcodetools" (&optional option)) (defvar inf-ruby-default-implementation) @@ -163,7 +165,10 @@ org-babel-ruby-initiate-session inf-ruby-implementations)))) (buffer (get-buffer (format "*%s*" session))) (session-buffer (or buffer (save-window-excursion - (run-ruby cmd session) + (run-ruby-or-pop-to-buffer + cmd (or session "ruby") + (unless session + (inf-ruby-buffer))) (current-buffer))))) (if (org-babel-comint-buffer-livep session-buffer) (progn (sit-for .25) session-buffer) -- 2.25.1 --=-=-=--