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 qIYODplq1l/ZSgAA0tVLHw (envelope-from ) for ; Sun, 13 Dec 2020 19:25:13 +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 MDLkCZlq1l+LEgAAB5/wlQ (envelope-from ) for ; Sun, 13 Dec 2020 19:25:13 +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 756479404C4 for ; Sun, 13 Dec 2020 19:25:11 +0000 (UTC) Received: from localhost ([::1]:42832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koWzU-0002sX-Q4 for larch@yhetil.org; Sun, 13 Dec 2020 14:25:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55878) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koWyv-0002rW-4K for emacs-orgmode@gnu.org; Sun, 13 Dec 2020 14:24:33 -0500 Received: from relay9-d.mail.gandi.net ([217.70.183.199]:48309) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koWys-0001z1-W7 for emacs-orgmode@gnu.org; Sun, 13 Dec 2020 14:24:32 -0500 X-Originating-IP: 91.129.99.98 Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 4ECDAFF804; Sun, 13 Dec 2020 19:24:25 +0000 (UTC) From: Juri Linkov To: Kyle Meyer Subject: Re: [PATCH] ob-ruby.el: Don't reuse the same buffer among different named Organization: LINKOV.NET References: <87pn3zpag9.fsf@kyleam.com> <87o8jhqfwq.fsf@kyleam.com> <87pn3euzcg.fsf@kyleam.com> Date: Sun, 13 Dec 2020 21:22:50 +0200 In-Reply-To: <87pn3euzcg.fsf@kyleam.com> (Kyle Meyer's message of "Sun, 13 Dec 2020 04:03:29 GMT") Message-ID: <875z55fr3p.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.183.199; envelope-from=juri@linkov.net; helo=relay9-d.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, Aaron Madlon-Kay Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -0.80 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-Migadu-Queue-Id: 756479404C4 X-Spam-Score: -0.80 X-Migadu-Scanner: scn1.migadu.com X-TUID: MrWSxsex/rk0 --=-=-= Content-Type: text/plain >> I'm not sure if it should be org-mode's responsibility to resolve the >> actual command string, or if it should be done by >> `run-ruby-or-pop-to-buffer'. (It kind of seems like the latter?) >> >> Any thoughts? > > Given the current situation, I don't see a good option aside from doing > the functionp dance in org-babel-ruby-initiate-session as well. Even if > inf-ruby's check was moved downstream of run-ruby-or-pop-to-buffer, I > think it'd be good to fix on ob-ruby's end to work with the current > inf-ruby. > > Juri, what do you think? Thanks for notifying me. I completely agree that the most suitable place to fix would be in org-babel-ruby-initiate-session. So here is a patch that I tested with different org header args: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-ruby.el-Funcall-command-if-it-s-a-function-from-i.patch >From 41218eafa9285844ea4e84c52e265b2c0232c1ba Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 13 Dec 2020 21:21:37 +0200 Subject: [PATCH] ob-ruby.el: Funcall command if it's a function from inf-ruby-implementations * lisp/ob-ruby.el (org-babel-ruby-initiate-session): When 'command' is a function from 'inf-ruby-implementations', use 'funcall' to get a command string for the first arg of 'run-ruby-or-pop-to-buffer'. This is like what 'run-ruby' does. --- lisp/ob-ruby.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/ob-ruby.el b/lisp/ob-ruby.el index 5ed29f889..2e33bfa29 100644 --- a/lisp/ob-ruby.el +++ b/lisp/ob-ruby.el @@ -159,13 +159,16 @@ org-babel-ruby-initiate-session then create one. Return the initialized session." (unless (string= session "none") (require 'inf-ruby) - (let* ((cmd (cdr (or (assq :ruby params) - (assoc inf-ruby-default-implementation - inf-ruby-implementations)))) + (let* ((command (cdr (or (assq :ruby params) + (assoc inf-ruby-default-implementation + inf-ruby-implementations)))) (buffer (get-buffer (format "*%s*" session))) (session-buffer (or buffer (save-window-excursion (run-ruby-or-pop-to-buffer - cmd (or session "ruby") + (if (functionp command) + (funcall command) + command) + (or session "ruby") (unless session (inf-ruby-buffer))) (current-buffer))))) -- 2.25.1 --=-=-=--