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

pry syntax highlighting/color

Open jrab89 opened this issue 7 years ago • 6 comments

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!

jrab89 avatar Sep 28 '16 22:09 jrab89

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.

dgutov avatar Sep 28 '16 23:09 dgutov

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 [email protected] 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 .

Trevoke avatar Sep 29 '16 23:09 Trevoke

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

dgutov avatar Sep 30 '16 06:09 dgutov

@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 avatar Sep 30 '16 18:09 jrab89

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.

jrab89 avatar Sep 30 '16 18:09 jrab89

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

dgutov avatar Sep 30 '16 19:09 dgutov