emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] ob-ruby.el: Don't reuse the same buffer among different named


From: Kyle Meyer
Subject: [PATCH] ob-ruby.el: Don't reuse the same buffer among different named
Date: Fri, 27 Nov 2020 01:42:30 -0500

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 via email to

[Prev in Thread] Current Thread [Next in Thread]