emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Juri Linkov <juri@linkov.net>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] ob-ruby.el: Don't reuse the same buffer among different named
Date: Fri, 27 Nov 2020 01:42:30 -0500	[thread overview]
Message-ID: <87pn3zpag9.fsf@kyleam.com> (raw)
In-Reply-To: <87r1oh6x6m.fsf@mail.linkov.net>

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.


  reply	other threads:[~2020-11-27  6:43 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
2020-11-27  6:42         ` Kyle Meyer [this message]
2020-11-28 22:23           ` [PATCH] ob-ruby.el: Don't reuse the same buffer among different named 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://www.orgmode.org/

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

  git send-email \
    --in-reply-to=87pn3zpag9.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=juri@linkov.net \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).