summaryrefslogtreecommitdiff
path: root/sample/inf-ruby.el
diff options
context:
space:
mode:
Diffstat (limited to 'sample/inf-ruby.el')
-rw-r--r--sample/inf-ruby.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/sample/inf-ruby.el b/sample/inf-ruby.el
index c7d5d363d7..317bf21d5f 100644
--- a/sample/inf-ruby.el
+++ b/sample/inf-ruby.el
@@ -146,6 +146,25 @@ so it only valid in rbc."
(re-search-backward P)
))
+(if (not (functionp 'replace-in-string))
+ ;; simple version of replace-in-string in XEmacs
+ (defun replace-in-string (str regexp newtext)
+ "Replace all matches in STR for REGEXP with NEWTEXT string,
+ and returns the new string."
+ (let ((rtn-str "")
+ (start 0)
+ (special)
+ match prev-start)
+ (while (setq match (string-match regexp str start))
+ (setq prev-start start
+ start (match-end 0)
+ rtn-str
+ (concat
+ rtn-str
+ (substring str prev-start match) newtext)))
+ (concat rtn-str (substring str start))))
+)
+
(defun ruby-get-old-input ()
"Snarf the sexp ending at point"
(save-excursion