nonsequitur / inf-ruby

218 stars 68 forks source link

pry syntax highlighting/color #88

Open jrab89 opened 7 years ago

jrab89 commented 7 years ago

Using pry from inf-ruby looks like this:

screen shot 2016-09-28 at 5 38 51 pm

Using pry from iTerm2 looks like this:

screen shot 2016-09-28 at 5 40 14 pm

Is there a way to get pry's syntax highlighting from within inf-ruby?

Here's what my inf-ruby configuration looks like:

(require 'inf-ruby)
(setq inf-ruby-default-implementation "pry")
(add-hook 'inf-ruby-mode-hook
  (function
    (lambda ()
      (setq show-trailing-whitespace nil)
      (linum-mode 0))))

Here's my ~/.pryrc:

Pry.config.correct_indent = false if ENV['INSIDE_EMACS']

Thanks for your help!

dgutov commented 7 years ago

Over here, I do have the return values highlighted. But IIUC you're asking about the input text.

That sounds difficult, because comint-mode doesn't replace the input lines with their echoes from the external process. Not sure how that could work in practice, with different kinds of REPLs.

Trevoke commented 7 years ago

Could we do something like.. Turn on the echo in the REPL and colorize the echo?

On Wed, Sep 28, 2016 at 7:08 PM Dmitry Gutov notifications@github.com wrote:

Over here, I do have the return values highlighted. But IIUC you're asking about the input text.

That sounds difficult, because comint-mode doesn't replace the input lines with their echoes from the external process. Not sure how that could work in practice, with different kinds of REPLs.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nonsequitur/inf-ruby/issues/88#issuecomment-250327495, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEJSZWkrspDO9BANSfiGH1MBDQ-g1o8ks5quvNPgaJpZM4KJZgI .

dgutov commented 7 years ago

It might be possible, and it would need to happen in comint.el. If you're interested, please give it a try.

jrab89 commented 7 years ago

@dgutov That's strange that you're getting return values highlighted and I'm not.

I'm getting the same result too when I replace my .emacs with this minimal one:

(setq package-archives
  '(("gnu" . "https://elpa.gnu.org/packages/")
    ("marmalade" . "https://marmalade-repo.org/packages/")))

(require 'package)
(setq package-enable-at-startup nil)
(package-initialize)
(package-refresh-contents)

(defvar my-packages '(inf-ruby exec-path-from-shell))

(dolist (p my-packages)
  (when (not (package-installed-p p))
    (package-install p)))

(require 'inf-ruby)
(setq inf-ruby-default-implementation "pry")
(add-hook 'inf-ruby-mode-hook
  (function
    (lambda ()
      (setq show-trailing-whitespace nil)
      (linum-mode 0))))

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

Here's what I see:

screen shot 2016-09-30 at 1 16 22 pm

Any ideas what could be going wrong on my end? I'm using emacs 24.5.1 from https://emacsformacosx.com

jrab89 commented 7 years ago

I'm not sure why, but my Pry.color was false when running pry within inf-ruby. I added Pry.color = true to my ~/.pryrc and now I get colorized return values.

dgutov commented 7 years ago

Ah yup, I have that in my .pryrc as well.