emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/inf-ruby 1a5aebea0d 213/265: Bring back interactive run-ru


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby 1a5aebea0d 213/265: Bring back interactive run-ruby
Date: Sat, 9 Jul 2022 21:59:27 -0400 (EDT)

branch: elpa/inf-ruby
commit 1a5aebea0d701aaeae3158e6a1d5407d7d341ff1
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Bring back interactive run-ruby
    
    Closes #112
---
 inf-ruby.el | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 920254ac0c..7a77732558 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -338,22 +338,40 @@ to that buffer. Otherwise create a new buffer."
   (setq impl (or impl "ruby"))
 
   (let ((command (cdr (assoc impl inf-ruby-implementations))))
-    (run-ruby-or-pop-to-buffer command impl
-                               (or (inf-ruby-buffer)
-                                   inf-ruby-buffer))))
+    (run-ruby command impl)))
 
 ;;;###autoload
-(defun run-ruby (command &optional name)
-  "Run an inferior Ruby process, input and output in a new buffer.
+(defun run-ruby (&optional command name)
+  "Run an inferior Ruby process, input and output in a buffer.
+
+If there is a process already running in a corresponding buffer,
+switch to that buffer. Otherwise create a new buffer.
 
 The consecutive buffer names will be:
 `*NAME*', `*NAME*<2>', `*NAME*<3>' and so on.
 
-NAME defaults to \"ruby\".
+COMMAND defaults to the default entry in
+`inf-ruby-implementations'. NAME defaults to \"ruby\".
 
 Runs the hooks `comint-mode-hook' and `inf-ruby-mode-hook'.
 
-\(Type \\[describe-mode] in the process buffer for the list of commands.)"
+Type \\[describe-mode] in the process buffer for the list of commands."
+  ;; This function is interactive and named like this for consistency
+  ;; with `run-python', `run-octave', `run-lisp' and so on.
+  ;; We're keeping both it and `inf-ruby' for backward compatibility.
+  (interactive)
+  (run-ruby-or-pop-to-buffer
+   (or command (cdr (assoc inf-ruby-default-implementation
+                           inf-ruby-implementations)))
+   (or name "ruby")
+   (or (inf-ruby-buffer)
+       inf-ruby-buffer)))
+
+(defun run-ruby-new (command &optional name)
+  "Create a new inferior Ruby process in a new buffer.
+
+COMMAND is the command to call. NAME will be used for the name of
+the buffer, defaults to \"ruby\"."
   (setq name (or name "ruby"))
 
   (let ((commandlist (split-string-and-unquote command))
@@ -380,7 +398,7 @@ Runs the hooks `comint-mode-hook' and `inf-ruby-mode-hook'.
 (defun run-ruby-or-pop-to-buffer (command &optional name buffer)
   (if (not (and buffer
                 (comint-check-proc buffer)))
-      (run-ruby command name)
+      (run-ruby-new command name)
     (pop-to-buffer buffer)
     (unless (and (string= inf-ruby-buffer-impl-name name)
                  (string= inf-ruby-buffer-command command))



reply via email to

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