branch: elpa/inf-ruby commit 0ce7f4049edcae188b4643b3163e5301f9ef09cc Merge: 997b3c5f9d 7337255b0b Author: Dmitry Gutov <dgu...@yandex.ru> Commit: GitHub <nore...@github.com>
Merge pull request #169 from pritambaral/support-tramp Add support for TRAMP to ruby-send-* and ruby-load-file --- inf-ruby.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/inf-ruby.el b/inf-ruby.el index d7ec4d809c..c65129db51 100755 --- a/inf-ruby.el +++ b/inf-ruby.el @@ -484,6 +484,14 @@ Must not contain ruby meta characters.") (defconst ruby-eval-separator "") +(defun inf-ruby-file-local-name (filename) + "Convert FILENAME so that it can be passed to an inferior Ruby +process running over TRAMP, by removing the remote part of it." + ;; TODO: Replace this implementation with (file-local-name ...) when the + ;; oldest supported Emacs version is bumped to 26.1 + (or (file-remote-p filename 'localname) + filename)) + (defun ruby-send-region (start end &optional print prefix suffix line-adjust) "Send the current region to the inferior Ruby process." (interactive "r\nP") @@ -508,7 +516,8 @@ Must not contain ruby meta characters.") (setq line (+ line line-adjust))) (comint-send-string (inf-ruby-proc) (format "eval <<'%s', %s, %S, %d\n" term inf-ruby-eval-binding - file line)) + (inf-ruby-file-local-name file) + line)) (if prefix (comint-send-string (inf-ruby-proc) prefix)) (comint-send-region (inf-ruby-proc) start end) @@ -797,7 +806,7 @@ Then switch to the process buffer." (setq ruby-prev-l/c-dir/file (cons (file-name-directory file-name) (file-name-nondirectory file-name))) (comint-send-string (inf-ruby-proc) (concat "(load \"" - file-name + (inf-ruby-file-local-name file-name) "\"\)\n"))) (defun ruby-load-current-file ()