aboutsummaryrefslogtreecommitdiff
path: root/emms.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2006-01-05 17:21:00 +0000
committerMichael Olson <mwolson@gnu.org>2006-01-05 17:21:00 +0000
commit4b913cf81982670faadaa3f9672a60e8ea63e720 (patch)
treece1ee476918b0e21ff72d12c5fdb241f158cbc0c /emms.el
parent417ef863ffd9868d086ad1f3046769e7c0dce821 (diff)
New XEmacs compatibility function: emms-replace-regexp-in-string
darcs-hash:20060105172144-1bfb2-36678408233ea377cc5b7deda59d37362948a78b.gz
Diffstat (limited to 'emms.el')
-rw-r--r--emms.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/emms.el b/emms.el
index 1c2a083..e547348 100644
--- a/emms.el
+++ b/emms.el
@@ -1186,5 +1186,21 @@ or negative to seek backwards."
((fboundp 'delete-itimer)
(delete-itimer timer)))))
+(defun emms-replace-regexp-in-string (regexp replacement text &optional fixedcase literal)
+ "Replace REGEXP with REPLACEMENT in TEXT.
+If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text.
+If fifth arg LITERAL is non-nil, insert REPLACEMENT literally."
+ (cond
+ ((fboundp 'replace-regexp-in-string)
+ (replace-regexp-in-string regexp replacement text fixedcase literal))
+ ((fboundp 'replace-in-string)
+ (replace-in-string text regexp replacement literal))
+ (t (let ((repl-len (length replacement))
+ start)
+ (while (setq start (string-match regexp text start))
+ (setq start (+ start repl-len)
+ text (replace-match replacement fixedcase literal text))))
+ text)))
+
(provide 'emms)
;;; emms.el ends here