From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WB49FROgwF9AbQAA0tVLHw (envelope-from ) for ; Fri, 27 Nov 2020 06:43:31 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 2L8GEROgwF9rPwAAbx9fmQ (envelope-from ) for ; Fri, 27 Nov 2020 06:43:31 +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 DC4F494050F for ; Fri, 27 Nov 2020 06:43:30 +0000 (UTC) Received: from localhost ([::1]:58178 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kiXTd-0006MJ-Qu for larch@yhetil.org; Fri, 27 Nov 2020 01:43:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiXSr-0006LO-On for emacs-orgmode@gnu.org; Fri, 27 Nov 2020 01:42:41 -0500 Received: from pb-smtp20.pobox.com ([173.228.157.52]:52419) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiXSm-0002wW-41 for emacs-orgmode@gnu.org; Fri, 27 Nov 2020 01:42:41 -0500 Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 76912107B38; Fri, 27 Nov 2020 01:42:34 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:in-reply-to:date:message-id:mime-version:content-type; s=sasl; bh=ukrqmb0t9EjJC+LT2qhHwU6HPVg=; b=tri7dIXTqUC9YdQllAOD 1OS1JhesMFSSFmRAp/1QEsu00wfzoUkLlWilB4nnlMvxny1Ptwi8Dn9IglMv1ju3 oMeKIBzvpctis6Qn9G3vFzLEri6wlwem8j3I4bVAzEWJN88CFtCjPK6sTjZBZuaf EW4LsSBbnzIQBBTh2DXUcXY= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 6FD63107B37; Fri, 27 Nov 2020 01:42:34 -0500 (EST) (envelope-from kyle@kyleam.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=kyleam.com; h=from:to:cc:subject:in-reply-to:date:message-id:mime-version:content-type; s=mesmtp; bh=NjRn7UhQTlr2g1aYP+JemzWVMOEthLkLzJzawn1vXvo=; b=o1hy7Yj8V8EkCyfGwOdG3Bk19PhFQ1Gc0hvCWbg6wwThPN6M+vqftwok1kJc/DcT9UdJVNRxzyGtU1JcM+r32VAytdu9ct9vEHbLJ+jdw39R3bOy3GrwJdcEgZ7f2MgxA4/t6yR1QEtuVHrxkYwapyqUlisxu8+uHNNb0QlMMxM= Received: from localhost (unknown [45.33.91.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id E4EE1107B34; Fri, 27 Nov 2020 01:42:31 -0500 (EST) (envelope-from kyle@kyleam.com) From: Kyle Meyer To: Juri Linkov Subject: [PATCH] ob-ruby.el: Don't reuse the same buffer among different named In-Reply-To: <87r1oh6x6m.fsf@mail.linkov.net> Date: Fri, 27 Nov 2020 01:42:30 -0500 Message-ID: <87pn3zpag9.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: B9B2BF90-307B-11EB-A9C3-E43E2BB96649-24757444!pb-smtp20.pobox.com Received-SPF: pass client-ip=173.228.157.52; envelope-from=kyle@kyleam.com; helo=pb-smtp20.pobox.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -2.46 X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=pobox.com header.s=sasl header.b=tri7dIXT; dkim=pass header.d=kyleam.com header.s=mesmtp header.b=o1hy7Yj8; 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-TUID: 0VElodI3BClW Juri Linkov writes: > 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 Thank you. Sounds good to me. > --- > 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)) I think the above line can now be dropped. (No need to resend.) > +(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))))) Untested on my end, but makes sense as far as I can tell. I'll leave another day or so for any ob-ruby users to give feedback and then apply. Thanks.