emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/inf-ruby a85ae010c6 046/265: Handle different prompts, no


From: ELPA Syncer
Subject: [nongnu] elpa/inf-ruby a85ae010c6 046/265: Handle different prompts, not just the IRB default
Date: Sat, 9 Jul 2022 21:59:12 -0400 (EDT)

branch: elpa/inf-ruby
commit a85ae010c678efab205edcff4858f65938b7fc43
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Handle different prompts, not just the IRB default
    
    * The regexp is adapted from Rinari.
    * Fixes #6.
---
 inf-ruby.el | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/inf-ruby.el b/inf-ruby.el
index 6bd299d95f..612bb04b6e 100755
--- a/inf-ruby.el
+++ b/inf-ruby.el
@@ -27,10 +27,24 @@
 (defvar inf-ruby-default-implementation "ruby"
   "Which Ruby implementation to use if none is specified.")
 
-(defvar inf-ruby-first-prompt-pattern "^irb(.*)[0-9:]+0> *"
+(defconst inf-ruby-prompt-format
+  (mapconcat
+   #'identity
+   '("\\(^%s> .*\\)"                     ; Simple
+     "\\(^\\(irb([^)]+)"                 ; IRB default
+     "\\(\[[0-9]+\] \\)?[Pp]ry ?([^)]+)" ; Pry
+     "\\(jruby-\\|JRUBY-\\)?[1-9]\\.[0-9]\\.[0-9]+\\(-?p?[0-9]+\\)?" ; RVM
+     ;; Statement and nesting counters, common to the last three.
+     "\\) ?[0-9:]* ?%s *\\)")
+   "\\|")
+  "Format string for the prompt regexp pattern.
+Two placeholders: first char in the Simple prompt, and the last
+graphical char in all other prompts.")
+
+(defvar inf-ruby-first-prompt-pattern (format inf-ruby-prompt-format ">" ">")
   "First prompt regex pattern of Ruby interpreter.")
 
-(defvar inf-ruby-prompt-pattern "^\\(irb(.*)[0-9:]+[>*\"'] *\\)+"
+(defvar inf-ruby-prompt-pattern (format inf-ruby-prompt-format "[?>]" 
"[\]>*\"'/`]")
   "Prompt regex pattern of Ruby interpreter.")
 
 (defvar inf-ruby-mode-hook nil



reply via email to

[Prev in Thread] Current Thread [Next in Thread]