diff --git a/emacs/.emacs.d/config/init-ruby.el b/emacs/.emacs.d/config/init-ruby.el index 2efa2a0..7259cf2 100644 --- a/emacs/.emacs.d/config/init-ruby.el +++ b/emacs/.emacs.d/config/init-ruby.el @@ -18,7 +18,16 @@ :commands (inf-ruby inf-ruby-console-auto) :general ([remap inf-ruby] #'inf-ruby-console-auto) - :hook (after-init . inf-ruby-switch-setup)) + :hook (after-init . inf-ruby-switch-setup) + :config + (defun inf-ruby-process-carriage-return (output) + (let ((processed (replace-regexp-in-string ".*\r" "" output))) + (if (string-match-p "\\`\n" processed) + (replace-regexp-in-string "\\`\n" "" processed) + processed))) + (defun inf-ruby-carriage-return-hook () + (add-hook 'comint-preoutput-filter-functions #'inf-ruby-process-carriage-return nil t)) + (add-hook 'inf-ruby-mode-hook #'inf-ruby-carriage-return-hook)) (use-package rbenv :hook (after-init . global-rbenv-mode)