2001-01-19 Michael Kifer <kifer@cs.sunysb.edu>
[bpt/emacs.git] / lisp / ediff-init.el
index 475d59c..bfa77a7 100644 (file)
@@ -1667,6 +1667,18 @@ Checks if overlay's buffer exists."
 (defsubst ediff-nonempty-string-p (string)
   (and (stringp string) (not (string= string ""))))
 
+(unless (fboundp 'subst-char-in-string)
+  (defun subst-char-in-string (fromchar tochar string &optional inplace)
+    "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
+Unless optional argument INPLACE is non-nil, return a new string."
+    (let ((i (length string))
+         (newstr (if inplace string (copy-sequence string))))
+      (while (> i 0)
+       (setq i (1- i))
+       (if (eq (aref newstr i) fromchar)
+           (aset newstr i tochar)))
+      newstr)))
+
 (defun ediff-abbrev-jobname (jobname)
   (cond ((eq jobname 'ediff-directories)
         "Compare two directories")