emacs-diffs
[Top][All Lists]
Advanced

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

master 844e82f: * lisp/org/ob-ruby.el (org-babel-ruby-initiate-session):


From: Juri Linkov
Subject: master 844e82f: * lisp/org/ob-ruby.el (org-babel-ruby-initiate-session): Use :ruby header arg.
Date: Sat, 14 Nov 2020 15:18:51 -0500 (EST)

branch: master
commit 844e82f5a837a16c64e32ff9dd41a9e9b3ad3432
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/org/ob-ruby.el (org-babel-ruby-initiate-session): Use :ruby header 
arg.
    
    Allow specification of ruby command using the :ruby header arg.
    https://lists.gnu.org/archive/html/emacs-orgmode/2020-11/msg00166.html
---
 lisp/org/ob-ruby.el | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
index 1b8088e..aa28bf1 100644
--- a/lisp/org/ob-ruby.el
+++ b/lisp/org/ob-ruby.el
@@ -51,7 +51,8 @@
 (defvar org-babel-default-header-args:ruby '())
 
 (defvar org-babel-ruby-command "ruby"
-  "Name of command to use for executing ruby code.")
+  "Name of command to use for executing ruby code.
+It's possible to override it by using a header argument `:ruby'")
 
 (defcustom org-babel-ruby-hline-to "nil"
   "Replace hlines in incoming tables with this when translating to ruby."
@@ -71,7 +72,7 @@
   "Execute a block of Ruby code with Babel.
 This function is called by `org-babel-execute-src-block'."
   (let* ((session (org-babel-ruby-initiate-session
-                  (cdr (assq :session params))))
+                  (cdr (assq :session params)) params))
          (result-params (cdr (assq :result-params params)))
          (result-type (cdr (assq :result-type params)))
          (full-body (org-babel-expand-body:generic
@@ -147,14 +148,15 @@ Emacs-lisp table, otherwise return the results as a 
string."
                 res)
       res)))
 
-(defun org-babel-ruby-initiate-session (&optional session _params)
+(defun org-babel-ruby-initiate-session (&optional session params)
   "Initiate a ruby session.
 If there is not a current inferior-process-buffer in SESSION
 then create one.  Return the initialized session."
   (unless (string= session "none")
     (require 'inf-ruby)
-    (let* ((cmd (cdr (assoc inf-ruby-default-implementation
-                           inf-ruby-implementations)))
+    (let* ((cmd (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 cmd session)



reply via email to

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