inf-ruby icon indicating copy to clipboard operation
inf-ruby copied to clipboard

Restart the current process

Open sam-s opened this issue 6 years ago • 3 comments

I run ruby on a remote host using ssh so my process dies all the time. I want to be able to restart the current buffer's process (without wiping out the previous buffer content!) How do I do that?

sam-s avatar Jul 15 '19 20:07 sam-s

I suppose (run-ruby inf-ruby-buffer-command) could do the trick? It creates a new buffer, though.

dgutov avatar Jul 16 '19 01:07 dgutov

New buffer is precisely what I want to avoid.

sam-s avatar Jul 16 '19 01:07 sam-s

I think it's either create a new buffer, or keep the old contents. You could try to copy them over to the new buffer, though, but implementing that is up to you. The minimal solution is this:

(defun inf-ruby-restart-process ()
  (interactive)
  (let ((command inf-ruby-buffer-command)
        (name inf-ruby-buffer-impl-name)
        kill-buffer-query-functions)
    ;; Copy the current contents.
    (kill-buffer (current-buffer))
    (run-ruby command name)
    ;; Insert them here somehow.
    ))

dgutov avatar Jul 16 '19 12:07 dgutov

Looks like this was implemented as part of #145 (the user option is inf-ruby-reuse-older-buffers, on by default).

dgutov avatar Sep 28 '23 23:09 dgutov