Org-mode mailing list
 help / color / mirror / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Kyle Meyer <kyle@kyleam.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] ob-ruby.el: allow specification of ruby command w/header arg
Date: Wed, 25 Nov 2020 21:41:53 +0200
Message-ID: <87r1oh6x6m.fsf@mail.linkov.net> (raw)
In-Reply-To: <87ft5b63hg.fsf@kyleam.com> (Kyle Meyer's message of "Sat, 14 Nov 2020 16:19:23 -0500")

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

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-ruby.el-Don-t-reuse-the-same-buffer-among-differe.patch --]
[-- Type: text/x-diff, Size: 1646 bytes --]

From a20049fc53f4474b3c6d50da08369dbb67af9c38 Mon Sep 17 00:00:00 2001
From: Juri Linkov <juri@linkov.net>
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


  reply	other threads:[~2020-11-25 19:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  8:49 Aaron Madlon-Kay
2020-10-20  8:49 ` [PATCH] ob-ruby.el: allow specification of ruby command w/header arg Aaron Madlon-Kay
2020-10-24 11:39   ` Bastien
2020-10-25  1:21     ` Aaron Madlon-Kay
2020-11-10 19:34   ` Juri Linkov
2020-11-14 21:19     ` Kyle Meyer
2020-11-25 19:41       ` Juri Linkov [this message]
2020-11-27  6:42         ` [PATCH] ob-ruby.el: Don't reuse the same buffer among different named Kyle Meyer
2020-11-28 22:23           ` Kyle Meyer
2020-12-11  7:23             ` Aaron Madlon-Kay
2020-12-13  4:03               ` Kyle Meyer
2020-12-13 19:22                 ` Juri Linkov
2020-12-13 20:00                   ` Kyle Meyer
2020-12-14  0:52                     ` Aaron Madlon-Kay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://orgmode.org

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r1oh6x6m.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=kyle@kyleam.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git